Skip to content

Commit 9ce8cbf

Browse files
Update check_bipatrite.py
1 parent 2c0ea66 commit 9ce8cbf

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

graphs/check_bipatrite.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ def is_bipartite_dfs(graph: defaultdict[int, list[int]]) -> bool:
3737
>>> is_bipartite_dfs({0: [1, 3], 1: [0, 2], 2: [1, 3], 3: [0, 2], 9: [0]})
3838
False
3939
>>> is_bipartite_dfs({0: [-1, 3], 1: [0, -2]})
40-
Traceback (most recent call last):
41-
...
42-
KeyError: -1
40+
False
4341
>>> is_bipartite_dfs({-1: [0, 2], 0: [-1, 1], 1: [0, 2], 2: [-1, 1]})
4442
True
4543
>>> is_bipartite_dfs({0.9: [1, 3], 1: [0, 2], 2: [1, 3], 3: [0, 2]})
@@ -125,9 +123,7 @@ def is_bipartite_bfs(graph: defaultdict[int, list[int]]) -> bool:
125123
>>> is_bipartite_bfs({0: [1, 3], 1: [0, 2], 2: [1, 3], 3: [0, 2], 9: [0]})
126124
False
127125
>>> is_bipartite_bfs({0: [-1, 3], 1: [0, -2]})
128-
Traceback (most recent call last):
129-
...
130-
KeyError: -1
126+
False
131127
>>> is_bipartite_bfs({-1: [0, 2], 0: [-1, 1], 1: [0, 2], 2: [-1, 1]})
132128
True
133129
>>> is_bipartite_bfs({0.9: [1, 3], 1: [0, 2], 2: [1, 3], 3: [0, 2]})

0 commit comments

Comments
 (0)