Commit 92b2d5f6 authored by Tiago Peixoto's avatar Tiago Peixoto

random_rewire(): Raise warning if edge_probs is not supplied

parent 6ba6b6af
Pipeline #270 passed with stage
in 184 minutes and 29 seconds
......@@ -791,19 +791,6 @@ def random_rewire(g, model="configuration", n_iter=1, edge_sweep=True,
no. 1: 016107 (2011) :doi:`10.1103/PhysRevE.83.016107` :arxiv:`1008.3926`
"""
# if not parallel_edges:
# p = label_parallel_edges(g)
# if p.a.max() != 0:
# raise ValueError("Parallel edge detected. Can't rewire " +
# "graph without parallel edges if it " +
# "already contains parallel edges!")
# if not self_loops:
# l = label_self_loops(g)
# if l.a.max() != 0:
# raise ValueError("Self-loop detected. Can't rewire graph " +
# "without self-loops if it already contains" +
# " self-loops!")
if (edge_probs is not None and not g.is_directed()) and "blockmodel" not in model:
corr = lambda i, j: edge_probs(i[1], j[1])
......@@ -813,6 +800,8 @@ def random_rewire(g, model="configuration", n_iter=1, edge_sweep=True,
if model not in ["probabilistic-configuration", "blockmodel",
"blockmodel-degree"]:
g = GraphView(g, reversed=False)
elif edge_probs is None:
raise ValueError("A function must be supplied as the 'edge_probs' parameter")
if model == "blockmodel-degree" and alias and edge_sweep:
edge_sweep = False
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment