From 1f6a550f83fe30745f3b7b4143e6d3b5e1bcfdb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szabolcs=20Horva=CC=81t?= Date: Wed, 3 Jul 2024 09:28:29 +0000 Subject: [PATCH] refactor: rewire() now does 10 times the number of edges trials by default --- src/_igraph/graphobject.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/_igraph/graphobject.c b/src/_igraph/graphobject.c index 31049e887..6576f79db 100644 --- a/src/_igraph/graphobject.c +++ b/src/_igraph/graphobject.c @@ -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; @@ -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"},