Skip to content

Commit f8dc063

Browse files
committed
Changing loop of dfs.
Now visiting the first neighboor
1 parent f133ae1 commit f8dc063

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/python/busca_em_grafo.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def dfs(self, start: int) -> list:
8383
if u not in visitados:
8484
visitados.append(u)
8585

86-
for v in self.adj[u]:
86+
for v in self.adj[u][::-1]:
8787
if v not in visitados:
8888
pilha.append(v)
8989

0 commit comments

Comments
 (0)