Skip to content

Commit 9619389

Browse files
committed
revised DepthFirstSearch add_neighbor function
1 parent cf3c107 commit 9619389

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

DepthFirstSearch.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ def __init__(self, n):
88
self.color = 'black'
99

1010
def add_neighbor(self, v):
11-
nset = set(self.neighbors)
12-
if v not in nset:
11+
if v not in self.neighbors:
1312
self.neighbors.append(v)
1413
self.neighbors.sort()
1514

0 commit comments

Comments
 (0)