Verified Commit 540cc43a authored by Bertrand  NÉRON's avatar Bertrand NÉRON
Browse files

add comments

parent caa5dcec
......@@ -15,7 +15,7 @@ def _traversing(to_visit: Union[FIFO, LIFO], graph: Graph, node: Node) -> Iterat
"""
to_visit.add(node)
visited = set()
parent = {}
parent = {} # to store for each node from which node it has been discovered
path = []
while to_visit:
node = to_visit.pop()
......@@ -29,7 +29,7 @@ def _traversing(to_visit: Union[FIFO, LIFO], graph: Graph, node: Node) -> Iterat
parent[edge.target] = edge
to_visit.add(edge.target)
if node in parent:
path.append(parent[node])
path.append(parent[node]) # the starting node has no parent
yield node, path
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment