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

Function depth_first_search

graphs/g_topological_sort.py:29–35  ·  view source on GitHub ↗
(u, visited, graph)

Source from the content-addressed store, hash-verified

27
28
29def depth_first_search(u, visited, graph):
30 visited[u] = 1
31 for v in graph[u]:
32 if not visited[v]:
33 depth_first_search(v, visited, graph)
34
35 stack.append(u)
36
37
38def topological_sort(graph, visited):

Callers 1

topological_sortFunction · 0.70

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected