Skip to content

Commit

Permalink
refactor: rewire() now does 10 times the number of edges trials by de…
Browse files Browse the repository at this point in the history
…fault
  • Loading branch information
szhorvat committed Jul 3, 2024
1 parent d10071c commit 1f6a550
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/_igraph/graphobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -6409,7 +6409,7 @@ PyObject *igraphmodule_Graph_rewire(igraphmodule_GraphObject * self,
PyObject * args, PyObject * kwds)
{
static char *kwlist[] = { "n", "mode", NULL };
Py_ssize_t n = 1000;
Py_ssize_t n = 10 * igraph_ecount(&self->g);
PyObject *mode_o = Py_None;
igraph_rewiring_t mode = IGRAPH_REWIRING_SIMPLE;

Expand Down Expand Up @@ -15779,12 +15779,13 @@ struct PyMethodDef igraphmodule_Graph_methods[] = {
/* interface to igraph_rewire */
{"rewire", (PyCFunction) igraphmodule_Graph_rewire,
METH_VARARGS | METH_KEYWORDS,
"rewire(n=1000, mode=\"simple\")\n--\n\n"
"rewire(n=None, mode=\"simple\")\n--\n\n"
"Randomly rewires the graph while preserving the degree distribution.\n\n"
"Please note that the rewiring is done \"in-place\", so the original\n"
"graph will be modified. If you want to preserve the original graph,\n"
"use the L{copy} method before.\n\n"
"@param n: the number of rewiring trials.\n"
"The rewiring is done \"in-place\", so the original graph will be modified.\n"
"If you want to preserve the original graph, use the L{copy} method before\n"
"rewiring.\n\n"
"@param n: the number of rewiring trials. The default is 10 times the number\n"
" of edges.\n"
"@param mode: the rewiring algorithm to use. It can either be C{\"simple\"} or\n"
" C{\"loops\"}; the former does not create or destroy loop edges while the\n"
" latter does.\n"},
Expand Down

0 comments on commit 1f6a550

Please sign in to comment.