2
$\begingroup$

There is an amazing answer to this question:

All possible topological orderings of a graph

By Neal Alexander. However, as user "dark blue" (I am not this user) notes:

g1 = Graph[{5 \[DirectedEdge] 7, 1 \[DirectedEdge] 2, 1 \[DirectedEdge] 5, 1 \[DirectedEdge] 6, 3 \[DirectedEdge] 7, 3 \[DirectedEdge] 2, 3 \[DirectedEdge] 4}]

TopologicalSortAll[g1]

Gives an error for the output:

Part::partw: Part 5 of {{0,1,1,0,0,1,0,1},{0,0,0,0,0,0,0,1},{0,0,0,0,0,0,1,1},{0,0,0,0,1,1,1,1}} does not exist. >>

Part::partw: Part 5 of {{0,1,1,0,0,1,0,1},{0,0,0,0,0,0,0,1},{0,0,0,0,0,0,1,1},{0,0,0,0,1,1,1,1}} does not exist. >>

Part::partw: Part 5 of {{0,1,1,0,0,1,0,1},{0,0,0,0,0,0,0,1},{0,0,0,0,0,0,1,1},{0,0,0,0,1,1,1,1}} does not exist. >>

General::stop: Further output of Part::partw will be suppressed during this calculation. >>

I've spent some time today trying to understand why this happens, and I can't figure it out. Is it something simple? Should I maybe not be asking this question in this manner?

Perhaps I should add that TopologicalSort[] works just fine, outputting {1, 6, 5, 3, 4, 2, 7} for the example graph (due to "dark blue").

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.