Skip to content
Snippets Groups Projects
Verified Commit 540cc43a authored by Bertrand  NÉRON's avatar Bertrand NÉRON
Browse files

:pencil2: add comments

parent caa5dcec
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment