Commit 205618b
committed
Fix topological sort head node initialization
CRITICAL BUG: Our implementation only added the FIRST head node to the ready
set and kept the rest as seeds. ODGI explicitly adds ALL head nodes at once:
From ODGI topological_sort.cpp lines 121-127:
"Dump all the heads into the oriented set, rather than having them as seeds.
We will only go for cycle-breaking seeds when we run out of heads."
This fundamental difference affected the traversal order and could cause
incorrect results in graphs with multiple connected components.
Fixed by adding ALL head (or tail) nodes to the ready set during
initialization, matching ODGI's behavior exactly.1 parent 053c44e commit 205618b
1 file changed
+16
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1438 | 1438 | | |
1439 | 1439 | | |
1440 | 1440 | | |
1441 | | - | |
| 1441 | + | |
| 1442 | + | |
1442 | 1443 | | |
1443 | | - | |
1444 | 1444 | | |
1445 | | - | |
1446 | | - | |
1447 | | - | |
1448 | | - | |
1449 | | - | |
1450 | | - | |
1451 | | - | |
1452 | | - | |
1453 | | - | |
1454 | | - | |
1455 | | - | |
1456 | | - | |
1457 | | - | |
1458 | | - | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
1459 | 1452 | | |
1460 | 1453 | | |
1461 | 1454 | | |
1462 | | - | |
1463 | | - | |
1464 | | - | |
1465 | | - | |
1466 | | - | |
1467 | | - | |
1468 | | - | |
1469 | | - | |
1470 | | - | |
1471 | | - | |
1472 | | - | |
1473 | | - | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
1474 | 1462 | | |
1475 | 1463 | | |
1476 | 1464 | | |
| |||
0 commit comments