Skip to content

Commit

Permalink
Un-ignore R+C 2
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr authored and aviator-bot committed Apr 9, 2024
1 parent a3bd2e7 commit f87a91c
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
11 changes: 11 additions & 0 deletions R/aaa-auto.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ empty_impl <- function(n=0, directed=TRUE) {
res
}

add_edges_impl <- function(graph, edges) {
# Argument checks
ensure_igraph(graph)

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

res
}

copy_impl <- function(from) {
# Argument checks
ensure_igraph(from)
Expand Down
2 changes: 2 additions & 0 deletions src/cpp11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ extern "C" SEXP _igraph_getsphere(SEXP spos, SEXP sradius, SEXP scolor, SEXP lig

extern "C" {
/* .Call calls */
extern SEXP R_igraph_add_edges(void *, void *);
extern SEXP R_igraph_add_edges_manual(void *, void *);
extern SEXP R_igraph_add_env(void *);
extern SEXP R_igraph_add_myid_to_env(void *);
Expand Down Expand Up @@ -480,6 +481,7 @@ extern SEXP promise_env_(void *);
extern SEXP promise_expr_(void *);

static const R_CallMethodDef CallEntries[] = {
{"R_igraph_add_edges", (DL_FUNC) &R_igraph_add_edges, 2},
{"R_igraph_add_edges_manual", (DL_FUNC) &R_igraph_add_edges_manual, 2},
{"R_igraph_add_env", (DL_FUNC) &R_igraph_add_env, 1},
{"R_igraph_add_myid_to_env", (DL_FUNC) &R_igraph_add_myid_to_env, 1},
Expand Down
27 changes: 27 additions & 0 deletions src/rinterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,33 @@ SEXP R_igraph_empty(SEXP n, SEXP directed) {
return(r_result);
}

/*-------------------------------------------/
/ igraph_add_edges /
/-------------------------------------------*/
SEXP R_igraph_add_edges(SEXP graph, SEXP edges) {
/* Declarations */
igraph_t c_graph;
igraph_vector_int_t c_edges;


SEXP r_result;
/* Convert input */
R_SEXP_to_igraph_copy(graph, &c_graph);
IGRAPH_FINALLY(igraph_destroy, &c_graph);
R_SEXP_to_vector_int_copy(edges, &c_edges);
/* Call igraph */
IGRAPH_R_CHECK(igraph_add_edges(&c_graph, &c_edges, 0));

/* Convert output */
PROTECT(graph=R_igraph_to_SEXP(&c_graph));
IGRAPH_I_DESTROY(&c_graph);
IGRAPH_FINALLY_CLEAN(1);
r_result = graph;

UNPROTECT(1);
return(r_result);
}

/*-------------------------------------------/
/ igraph_copy /
/-------------------------------------------*/
Expand Down
1 change: 0 additions & 1 deletion tools/stimulus/functions-R.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ igraph_empty_attrs:
IGNORE: RR, RC

igraph_add_edges:
IGNORE: RR, RC, RInit

igraph_add_vertices:
IGNORE: RR, RC, RInit
Expand Down

0 comments on commit f87a91c

Please sign in to comment.