We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2c0ea66 commit 9ce8cbfCopy full SHA for 9ce8cbf
1 file changed
graphs/check_bipatrite.py
@@ -37,9 +37,7 @@ def is_bipartite_dfs(graph: defaultdict[int, list[int]]) -> bool:
37
>>> is_bipartite_dfs({0: [1, 3], 1: [0, 2], 2: [1, 3], 3: [0, 2], 9: [0]})
38
False
39
>>> is_bipartite_dfs({0: [-1, 3], 1: [0, -2]})
40
- Traceback (most recent call last):
41
- ...
42
- KeyError: -1
+ False
43
>>> is_bipartite_dfs({-1: [0, 2], 0: [-1, 1], 1: [0, 2], 2: [-1, 1]})
44
True
45
>>> 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:
125
123
>>> is_bipartite_bfs({0: [1, 3], 1: [0, 2], 2: [1, 3], 3: [0, 2], 9: [0]})
126
124
127
>>> is_bipartite_bfs({0: [-1, 3], 1: [0, -2]})
128
129
130
131
>>> is_bipartite_bfs({-1: [0, 2], 0: [-1, 1], 1: [0, 2], 2: [-1, 1]})
132
133
>>> is_bipartite_bfs({0.9: [1, 3], 1: [0, 2], 2: [1, 3], 3: [0, 2]})
0 commit comments