MCPcopy Index your code
hub / github.com/jwasham/practice-python / dfs_recursive

Method dfs_recursive

graphs/undirected_graph_matrix.py:43–54  ·  view source on GitHub ↗

Computes the parents for each vertex as determined through depth-first-search (though not too meaningful in an undirected weightless graph) :return: parents for each vertex :rtype: dict

(self)

Source from the content-addressed store, hash-verified

41 yield i
42
43 def dfs_recursive(self):
44 """
45 Computes the parents for each vertex as determined through depth-first-search
46 (though not too meaningful in an undirected weightless graph)
47 :return: parents for each vertex
48 :rtype: dict
49 """
50 parents = {}
51
52 self.dfs_util(0, parents)
53
54 return parents
55
56 def dfs_util(self, vertex, parents):
57 for u in self.get_neighbor(vertex):

Callers 1

test_dfs_recursiveFunction · 0.80

Calls 1

dfs_utilMethod · 0.95

Tested by 1

test_dfs_recursiveFunction · 0.64