Skip to content

Commit ad0af06

Browse files
committed
Un-ignore R+C 2
1 parent 228d283 commit ad0af06

4 files changed

Lines changed: 40 additions & 1 deletion

File tree

R/aaa-auto.R

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ empty_impl <- function(n=0, directed=TRUE) {
1212
res
1313
}
1414

15+
add_edges_impl <- function(graph, edges) {
16+
# Argument checks
17+
ensure_igraph(graph)
18+
19+
on.exit( .Call(R_igraph_finalizer) )
20+
# Function call
21+
res <- .Call(R_igraph_add_edges, graph, edges)
22+
23+
res
24+
}
25+
1526
copy_impl <- function(from) {
1627
# Argument checks
1728
ensure_igraph(from)

src/cpp11.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ extern "C" SEXP _igraph_igraph_hcass2(SEXP n, SEXP ia, SEXP ib) {
1515

1616
extern "C" {
1717
/* .Call calls */
18+
extern SEXP R_igraph_add_edges(void *, void *);
1819
extern SEXP R_igraph_add_edges_manual(void *, void *);
1920
extern SEXP R_igraph_add_env(void *);
2021
extern SEXP R_igraph_add_myid_to_env(void *);
@@ -490,6 +491,7 @@ extern SEXP promise_env_(void *);
490491
extern SEXP promise_expr_(void *);
491492

492493
static const R_CallMethodDef CallEntries[] = {
494+
{"R_igraph_add_edges", (DL_FUNC) &R_igraph_add_edges, 2},
493495
{"R_igraph_add_edges_manual", (DL_FUNC) &R_igraph_add_edges_manual, 2},
494496
{"R_igraph_add_env", (DL_FUNC) &R_igraph_add_env, 1},
495497
{"R_igraph_add_myid_to_env", (DL_FUNC) &R_igraph_add_myid_to_env, 1},

src/rinterface.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,33 @@ SEXP R_igraph_empty(SEXP n, SEXP directed) {
157157
return(r_result);
158158
}
159159

160+
/*-------------------------------------------/
161+
/ igraph_add_edges /
162+
/-------------------------------------------*/
163+
SEXP R_igraph_add_edges(SEXP graph, SEXP edges) {
164+
/* Declarations */
165+
igraph_t c_graph;
166+
igraph_vector_int_t c_edges;
167+
168+
169+
SEXP r_result;
170+
/* Convert input */
171+
R_SEXP_to_igraph_copy(graph, &c_graph);
172+
IGRAPH_FINALLY(igraph_destroy, &c_graph);
173+
R_SEXP_to_vector_int_copy(edges, &c_edges);
174+
/* Call igraph */
175+
IGRAPH_R_CHECK(igraph_add_edges(&c_graph, &c_edges, 0));
176+
177+
/* Convert output */
178+
PROTECT(graph=R_igraph_to_SEXP(&c_graph));
179+
IGRAPH_I_DESTROY(&c_graph);
180+
IGRAPH_FINALLY_CLEAN(1);
181+
r_result = graph;
182+
183+
UNPROTECT(1);
184+
return(r_result);
185+
}
186+
160187
/*-------------------------------------------/
161188
/ igraph_copy /
162189
/-------------------------------------------*/

tools/stimulus/functions-R.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
igraph_empty:
1414

1515
igraph_add_edges:
16-
IGNORE: RR, RC, RInit
1716

1817
igraph_add_vertices:
1918
IGNORE: RR, RC, RInit

0 commit comments

Comments
 (0)