Skip to content

Commit

Permalink
chore: Update vendored sources to igraph/igraph@a166195
Browse files Browse the repository at this point in the history
chore: updated changelog
chore: updated changelog
chore: run pre-commit hooks
chore: bump VERSION property in shared library
fix: fix self-loops handling during simple cycle detection, closes igraph/igraph#2692
Revert "fix: temporary fix for simple cycle search mishandling self-loops, ref igraph/igraph#2692"
fix: temporary fix for simple cycle search mishandling self-loops, ref igraph/igraph#2692
test: minimum cycle length for igraph_simple_cycles()
refactor: do not use vector_get() in simple cycle finder
refactor: cleaner parameter ordering in igraph_i_simple_cycles_circuit()
refactor: support specifying a minimum cycle length in `igraph_simple_cycles()`
interface: loops=True default for igraph_degree()
chore: updated contributors list
  • Loading branch information
szhorvat authored and krlmlr committed Nov 8, 2024
1 parent 34901cc commit 26f0dfa
Show file tree
Hide file tree
Showing 12 changed files with 167 additions and 121 deletions.
5 changes: 3 additions & 2 deletions R/aaa-auto.R
Original file line number Diff line number Diff line change
Expand Up @@ -3580,15 +3580,16 @@ find_cycle_impl <- function(graph, mode=c("out", "in", "all", "total")) {
res
}

