Skip to content

Commit a2b5b76

Browse files
authored
Update check_bipatrite.py
Change type() check to isinstance
1 parent e925e79 commit a2b5b76

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

graphs/check_bipatrite.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ def depth_first_search(node: int, color: int) -> bool:
8585
return visited[node] == color
8686

8787
for node, neighbours in graph.items():
88-
if type(node) != type(int()):
88+
if not isinstance(node, int):
8989
raise TypeError("Nodes must be integers")
9090
for neighbour in neighbours:
91-
if type(neighbour) != type(int()):
91+
if not isinstance(neighbour, int):
9292
raise TypeError("Nodes must be integers")
9393
visited: defaultdict[int, int] = defaultdict(lambda: -1)
9494
for node in graph:

0 commit comments

Comments
 (0)