From 540cc43a3dfae570a7f4757e38d832f070e0d5bc Mon Sep 17 00:00:00 2001 From: Bertrand <bneron@pasteur.fr> Date: Fri, 29 Nov 2019 16:33:46 +0100 Subject: [PATCH] :pencil2: add comments --- Graph/graph/traversing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Graph/graph/traversing.py b/Graph/graph/traversing.py index 07f7da4..72f385a 100644 --- a/Graph/graph/traversing.py +++ b/Graph/graph/traversing.py @@ -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 -- GitLab