Skip to content

Commit c0c74bc

Browse files
committed
feat: is_biconnected()
1 parent 766a156 commit c0c74bc

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/_igraph/graphobject.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,6 +1421,27 @@ PyObject *igraphmodule_Graph_is_connected(igraphmodule_GraphObject * self,
14211421
Py_RETURN_FALSE;
14221422
}
14231423

1424+
/** \ingroup python_interface_graph
1425+
* \brief Decides whether a graph is biconnected.
1426+
* \return Py_True if the graph is biconnected, Py_False otherwise
1427+
* \sa igraph_is_biconnected
1428+
*/
1429+
PyObject *igraphmodule_Graph_is_biconnected(igraphmodule_GraphObject *self, PyObject* Py_UNUSED(_null))
1430+
{
1431+
igraph_bool_t res;
1432+
1433+
if (igraph_is_biconnected(&self->g, &res)) {
1434+
igraphmodule_handle_igraph_error();
1435+
return NULL;
1436+
}
1437+
1438+
if (res) {
1439+
Py_RETURN_TRUE;
1440+
} else {
1441+
Py_RETURN_FALSE;
1442+
}
1443+
}
1444+
14241445
/** \ingroup python_interface_graph
14251446
* \brief Decides whether there is an edge from a given vertex to an other one.
14261447
* \return Py_True if the vertices are directly connected, Py_False otherwise
@@ -15275,6 +15296,20 @@ struct PyMethodDef igraphmodule_Graph_methods[] = {
1527515296
"@param mode: whether we should calculate strong or weak connectivity.\n"
1527615297
"@return: C{True} if the graph is connected, C{False} otherwise.\n"},
1527715298

15299+
/* interface to igraph_is_biconnected */
15300+
{"is_biconnected", (PyCFunction) igraphmodule_Graph_is_biconnected,
15301+
METH_NOARGS,
15302+
"is_biconnected()\n--\n\n"
15303+
"Decides whether the graph is biconnected.\n\n"
15304+
"A graph is biconnected if it stays connected after the removal of\n"
15305+
"any single vertex.\n\n"
15306+
"Note that there are different conventions in use about whether to\n"
15307+
"consider a graph consisting of two connected vertices to be biconnected.\n"
15308+
"igraph does consider it biconnected.\n\n"
15309+
"@return: C{True} if it is biconnected, C{False} otherwise.\n"
15310+
"@rtype: boolean"
15311+
},
15312+
1527815313
/* interface to igraph_linegraph */
1527915314
{"linegraph", (PyCFunction) igraphmodule_Graph_linegraph,
1528015315
METH_VARARGS | METH_KEYWORDS,

0 commit comments

Comments
 (0)