Graphs_dart/tex/dart/pseudoDFS.txt

12 lines
319 B
Plaintext
Raw Permalink Normal View History

2021-11-23 15:53:01 +03:00
function doDfs(G[n]: Graph):
visited = array[n, false]
function DFS(u: int):
visited[u] = true
for v: (u, v) in G:
if not visited[v]:
DFS(v)
for i = 1 to n:
if not visited[i]:
DFS(i)