@@ -13780,32 +13780,22 @@ PyObject *igraphmodule_Graph_community_fluid_communities(igraphmodule_GraphObjec
1378013780 */
1378113781PyObject *igraphmodule_Graph_community_voronoi(igraphmodule_GraphObject *self,
1378213782 PyObject *args, PyObject *kwds) {
13783- static char *kwlist[] = {"modularity", " lengths", "weights", "mode", "radius", NULL};
13783+ static char *kwlist[] = {"lengths", "weights", "mode", "radius", NULL};
1378413784 PyObject *lengths_o = Py_None, *weights_o = Py_None;
1378513785 PyObject *mode_o = Py_None;
1378613786 PyObject *radius_o = Py_None;
13787- PyObject *modularity_o = Py_None;
1378813787 igraph_vector_t *lengths_v = NULL;
1378913788 igraph_vector_t *weights_v = NULL;
1379013789 igraph_vector_int_t membership_v, generators_v;
13791- igraph_neimode_t mode = IGRAPH_ALL ;
13790+ igraph_neimode_t mode = IGRAPH_OUT ;
1379213791 igraph_real_t radius = -1.0; /* negative means auto-optimize */
1379313792 igraph_real_t modularity = IGRAPH_NAN;
1379413793 PyObject *membership_o, *generators_o, *result_o;
13795- igraph_bool_t return_modularity = false;
1379613794
13797- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OOOOO ", kwlist,
13798- &modularity_o, & lengths_o, &weights_o, &mode_o, &radius_o))
13795+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OOOO ", kwlist,
13796+ &lengths_o, &weights_o, &mode_o, &radius_o))
1379913797 return NULL;
1380013798
13801- if (modularity_o != Py_None){
13802- if (igraphmodule_PyObject_to_real_t(modularity_o, &modularity))
13803- return NULL;
13804- }
13805- else {
13806- return_modularity = true;
13807- }
13808-
1380913799 /* Handle mode parameter */
1381013800 if (igraphmodule_PyObject_to_neimode_t(mode_o, &mode))
1381113801 return NULL;
@@ -13855,7 +13845,7 @@ PyObject *igraphmodule_Graph_community_voronoi(igraphmodule_GraphObject *self,
1385513845
1385613846 /* Call the C function - pass NULL for None parameters */
1385713847 if (igraph_community_voronoi(&self->g, &membership_v, &generators_v,
13858- return_modularity ? &modularity : NULL ,
13848+ &modularity,
1385913849 lengths_v,
1386013850 weights_v,
1386113851 mode, radius)) {
@@ -13897,11 +13887,8 @@ PyObject *igraphmodule_Graph_community_voronoi(igraphmodule_GraphObject *self,
1389713887 }
1389813888
1389913889 /* Return tuple with membership, generators, and modularity */
13900- if (return_modularity) {
13901- result_o = Py_BuildValue("(NNd)", membership_o, generators_o, modularity);
13902- } else {
13903- result_o = Py_BuildValue("(NN)", membership_o, generators_o);
13904- }
13890+ result_o = Py_BuildValue("(NNd)", membership_o, generators_o, modularity);
13891+
1390513892
1390613893 return result_o;
1390713894}
@@ -18787,7 +18774,7 @@ struct PyMethodDef igraphmodule_Graph_methods[] = {
1878718774 {"community_voronoi",
1878818775 (PyCFunction) igraphmodule_Graph_community_voronoi,
1878918776 METH_VARARGS | METH_KEYWORDS,
18790- "community_voronoi(lengths=None, weights=None, mode=\"all \", radius=None, modularity =None)\n\n"
18777+ "community_voronoi(lengths=None, weights=None, mode=\"out \", radius=None)\n\n"
1879118778 "Finds communities using Voronoi partitioning.\n\n"
1879218779 "This function finds communities using a Voronoi partitioning of vertices based\n"
1879318780 "on the given edge lengths divided by the edge clustering coefficient.\n"
@@ -18802,19 +18789,15 @@ struct PyMethodDef igraphmodule_Graph_methods[] = {
1880218789 "@param weights: edge weights, or C{None} to consider all edges as having\n"
1880318790 " unit weight. Weights are used when selecting generator points, as well\n"
1880418791 " as for computing modularity.\n"
18805- "@param mode: if C{\"out\"}, distances from generator points to all other\n"
18792+ "@param mode: if C{\"out\"} (the default) , distances from generator points to all other\n"
1880618793 " nodes are considered. If C{\"in\"}, the reverse distances are used.\n"
1880718794 " If C{\"all\"}, edge directions are ignored. This parameter is ignored\n"
1880818795 " for undirected graphs.\n"
1880918796 "@param radius: the radius/resolution to use when selecting generator points.\n"
1881018797 " The larger this value, the fewer partitions there will be. Pass C{None}\n"
1881118798 " to automatically select the radius that maximizes modularity.\n"
18812- "@param modularity: if not C{None}, the modularity score will be calculated\n"
18813- " and returned as part of the result tuple.\n"
18814- "@return: a tuple containing the membership vector and generator vertices.\n"
18815- " When modularity calculation is requested, also includes the modularity score\n"
18816- " as a third element: (membership, generators, modularity).\n"
18817- " Otherwise: (membership, generators).\n"
18799+ "@return: a tuple containing the membership vector, generator vertices, and\n"
18800+ " modularity score: (membership, generators, modularity).\n"
1881818801 "@rtype: tuple\n\n"
1881918802 "B{References}\n\n"
1882018803 " - Deritei et al., Community detection by graph Voronoi diagrams,\n"
0 commit comments