Skip to content

Commit

Permalink
Fix indent issues in retworkx bipartition docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
InnovativeInventor committed May 24, 2022
1 parent c299d42 commit c777080
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
12 changes: 6 additions & 6 deletions src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ fn _minimum_spanning_tree<'a>(
/// allowed while still being a valid balanced cut edge.
///
/// :returns: A list of tuples, with each tuple representing a distinct
/// balanced edge that can be cut. The tuple contains the root of one of the
/// two partitioned subtrees and the set of nodes making up that subtree.
/// balanced edge that can be cut. The tuple contains the root of one of the
/// two partitioned subtrees and the set of nodes making up that subtree.
#[pyfunction]
#[pyo3(text_signature = "(spanning_tree, pop, target_pop, epsilon)")]
pub fn bipartition_tree(
Expand Down Expand Up @@ -242,14 +242,14 @@ pub fn bipartition_tree(
/// will be passed the edge object and expected to return a ``float``. See
/// :func:`~minimum_spanning_tree` for details.
/// :param pops: The populations assigned to each node in the graph.
/// :param float pop_target: The population target to reach when partitioning the
/// graph.
/// :param float pop_target: The population target to reach when partitioning
/// the graph.
/// :param float epsilon: The maximum percent deviation from the pop_target
/// allowed while still being a valid balanced cut edge.
///
/// :returns: A list of tuples, with each tuple representing a distinct
/// balanced edge that can be cut. The tuple contains the root of one of the
/// two partitioned subtrees and the set of nodes making up that subtree.
/// balanced edge that can be cut. The tuple contains the root of one of the
/// two partitioned subtrees and the set of nodes making up that subtree.
#[pyfunction]
#[pyo3(text_signature = "(graph, weight_fn, pop, target_pop, epsilon)")]
pub fn bipartition_graph(
Expand Down
18 changes: 9 additions & 9 deletions tests/graph/test_bipartition.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ def setUp(self):

def test_one_balanced_edge_tree(self):
balanced_edges = retworkx.bipartition_tree(
self.tree,
self.tree,
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
3.0,
0.2,
)
self.assertEqual(len(balanced_edges), 1)

# Since this is already a spanning tree, bipartition_graph should
# Since this is already a spanning tree, bipartition_graph should
# behave identically. That is, it should be invariant to weight_fn
graph_balanced_edges = retworkx.bipartition_graph(
self.tree,
self.tree,
lambda x: random.random(),
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
3.0,
Expand All @@ -76,15 +76,15 @@ def test_one_balanced_edge_tree(self):

def test_two_balanced_edges_tree(self):
balanced_edges = retworkx.bipartition_tree(
self.tree,
self.tree,
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
3.0,
0.5,
)
self.assertEqual(len(balanced_edges), 1)

graph_balanced_edges = retworkx.bipartition_graph(
self.tree,
self.tree,
lambda x: random.random(),
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
3.0,
Expand All @@ -94,15 +94,15 @@ def test_two_balanced_edges_tree(self):

def test_three_balanced_edges_line(self):
balanced_edges = retworkx.bipartition_tree(
self.line,
self.line,
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
3.0,
0.5,
)
self.assertEqual(len(balanced_edges), 3)

graph_balanced_edges = retworkx.bipartition_graph(
self.line,
self.line,
lambda x: random.random(),
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
3.0,
Expand All @@ -112,15 +112,15 @@ def test_three_balanced_edges_line(self):

def test_one_balanced_edges_line(self):
balanced_edges = retworkx.bipartition_tree(
self.line,
self.line,
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
3.0,
0.01,
)
self.assertEqual(len(balanced_edges), 1)

graph_balanced_edges = retworkx.bipartition_graph(
self.line,
self.line,
lambda x: random.random(),
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
3.0,
Expand Down

0 comments on commit c777080

Please sign in to comment.