public bool Reachable(DirectedGraph g, int v, int w) { DepthFirstSearch df = new DepthFirstSearch(g); df.Dfs(v); return(df.isVisited[w]); }
public StrongComponents(DirectedGraph graph) { this.graph = graph; this.reverseGraph = graph.Reverse(); dfs = new DepthFirstSearch(graph); cc = new int [graph.Vertices]; }
public TopologicalSort(DirectedGraph graph) { this.graph = graph; vertices = graph.Vertices; Dfs = new DepthFirstSearch(graph); }