Graphs Advanced

Dependency edges encode direction

Pair [a,b] means b → a. Queue only courses with zero remaining indegree. For [[2,0],[2,1],[3,2]] plus isolated 4, one order is [0,1,4,2,3].

1 / 5

Count completed nodes

A stuck nonempty remainder contains a cycle. FindOrder returns [] on a cycle, not an incomplete prefix. Duplicate edges must be counted consistently in adjacency and indegree.

2 / 5

Dijkstra claims can become stale

Edges 0→1:8, 0→2:2, 2→1:1, 2→3:7, 1→3:2. Distances improve to [0,3,2,5]; heap claims (8,1) and (9,3) become stale. Finalize on a nonstale minimum extraction, not first discovery.

3 / 5

State the model and numeric range

Task weights are positive; the proof permits zero but not negative edges. Return -1 for unreachable nodes. Current Go domain uses 64-bit int. Lazy heap stores O(E) claims; count adjacency and stale work in the bounds.

4 / 5

Diagnose and transfer

After removing 0 and 1 from diamond prerequisites, 3 still needs 2. Validate any topological output by edge positions. Compare small shortest paths with repeated full-edge relaxation. Explain why BFS is insufficient for unequal weights.

5 / 5
←/→ or click edges to navigate · ? help · N notes · F fullscreen