summaryrefslogtreecommitdiff
path: root/networkx/algorithms/swap.py
diff options
context:
space:
mode:
authorJarrod Millman <jarrod.millman@gmail.com>2020-07-09 23:12:10 -0700
committerJarrod Millman <jarrod.millman@gmail.com>2020-07-10 09:44:54 -0700
commitb22d6b36ce0545995c99d233546e8a1fe7e27fc5 (patch)
tree9078401c2f4a7b463a82378a734508e16ef34867 /networkx/algorithms/swap.py
parentf30e9392bef0dccbcfd1b73ccb934064f6200fa3 (diff)
downloadnetworkx-b22d6b36ce0545995c99d233546e8a1fe7e27fc5.tar.gz
Format w/ black
Diffstat (limited to 'networkx/algorithms/swap.py')
-rw-r--r--networkx/algorithms/swap.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/networkx/algorithms/swap.py b/networkx/algorithms/swap.py
index 488a314c..8a06a5f3 100644
--- a/networkx/algorithms/swap.py
+++ b/networkx/algorithms/swap.py
@@ -6,8 +6,7 @@ from networkx.utils import py_random_state
import networkx as nx
-__all__ = ['double_edge_swap',
- 'connected_double_edge_swap']
+__all__ = ["double_edge_swap", "connected_double_edge_swap"]
@py_random_state(3)
@@ -51,8 +50,7 @@ def double_edge_swap(G, nswap=1, max_tries=100, seed=None):
The graph G is modified in place.
"""
if G.is_directed():
- raise nx.NetworkXError(
- "double_edge_swap() not defined for directed graphs.")
+ raise nx.NetworkXError("double_edge_swap() not defined for directed graphs.")
if nswap > max_tries:
raise nx.NetworkXError("Number of swaps > number of tries allowed.")
if len(G) < 4:
@@ -86,8 +84,10 @@ def double_edge_swap(G, nswap=1, max_tries=100, seed=None):
G.remove_edge(x, y)
swapcount += 1
if n >= max_tries:
- e = (f'Maximum number of swap attempts ({n}) exceeded '
- f'before desired swaps achieved ({nswap}).')
+ e = (
+ f"Maximum number of swap attempts ({n}) exceeded "
+ f"before desired swaps achieved ({nswap})."
+ )
raise nx.NetworkXAlgorithmError(e)
n += 1
return G