aryagraph.algorithms.dag.all_topological_sorts#

aryagraph.algorithms.dag.all_topological_sorts(g: Graph) → Iterator[list[Hashable]][source]#

Every topological order of g, generated lazily by backtracking.

A cyclic graph raises CycleError immediately. There can be up to n! orders; each is produced in O(n) amortised time beyond the output.