diff --git a/CHANGELOG.md b/CHANGELOG.md index 49918e543..5720f2f0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Changed - Dropped support for Python 3.8 as it has now reached its end of life. +- Added `Graph.simple_cycles()` to find simple cycles in the graph. ## [0.11.8] - 2024-10-25 diff --git a/pyproject.toml b/pyproject.toml index d62d390de..79ce15fea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,8 @@ requires = [ # Workaround based on this commit: # https://github.com/harfbuzz/uharfbuzz/commit/9b607bd06fb17fcb4abe3eab5c4f342ad08309d7 "setuptools>=64,<72.2.0; platform_python_implementation == 'PyPy'", - "setuptools>=64; platform_python_implementation != 'PyPy'" + "setuptools>=64; platform_python_implementation != 'PyPy'", + "cmake>=3.12" ] build-backend = "setuptools.build_meta" diff --git a/src/_igraph/graphobject.c b/src/_igraph/graphobject.c index 7d55012b1..a8a6a121d 100644 --- a/src/_igraph/graphobject.c +++ b/src/_igraph/graphobject.c @@ -7862,7 +7862,7 @@ PyObject *igraphmodule_Graph_simple_cycles( igraph_vector_int_list_destroy(&vertices); PyObject *results; - results = Py_BuildValue("(OO)", results_vertices_o, result_edges_o); + results = Py_BuildValue("(OO)", result_vertices_o, result_edges_o); return results; } diff --git a/tests/test_cycles.py b/tests/test_cycles.py index 48a37f2f7..e1c0c811a 100644 --- a/tests/test_cycles.py +++ b/tests/test_cycles.py @@ -30,6 +30,24 @@ def test_is_dag(self): g = Graph.Ring(10, directed=True, mutual=False) self.assertFalse(g.is_dag()) + def test_simple_cycles(self): + g = Graph( + [ + (0, 1), + (1, 2), + (2, 0), + (0, 0), + (0, 3), + (3, 4), + (4, 5), + (5, 0), + ] + ) + + vertices, edges = g.simple_cycles() + assert len(vertices) == 3 + assert len(edges) == 3 + def test_fundamental_cycles(self): g = Graph( [ diff --git a/vendor/source/igraph b/vendor/source/igraph index 3dd336a4e..fb81bda14 160000 --- a/vendor/source/igraph +++ b/vendor/source/igraph @@ -1 +1 @@ -Subproject commit 3dd336a4e8114e0373b4bd9cf4d9837ffe9e703c +Subproject commit fb81bda143ad35aaa50cbc508f917671402c38f6