simple_cycles_impl <- function(graph, mode=c("out", "in", "all", "total"), max.cycle.length=-1) {
simple_cycles_impl <- function(graph, mode=c("out", "in", "all", "total"), min.cycle.length=-1, max.cycle.length=-1) {
# Argument checks
ensure_igraph(graph)
mode <- switch(igraph.match.arg(mode), "out"=1L, "in"=2L, "all"=3L, "total"=3L)
min.cycle.length <- as.numeric(min.cycle.length)
max.cycle.length <- as.numeric(max.cycle.length)

on.exit( .Call(R_igraph_finalizer) )
# Function call
res <- .Call(R_igraph_simple_cycles, graph, mode, max.cycle.length)
res <- .Call(R_igraph_simple_cycles, graph, mode, min.cycle.length, max.cycle.length)
if (igraph_opt("return.vs.es")) {
res$vertices <- lapply(res$vertices, unsafe_create_vs, graph = graph, verts = V(graph))
}
Expand Down
4 changes: 2 additions & 2 deletions src/cpp11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ extern SEXP R_igraph_similarity_inverse_log_weighted(SEXP, SEXP, SEXP);
extern SEXP R_igraph_similarity_jaccard(SEXP, SEXP, SEXP, SEXP);
extern SEXP R_igraph_similarity_jaccard_es(SEXP, SEXP, SEXP, SEXP);
extern SEXP R_igraph_similarity_jaccard_pairs(SEXP, SEXP, SEXP, SEXP);
extern SEXP R_igraph_simple_cycles(SEXP, SEXP, SEXP);
extern SEXP R_igraph_simple_cycles(SEXP, SEXP, SEXP, SEXP);
extern SEXP R_igraph_simple_interconnected_islands_game(SEXP, SEXP, SEXP, SEXP);
extern SEXP R_igraph_simplify(SEXP, SEXP, SEXP, SEXP);
extern SEXP R_igraph_simplify_and_colorize(SEXP);
Expand Down Expand Up @@ -856,7 +856,7 @@ static const R_CallMethodDef CallEntries[] = {
{"R_igraph_similarity_jaccard", (DL_FUNC) &R_igraph_similarity_jaccard, 4},
{"R_igraph_similarity_jaccard_es", (DL_FUNC) &R_igraph_similarity_jaccard_es, 4},
{"R_igraph_similarity_jaccard_pairs", (DL_FUNC) &R_igraph_similarity_jaccard_pairs, 4},
{"R_igraph_simple_cycles", (DL_FUNC) &R_igraph_simple_cycles, 3},
{"R_igraph_simple_cycles", (DL_FUNC) &R_igraph_simple_cycles, 4},
{"R_igraph_simple_interconnected_islands_game", (DL_FUNC) &R_igraph_simple_interconnected_islands_game, 4},
{"R_igraph_simplify", (DL_FUNC) &R_igraph_simplify, 4},
{"R_igraph_simplify_and_colorize", (DL_FUNC) &R_igraph_simplify_and_colorize, 1},
Expand Down
7 changes: 5 additions & 2 deletions src/rinterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -10968,12 +10968,13 @@ SEXP R_igraph_find_cycle(SEXP graph, SEXP mode) {
/*-------------------------------------------/
/ igraph_simple_cycles /
/-------------------------------------------*/
SEXP R_igraph_simple_cycles(SEXP graph, SEXP mode, SEXP max_cycle_length) {
SEXP R_igraph_simple_cycles(SEXP graph, SEXP mode, SEXP min_cycle_length, SEXP max_cycle_length) {
/* Declarations */
igraph_t c_graph;
igraph_vector_int_list_t c_vertices;
igraph_vector_int_list_t c_edges;
igraph_neimode_t c_mode;
igraph_integer_t c_min_cycle_length;
igraph_integer_t c_max_cycle_length;
SEXP vertices;
SEXP edges;
Expand All @@ -10986,10 +10987,12 @@ SEXP R_igraph_simple_cycles(SEXP graph, SEXP mode, SEXP max_cycle_length) {
IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_edges, 0));
IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_edges);
c_mode = (igraph_neimode_t) Rf_asInteger(mode);
IGRAPH_R_CHECK_INT(min_cycle_length);
c_min_cycle_length = (igraph_integer_t) REAL(min_cycle_length)[0];
IGRAPH_R_CHECK_INT(max_cycle_length);
c_max_cycle_length = (igraph_integer_t) REAL(max_cycle_length)[0];
/* Call igraph */
IGRAPH_R_CHECK(igraph_simple_cycles(&c_graph, &c_vertices, &c_edges, c_mode, c_max_cycle_length));
IGRAPH_R_CHECK(igraph_simple_cycles(&c_graph, &c_vertices, &c_edges, c_mode, c_min_cycle_length, c_max_cycle_length));

/* Convert output */
PROTECT(r_result=NEW_LIST(2));
Expand Down
18 changes: 18 additions & 0 deletions src/vendor/cigraph/.all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,24 @@
"contributions": [
"code"
]
},
{
"login": "GenieTim",
"name": "Tim Bernhard",
"avatar_url": "https://avatars.githubusercontent.com/u/8596965?v=4",
"profile": "https://github.com/GenieTim",
"contributions": [
"code"
]
},
{
"login": "maelle",
"name": "Maëlle Salmon",
"avatar_url": "https://avatars.githubusercontent.com/u/8360597?v=4",
"profile": "https://masalmon.eu/",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7
Expand Down
5 changes: 4 additions & 1 deletion src/vendor/cigraph/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [master]

## [0.10.15]

### Added

- `igraph_bitset_update()` copies the contents of one bitset into another (experimental function).
Expand Down Expand Up @@ -1445,7 +1447,8 @@ Some of the highlights are:
- Provide proper support for Windows, using `__declspec(dllexport)` and `__declspec(dllimport)` for `DLL`s and static usage by using `#define IGRAPH_STATIC 1`.
- Provided integer versions of `dqueue` and `stack` data types.

[master]: https://github.com/igraph/igraph/compare/0.10.13..master
[master]: https://github.com/igraph/igraph/compare/0.10.15..master
[0.10.15]: https://github.com/igraph/igraph/compare/0.10.13..0.10.15
[0.10.13]: https://github.com/igraph/igraph/compare/0.10.12..0.10.13
[0.10.12]: https://github.com/igraph/igraph/compare/0.10.11..0.10.12
[0.10.11]: https://github.com/igraph/igraph/compare/0.10.10..0.10.11
Expand Down
Loading

0 comments on commit 26f0dfa

Please sign in to comment.