Skip to content

Commit

Permalink
Add tests and changelog for simple_cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
GenieTim committed Nov 5, 2024
1 parent f1c7ebf commit 62ec4a1
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion src/_igraph/graphobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
18 changes: 18 additions & 0 deletions tests/test_cycles.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
[
Expand Down
2 changes: 1 addition & 1 deletion vendor/source/igraph
Submodule igraph updated 59 files
+18 −0 .all-contributorsrc
+9 −0 CHANGELOG.md
+89 −85 CONTRIBUTORS.md
+2 −0 CONTRIBUTORS.txt
+6 −4 azure-pipelines.yml
+3 −0 doc/cycles.xxml
+3 −2 etc/cmake/compilers.cmake
+3 −3 fuzzing/build.sh
+1 −4 include/igraph.h
+0 −2 include/igraph_bitset.h
+0 −2 include/igraph_bitset_list.h
+52 −0 include/igraph_cycles.h
+20 −0 include/igraph_decls.h
+1 −1 include/igraph_statusbar.h
+194 −150 interfaces/functions.yaml
+6 −1 interfaces/types.yaml
+2 −0 src/CMakeLists.txt
+16 −0 src/centrality/betweenness.c
+145 −48 src/centrality/centralization.c
+4 −5 src/centrality/closeness.c
+48 −20 src/centrality/eigenvector.c
+6 −5 src/cliques/glet.c
+1 −1 src/community/optimal_modularity.c
+10 −5 src/connectivity/components.c
+3 −2 src/constructors/circulant.c
+57 −55 src/constructors/lattices.c
+3 −2 src/constructors/lcf.c
+13 −4 src/constructors/regular.c
+11 −11 src/core/sparsemat.c
+614 −0 src/cycles/simple_cycles.c
+1 −1 src/games/citations.c
+3 −4 src/games/correlated.c
+1 −1 src/games/degree_sequence_vl/gengraph_mr-connected.cpp
+7 −6 src/games/recent_degree.c
+2 −6 src/games/tree.c
+1 −1 src/graph/caching.c
+5 −5 src/graph/type_indexededgelist.c
+2 −2 src/graph/visitors.c
+1 −1 src/io/dl.c
+1 −1 src/io/graphdb.c
+1 −1 src/layout/drl/drl_layout.cpp
+1 −1 src/layout/drl/drl_layout_3d.cpp
+1 −1 src/layout/graphopt.c
+8 −2 src/layout/large_graph.c
+1 −1 src/layout/umap.c
+9 −9 src/linalg/lapack.c
+11 −9 src/misc/bipartite.c
+1 −0 src/misc/degree_sequence.cpp
+4 −0 src/misc/feedback_arc_set.c
+4 −4 src/misc/matching.c
+6 −0 src/misc/motifs.c
+9 −9 src/paths/distances.c
+8 −5 src/properties/basic_properties.c
+1 −1 src/properties/degrees.c
+1 −0 tests/CMakeLists.txt
+8 −1 tests/unit/igraph_eigenvector_centrality.c
+7 −2 tests/unit/igraph_eigenvector_centrality.out
+413 −0 tests/unit/igraph_simple_cycles.c
+1,821 −0 tests/unit/igraph_simple_cycles.out

0 comments on commit 62ec4a1

Please sign in to comment.