Skip to content

Commit

Permalink
feat: is_biconnected()
Browse files Browse the repository at this point in the history
  • Loading branch information
szhorvat committed Jan 30, 2024
1 parent 766a156 commit c0c74bc
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/_igraph/graphobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,27 @@ PyObject *igraphmodule_Graph_is_connected(igraphmodule_GraphObject * self,
Py_RETURN_FALSE;
}

/** \ingroup python_interface_graph
* \brief Decides whether a graph is biconnected.
* \return Py_True if the graph is biconnected, Py_False otherwise
* \sa igraph_is_biconnected
*/
PyObject *igraphmodule_Graph_is_biconnected(igraphmodule_GraphObject *self, PyObject* Py_UNUSED(_null))
{
igraph_bool_t res;

if (igraph_is_biconnected(&self->g, &res)) {
igraphmodule_handle_igraph_error();
return NULL;
}

if (res) {
Py_RETURN_TRUE;
} else {
Py_RETURN_FALSE;
}
}

/** \ingroup python_interface_graph
* \brief Decides whether there is an edge from a given vertex to an other one.
* \return Py_True if the vertices are directly connected, Py_False otherwise
Expand Down Expand Up @@ -15275,6 +15296,20 @@ struct PyMethodDef igraphmodule_Graph_methods[] = {
"@param mode: whether we should calculate strong or weak connectivity.\n"
"@return: C{True} if the graph is connected, C{False} otherwise.\n"},

/* interface to igraph_is_biconnected */
{"is_biconnected", (PyCFunction) igraphmodule_Graph_is_biconnected,
METH_NOARGS,
"is_biconnected()\n--\n\n"
"Decides whether the graph is biconnected.\n\n"
"A graph is biconnected if it stays connected after the removal of\n"
"any single vertex.\n\n"
"Note that there are different conventions in use about whether to\n"
"consider a graph consisting of two connected vertices to be biconnected.\n"
"igraph does consider it biconnected.\n\n"
"@return: C{True} if it is biconnected, C{False} otherwise.\n"
"@rtype: boolean"
},

/* interface to igraph_linegraph */
{"linegraph", (PyCFunction) igraphmodule_Graph_linegraph,
METH_VARARGS | METH_KEYWORDS,
Expand Down

0 comments on commit c0c74bc

Please sign in to comment.