Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vendor: Update vendored sources to igraph/igraph@10ef19bc2a61de6c6cfe76e5a068f82b1d29fff1 #1694

Merged
merged 2 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions R/aaa-auto.R
Original file line number Diff line number Diff line change
Expand Up @@ -2712,14 +2712,25 @@ triad_census_impl <- function(graph) {
res
}

adjacent_triangles_impl <- function(graph, vids=V(graph)) {
count_adjacent_triangles_impl <- function(graph, vids=V(graph)) {
# Argument checks
ensure_igraph(graph)
vids <- as_igraph_vs(graph, vids)

on.exit( .Call(R_igraph_finalizer) )
# Function call
res <- .Call(R_igraph_adjacent_triangles, graph, vids-1)
res <- .Call(R_igraph_count_adjacent_triangles, graph, vids-1)

res
}

count_triangles_impl <- function(graph) {
# Argument checks
ensure_igraph(graph)

on.exit( .Call(R_igraph_finalizer) )
# Function call
res <- .Call(R_igraph_count_triangles, graph)

res
}
Expand Down
2 changes: 1 addition & 1 deletion R/triangles.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ triangles <- list_triangles_impl
#' @export
#' @rdname count_triangles
#' @cdocs igraph_adjacent_triangles
count_triangles <- adjacent_triangles_impl
count_triangles <- count_adjacent_triangles_impl
6 changes: 4 additions & 2 deletions src/cpp11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ extern SEXP R_igraph_address(SEXP);
extern SEXP R_igraph_adhesion(SEXP, SEXP);
extern SEXP R_igraph_adjacency(SEXP, SEXP, SEXP);
extern SEXP R_igraph_adjacency_spectral_embedding(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
extern SEXP R_igraph_adjacent_triangles(SEXP, SEXP);
extern SEXP R_igraph_adjacent_vertices(SEXP, SEXP, SEXP);
extern SEXP R_igraph_adjlist(SEXP, SEXP, SEXP);
extern SEXP R_igraph_all_minimal_st_separators(SEXP);
Expand Down Expand Up @@ -112,12 +111,14 @@ extern SEXP R_igraph_copy_to(SEXP);
extern SEXP R_igraph_coreness(SEXP, SEXP);
extern SEXP R_igraph_correlated_game(SEXP, SEXP, SEXP, SEXP);
extern SEXP R_igraph_correlated_pair_game(SEXP, SEXP, SEXP, SEXP, SEXP);
extern SEXP R_igraph_count_adjacent_triangles(SEXP, SEXP);
extern SEXP R_igraph_count_automorphisms(SEXP, SEXP, SEXP);
extern SEXP R_igraph_count_isomorphisms_vf2(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
extern SEXP R_igraph_count_loops(SEXP);
extern SEXP R_igraph_count_multiple(SEXP, SEXP);
extern SEXP R_igraph_count_reachable(SEXP, SEXP);
extern SEXP R_igraph_count_subisomorphisms_vf2(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
extern SEXP R_igraph_count_triangles(SEXP);
extern SEXP R_igraph_create(SEXP, SEXP, SEXP);
extern SEXP R_igraph_create_bipartite(SEXP, SEXP, SEXP);
extern SEXP R_igraph_de_bruijn(SEXP, SEXP);
Expand Down Expand Up @@ -487,7 +488,6 @@ static const R_CallMethodDef CallEntries[] = {
{"R_igraph_adhesion", (DL_FUNC) &R_igraph_adhesion, 2},
{"R_igraph_adjacency", (DL_FUNC) &R_igraph_adjacency, 3},
{"R_igraph_adjacency_spectral_embedding", (DL_FUNC) &R_igraph_adjacency_spectral_embedding, 7},
{"R_igraph_adjacent_triangles", (DL_FUNC) &R_igraph_adjacent_triangles, 2},
{"R_igraph_adjacent_vertices", (DL_FUNC) &R_igraph_adjacent_vertices, 3},
{"R_igraph_adjlist", (DL_FUNC) &R_igraph_adjlist, 3},
{"R_igraph_all_minimal_st_separators", (DL_FUNC) &R_igraph_all_minimal_st_separators, 1},
Expand Down Expand Up @@ -567,12 +567,14 @@ static const R_CallMethodDef CallEntries[] = {
{"R_igraph_coreness", (DL_FUNC) &R_igraph_coreness, 2},
{"R_igraph_correlated_game", (DL_FUNC) &R_igraph_correlated_game, 4},
{"R_igraph_correlated_pair_game", (DL_FUNC) &R_igraph_correlated_pair_game, 5},
{"R_igraph_count_adjacent_triangles", (DL_FUNC) &R_igraph_count_adjacent_triangles, 2},
{"R_igraph_count_automorphisms", (DL_FUNC) &R_igraph_count_automorphisms, 3},
{"R_igraph_count_isomorphisms_vf2", (DL_FUNC) &R_igraph_count_isomorphisms_vf2, 6},
{"R_igraph_count_loops", (DL_FUNC) &R_igraph_count_loops, 1},
{"R_igraph_count_multiple", (DL_FUNC) &R_igraph_count_multiple, 2},
{"R_igraph_count_reachable", (DL_FUNC) &R_igraph_count_reachable, 2},
{"R_igraph_count_subisomorphisms_vf2", (DL_FUNC) &R_igraph_count_subisomorphisms_vf2, 6},
{"R_igraph_count_triangles", (DL_FUNC) &R_igraph_count_triangles, 1},
{"R_igraph_create", (DL_FUNC) &R_igraph_create, 3},
{"R_igraph_create_bipartite", (DL_FUNC) &R_igraph_create_bipartite, 3},
{"R_igraph_de_bruijn", (DL_FUNC) &R_igraph_de_bruijn, 2},
Expand Down
30 changes: 27 additions & 3 deletions src/rinterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -8589,9 +8589,9 @@ SEXP R_igraph_triad_census(SEXP graph) {
}

/*-------------------------------------------/
/ igraph_adjacent_triangles /
/ igraph_count_adjacent_triangles /
/-------------------------------------------*/
SEXP R_igraph_adjacent_triangles(SEXP graph, SEXP vids) {
SEXP R_igraph_count_adjacent_triangles(SEXP graph, SEXP vids) {
/* Declarations */
igraph_t c_graph;
igraph_vector_t c_res;
Expand All @@ -8606,7 +8606,7 @@ SEXP R_igraph_adjacent_triangles(SEXP graph, SEXP vids) {
igraph_vector_int_t c_vids_data;
R_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data);
/* Call igraph */
IGRAPH_R_CHECK(igraph_adjacent_triangles(&c_graph, &c_res, c_vids));
IGRAPH_R_CHECK(igraph_count_adjacent_triangles(&c_graph, &c_res, c_vids));

/* Convert output */
PROTECT(res=R_igraph_vector_to_SEXP(&c_res));
Expand All @@ -8620,6 +8620,30 @@ SEXP R_igraph_adjacent_triangles(SEXP graph, SEXP vids) {
return(r_result);
}

/*-------------------------------------------/
/ igraph_count_triangles /
/-------------------------------------------*/
SEXP R_igraph_count_triangles(SEXP graph) {
/* Declarations */
igraph_t c_graph;
igraph_real_t c_res;
SEXP res;

SEXP r_result;
/* Convert input */
R_SEXP_to_igraph(graph, &c_graph);
/* Call igraph */
IGRAPH_R_CHECK(igraph_count_triangles(&c_graph, &c_res));

/* Convert output */
PROTECT(res=NEW_NUMERIC(1));
REAL(res)[0]=c_res;
r_result = res;

UNPROTECT(1);
return(r_result);
}

/*-------------------------------------------/
/ igraph_local_scan_0 /
/-------------------------------------------*/
Expand Down
7 changes: 7 additions & 0 deletions src/vendor/cigraph/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,23 @@

## [master]

### Added

- `igraph_count_triangles()` counts undirected triangles in a graph.
- `igraph_count_adjacent_triangles()` (rename of `igraph_adjacent_triangles()`)

### Deprecated

- The undocumented function `igraph_vector_sumsq()` is deprecated. Use `igraph_blas_dnrm2()` to compute the Euclidean norm of real vectors.
- `igraph_adjacent_triangles()` is deprecated and scheduled for removal in 1.0.

### Other

- Workaround for bug in CMake 3.31.0, see https://gitlab.kitware.com/cmake/cmake/-/issues/26449
- Updated the vendored `plfit` library to version 1.0.0. This works around a bug in some MSVC / Windows SDK versions that define a `NAN` macro that is not a compile-time constant.
- Updated vendored BLAS to 3.12.0 and vendored ARPACK to ARPACK-NG 3.7.0.
- Re-translated vendored BLAS/LAPACK/ARPACK sources with f2c version 20240504.
- The performance of `igraph_transitivity_undirected()` is improved by a factor of about 2.5.
- Documentation improvements.

## [0.10.15]
Expand Down
8 changes: 7 additions & 1 deletion src/vendor/cigraph/include/igraph_motifs.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,19 @@ IGRAPH_EXPORT igraph_error_t igraph_dyad_census(const igraph_t *graph, igraph_re
igraph_real_t *asym, igraph_real_t *null);
IGRAPH_EXPORT igraph_error_t igraph_triad_census(const igraph_t *igraph, igraph_vector_t *res);

IGRAPH_EXPORT igraph_error_t igraph_adjacent_triangles(const igraph_t *graph,
IGRAPH_EXPORT igraph_error_t igraph_count_adjacent_triangles(const igraph_t *graph,
igraph_vector_t *res,
const igraph_vs_t vids);

IGRAPH_EXPORT IGRAPH_DEPRECATED igraph_error_t igraph_adjacent_triangles(const igraph_t *graph,
igraph_vector_t *res,
const igraph_vs_t vids);

IGRAPH_EXPORT igraph_error_t igraph_list_triangles(const igraph_t *graph,
igraph_vector_int_t *res);

IGRAPH_EXPORT igraph_error_t igraph_count_triangles(const igraph_t *graph, igraph_real_t *res);

__END_DECLS

#endif
5 changes: 4 additions & 1 deletion src/vendor/cigraph/interfaces/functions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1972,10 +1972,13 @@ igraph_triad_census:
PARAMS: GRAPH graph, OUT VECTOR res
RETURN: ERROR

igraph_adjacent_triangles:
igraph_count_adjacent_triangles:
PARAMS: GRAPH graph, OUT VECTOR res, VERTEX_SELECTOR vids=ALL
DEPS: vids ON graph

igraph_count_triangles:
PARAMS: GRAPH graph, OUT REAL res

igraph_local_scan_0:
PARAMS: |-
GRAPH graph, OUT VECTOR res, OPTIONAL EDGEWEIGHTS weights,
Expand Down
Loading
Loading