Algorithm for computing partial orderings of dependency graphs
问题 I'm trying to compute a partial "topological sort" of a dependency graph, which is actually a DAG (Directed Acyclic Graph) to be precise; so as to execute tasks without conflicting dependencies in parallel. I came up with this simple algorithm because what I found on Google wasn't all that helpful (I keep finding only algorithms that themselves run in parallel to compute a normal topological sort). visit(node) { maxdist = 0; foreach (e : in_edge(node)) { maxdist = max(maxdist, 1 + visit