MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / dfs

Function dfs

graphs/eulerian_path_and_circuit_for_undirected_graph.py:9–15  ·  view source on GitHub ↗
(u, graph, visited_edge, path=None)

Source from the content-addressed store, hash-verified

7
8# using dfs for finding eulerian path traversal
9def dfs(u, graph, visited_edge, path=None):
10 path = (path or []) + [u]
11 for v in graph[u]:
12 if visited_edge[u][v] is False:
13 visited_edge[u][v], visited_edge[v][u] = True, True
14 path = dfs(v, graph, visited_edge, path)
15 return path
16
17
18# for checking in graph has euler path or circuit

Callers 1

check_eulerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected