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

            df.Dfs(v);
            return(df.isVisited[w]);
        }
コード例 #2
0
 public StrongComponents(DirectedGraph graph)
 {
     this.graph        = graph;
     this.reverseGraph = graph.Reverse();
     dfs = new DepthFirstSearch(graph);
     cc  = new int [graph.Vertices];
 }
コード例 #3
0
 public TopologicalSort(DirectedGraph graph)
 {
     this.graph = graph;
     vertices   = graph.Vertices;
     Dfs        = new DepthFirstSearch(graph);
 }