public DirectedBFS(DiGraph graph,int v) { this.v = v; this.graph = graph; edgeTo = Enumerable.Repeat(-1, graph.V()).ToArray<int>(); visited = new bool[graph.V()]; distTo = new int[graph.V()]; breadthFirstSearch (v); }
public TopologicalSort(DiGraph graph) { this.graph = graph; stack = new Stack<int> (); visited = new bool[graph.V ()]; for (int i = 0; i < graph.V(); i++) { if (!visited[i]) { depthFirstSearch (i); } } }