Skip to content

Commit c36aaf0

Browse files
Fix sphinx/build_docs warnings for graphs/check_bipatrite (#12469)
* Fix sphinx/build_docs warnings for graphs/check_bipatrite * Fix
1 parent e9721aa commit c36aaf0

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

Diff for: graphs/check_bipatrite.py

+14-10
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@ def is_bipartite_dfs(graph: defaultdict[int, list[int]]) -> bool:
66
Check if a graph is bipartite using depth-first search (DFS).
77
88
Args:
9-
graph: Adjacency list representing the graph.
9+
`graph`: Adjacency list representing the graph.
1010
1111
Returns:
12-
True if bipartite, False otherwise.
12+
``True`` if bipartite, ``False`` otherwise.
1313
1414
Checks if the graph can be divided into two sets of vertices, such that no two
1515
vertices within the same set are connected by an edge.
1616
1717
Examples:
18-
# FIXME: This test should pass.
18+
19+
>>> # FIXME: This test should pass.
1920
>>> is_bipartite_dfs(defaultdict(list, {0: [1, 2], 1: [0, 3], 2: [0, 4]}))
2021
Traceback (most recent call last):
2122
...
@@ -37,7 +38,7 @@ def is_bipartite_dfs(graph: defaultdict[int, list[int]]) -> bool:
3738
...
3839
KeyError: 0
3940
40-
# FIXME: This test should fails with KeyError: 4.
41+
>>> # FIXME: This test should fails with KeyError: 4.
4142
>>> is_bipartite_dfs({0: [1, 3], 1: [0, 2], 2: [1, 3], 3: [0, 2], 9: [0]})
4243
False
4344
>>> is_bipartite_dfs({0: [-1, 3], 1: [0, -2]})
@@ -51,7 +52,8 @@ def is_bipartite_dfs(graph: defaultdict[int, list[int]]) -> bool:
5152
...
5253
KeyError: 0
5354
54-
# FIXME: This test should fails with TypeError: list indices must be integers or...
55+
>>> # FIXME: This test should fails with
56+
>>> # TypeError: list indices must be integers or...
5557
>>> is_bipartite_dfs({0: [1.0, 3.0], 1.0: [0, 2.0], 2.0: [1.0, 3.0], 3.0: [0, 2.0]})
5658
True
5759
>>> is_bipartite_dfs({"a": [1, 3], "b": [0, 2], "c": [1, 3], "d": [0, 2]})
@@ -95,16 +97,17 @@ def is_bipartite_bfs(graph: defaultdict[int, list[int]]) -> bool:
9597
Check if a graph is bipartite using a breadth-first search (BFS).
9698
9799
Args:
98-
graph: Adjacency list representing the graph.
100+
`graph`: Adjacency list representing the graph.
99101
100102
Returns:
101-
True if bipartite, False otherwise.
103+
``True`` if bipartite, ``False`` otherwise.
102104
103105
Check if the graph can be divided into two sets of vertices, such that no two
104106
vertices within the same set are connected by an edge.
105107
106108
Examples:
107-
# FIXME: This test should pass.
109+
110+
>>> # FIXME: This test should pass.
108111
>>> is_bipartite_bfs(defaultdict(list, {0: [1, 2], 1: [0, 3], 2: [0, 4]}))
109112
Traceback (most recent call last):
110113
...
@@ -126,7 +129,7 @@ def is_bipartite_bfs(graph: defaultdict[int, list[int]]) -> bool:
126129
...
127130
KeyError: 0
128131
129-
# FIXME: This test should fails with KeyError: 4.
132+
>>> # FIXME: This test should fails with KeyError: 4.
130133
>>> is_bipartite_bfs({0: [1, 3], 1: [0, 2], 2: [1, 3], 3: [0, 2], 9: [0]})
131134
False
132135
>>> is_bipartite_bfs({0: [-1, 3], 1: [0, -2]})
@@ -140,7 +143,8 @@ def is_bipartite_bfs(graph: defaultdict[int, list[int]]) -> bool:
140143
...
141144
KeyError: 0
142145
143-
# FIXME: This test should fails with TypeError: list indices must be integers or...
146+
>>> # FIXME: This test should fails with
147+
>>> # TypeError: list indices must be integers or...
144148
>>> is_bipartite_bfs({0: [1.0, 3.0], 1.0: [0, 2.0], 2.0: [1.0, 3.0], 3.0: [0, 2.0]})
145149
True
146150
>>> is_bipartite_bfs({"a": [1, 3], "b": [0, 2], "c": [1, 3], "d": [0, 2]})

0 commit comments

Comments
 (0)