Topological sort: Difference between revisions

Content added Content deleted
(Better cycle detection for rust solution)
(Fixed jq example - minus function didn't work.)
Line 3,087: Line 3,087:
# Input: an object representing a dependency graph
# Input: an object representing a dependency graph
def minus(ary):
def minus(ary):
. as $G | reduce keys[] as $key ($G; $G[$key] -= ary);
. as $G | with_entries(.value -= ary);


# tsort/0 emits the topologically sorted nodes of the input,
# tsort/0 emits the topologically sorted nodes of the input,