private void Dfs(IDiGraph g, int v)
 {
     Pre.Enqueue(v);
     marked[v] = true;
     foreach (int w in g.Adj(v))
     {
         if (!marked[w])
         {
             Dfs(g, w);
         }
     }
     Post.Enqueue(v);
     ReversePost.Push(v);
 }
Beispiel #2
0
 private void DFS(EdgeWeightedDigraph g, int v)
 {
     Pre.Enqueue(v);
     Marked[v] = true;
     foreach (var w in g.adj[v])
     {
         if (!Marked[w.To()])
         {
             DFS(g, w.To());
         }
     }
     Post.Enqueue(v);
     ReversePost.Push(v);
 }
Beispiel #3
0
 private void Dfs(EdgeWeightedDigraph G, int v)
 {
     marked[v] = true;
     Pre.Enqueue(v);
     foreach (DirectedEdge e in G.GetAdj(v))
     {
         int w = e.To();
         if (!marked[w])
         {
             Dfs(G, w);
         }
     }
     Post.Enqueue(v);
     ReversePost.Push(v);
 }