@@ -3563,24 +3563,22 @@ PyObject *igraphmodule_Graph_SBM(PyTypeObject * type,
3563
3563
{
3564
3564
igraphmodule_GraphObject *self;
3565
3565
igraph_t g;
3566
- Py_ssize_t n;
3567
3566
PyObject *block_sizes_o, *pref_matrix_o;
3568
3567
PyObject *directed_o = Py_False;
3569
3568
PyObject *loops_o = Py_False;
3569
+ PyObject *multiple_o = Py_False;
3570
3570
igraph_matrix_t pref_matrix;
3571
3571
igraph_vector_int_t block_sizes;
3572
3572
3573
- static char *kwlist[] = { "n", " pref_matrix", "block_sizes", "directed",
3574
- "loops", NULL };
3573
+ static char *kwlist[] = { "pref_matrix", "block_sizes", "directed",
3574
+ "loops", "multiple", NULL };
3575
3575
3576
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "nOO|OO ", kwlist,
3577
- &n, & pref_matrix_o,
3576
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO|OOO ", kwlist,
3577
+ &pref_matrix_o,
3578
3578
&block_sizes_o,
3579
- &directed_o, &loops_o))
3579
+ &directed_o, &loops_o, &multiple_o ))
3580
3580
return NULL;
3581
3581
3582
- CHECK_SSIZE_T_RANGE(n, "vertex count");
3583
-
3584
3582
if (igraphmodule_PyObject_to_matrix_t(pref_matrix_o, &pref_matrix, "pref_matrix")) {
3585
3583
return NULL;
3586
3584
}
@@ -3590,7 +3588,7 @@ PyObject *igraphmodule_Graph_SBM(PyTypeObject * type,
3590
3588
return NULL;
3591
3589
}
3592
3590
3593
- if (igraph_sbm_game(&g, n, &pref_matrix, &block_sizes, PyObject_IsTrue(directed_o), PyObject_IsTrue(loops_o))) {
3591
+ if (igraph_sbm_game(&g, &pref_matrix, &block_sizes, PyObject_IsTrue(directed_o), PyObject_IsTrue(loops_o), PyObject_IsTrue(multiple_o ))) {
3594
3592
igraphmodule_handle_igraph_error();
3595
3593
igraph_matrix_destroy(&pref_matrix);
3596
3594
igraph_vector_int_destroy(&block_sizes);
@@ -14754,19 +14752,19 @@ struct PyMethodDef igraphmodule_Graph_methods[] = {
14754
14752
METH_VARARGS | METH_CLASS | METH_KEYWORDS,
14755
14753
"SBM(n, pref_matrix, block_sizes, directed=False, loops=False)\n--\n\n"
14756
14754
"Generates a graph based on a stochastic block model.\n\n"
14757
- "A given number of vertices are generated. Every vertex is assigned to a \n"
14758
- "vertex type according to the given block sizes . Vertices of the same\n"
14755
+ "Every vertex is assigned to a vertex type according to the given block \n"
14756
+ "sizes, which also determine the total vertex count . Vertices of the same\n"
14759
14757
"type will be assigned consecutive vertex IDs. Finally, every\n"
14760
14758
"vertex pair is evaluated and an edge is created between them with a\n"
14761
14759
"probability depending on the types of the vertices involved. The\n"
14762
14760
"probabilities are taken from the preference matrix.\n\n"
14763
- "@param n: the number of vertices in the graph\n"
14764
- "@param pref_matrix: matrix giving the connection probabilities for\n"
14765
- " different vertex types.\n"
14761
+ "@param pref_matrix: matrix giving the connection probabilities (or expected\n"
14762
+ " edge multiplicities for multigraphs) between different vertex types.\n"
14766
14763
"@param block_sizes: list giving the number of vertices in each block; must\n"
14767
14764
" sum up to I{n}.\n"
14768
14765
"@param directed: whether to generate a directed graph.\n"
14769
- "@param loops: whether loop edges are allowed.\n"},
14766
+ "@param loops: whether loop edges are allowed.\n"
14767
+ "@param multiple: whether multi-edges are allowed.\n"},
14770
14768
14771
14769
// interface to igraph_star
14772
14770
{"Star", (PyCFunction) igraphmodule_Graph_Star,
0 commit comments