Skip to content

Commit e22ea7e

Browse files
Update Directed and Undirected (Weighted) Graph.py
1 parent c5c3a74 commit e22ea7e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

graphs/Directed and Undirected (Weighted) Graph.py

+4
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ def cycle_nodes(self):
152152
parent = -2
153153
indirect_parents = []
154154
ss = s
155+
on_the_way_back = False
155156
anticipating_nodes = set()
156157

157158
while True:
@@ -199,6 +200,7 @@ def has_cycle(self):
199200
parent = -2
200201
indirect_parents = []
201202
ss = s
203+
on_the_way_back = False
202204
anticipating_nodes = set()
203205

204206
while True:
@@ -367,6 +369,7 @@ def cycle_nodes(self):
367369
parent = -2
368370
indirect_parents = []
369371
ss = s
372+
on_the_way_back = False
370373
anticipating_nodes = set()
371374

372375
while True:
@@ -414,6 +417,7 @@ def has_cycle(self):
414417
parent = -2
415418
indirect_parents = []
416419
ss = s
420+
on_the_way_back = False
417421
anticipating_nodes = set()
418422

419423
while True:

0 commit comments

Comments
 (0)