New answers tagged

-1

Using Kahn's algorithm, we can easily keep track of unvisited vertices at each step for the node at topological order $k\in[1..n]$. Using backtracking we can effectively accomplish this. The worst case is a graph with no edges. In this case there are $n!$ topological orderings, and given that each contains $n$ nodes we are already at $n*n!$ output size ...


Top 50 recent answers are included