Example #1
0
        public bool Reachable(DirectedGraph g, int v, int w)
        {
            DepthFirstSearch df = new DepthFirstSearch(g);

            df.Dfs(v);
            return(df.isVisited[w]);
        }
Example #2
0
 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);
 }