diff --git a/R/aaa-auto.R b/R/aaa-auto.R index 5199d5679b3..5b0cea26a32 100644 --- a/R/aaa-auto.R +++ b/R/aaa-auto.R @@ -1,6 +1,18 @@ # Generated by make -f Makefile-cigraph, do not edit by hand # styler: off +empty_impl <- function(n=0, directed=TRUE) { + # Argument checks + n <- as.numeric(n) + directed <- as.logical(directed) + + on.exit( .Call(R_igraph_finalizer) ) + # Function call + res <- .Call(R_igraph_empty, n, directed) + + res +} + copy_impl <- function(from) { # Argument checks ensure_igraph(from) @@ -36,18 +48,6 @@ vcount_impl <- function(graph) { res } -empty_attrs_impl <- function(n, directed) { - # Argument checks - n <- as.numeric(n) - directed <- as.logical(directed) - - on.exit( .Call(R_igraph_finalizer) ) - # Function call - res <- .Call(R_igraph_empty_attrs, n, directed) - - res -} - get_all_eids_between_impl <- function(graph, from, to, directed=TRUE) { # Argument checks ensure_igraph(graph) diff --git a/R/make.R b/R/make.R index bd82d7b4062..672df7cba49 100644 --- a/R/make.R +++ b/R/make.R @@ -698,25 +698,7 @@ undirected_graph <- function(...) constructor_spec(make_undirected_graph, ...) #' @examples #' make_empty_graph(n = 10) #' make_empty_graph(n = 5, directed = FALSE) -make_empty_graph <- function(n = 0, directed = TRUE) { - # Argument checks - if (is.null(n)) { - stop("number of vertices must be an integer") - } - - n <- suppressWarnings(as.numeric(n)) - if (is.na(n)) { - stop("number of vertices must be an integer") - } - - directed <- as.logical(directed) - - on.exit(.Call(R_igraph_finalizer)) - # Function call - res <- .Call(R_igraph_empty, n, directed) - - res -} +make_empty_graph <- empty_impl #' @rdname make_empty_graph #' @param ... Passed to `make_graph_empty`. diff --git a/src/cpp11.cpp b/src/cpp11.cpp index 69569d526b4..240d297015d 100644 --- a/src/cpp11.cpp +++ b/src/cpp11.cpp @@ -156,7 +156,6 @@ extern SEXP R_igraph_edges(void *, void *); extern SEXP R_igraph_eigen_adjacency(void *, void *, void *, void *); extern SEXP R_igraph_eigenvector_centrality(void *, void *, void *, void *, void *); extern SEXP R_igraph_empty(void *, void *); -extern SEXP R_igraph_empty_attrs(void *, void *); extern SEXP R_igraph_erdos_renyi_game(void *, void *, void *, void *, void *); extern SEXP R_igraph_es_adj(void *, void *, void *, void *); extern SEXP R_igraph_es_pairs(void *, void *, void *); @@ -616,7 +615,6 @@ static const R_CallMethodDef CallEntries[] = { {"R_igraph_eigen_adjacency", (DL_FUNC) &R_igraph_eigen_adjacency, 4}, {"R_igraph_eigenvector_centrality", (DL_FUNC) &R_igraph_eigenvector_centrality, 5}, {"R_igraph_empty", (DL_FUNC) &R_igraph_empty, 2}, - {"R_igraph_empty_attrs", (DL_FUNC) &R_igraph_empty_attrs, 2}, {"R_igraph_erdos_renyi_game", (DL_FUNC) &R_igraph_erdos_renyi_game, 5}, {"R_igraph_es_adj", (DL_FUNC) &R_igraph_es_adj, 4}, {"R_igraph_es_pairs", (DL_FUNC) &R_igraph_es_pairs, 3}, diff --git a/src/rinterface.c b/src/rinterface.c index a1973d73a6d..ee195e426f7 100644 --- a/src/rinterface.c +++ b/src/rinterface.c @@ -162,37 +162,6 @@ SEXP R_igraph_vcount(SEXP graph) { return(r_result); } -/*-------------------------------------------/ -/ igraph_empty_attrs / -/-------------------------------------------*/ -SEXP R_igraph_empty_attrs(SEXP n, SEXP directed) { - /* Declarations */ - igraph_t c_graph; - igraph_integer_t c_n; - igraph_bool_t c_directed; - - SEXP graph; - - SEXP r_result; - /* Convert input */ - IGRAPH_R_CHECK_INT(n); - c_n = (igraph_integer_t) REAL(n)[0]; - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; - /* Call igraph */ - IGRAPH_R_CHECK(igraph_empty_attrs(&c_graph, c_n, c_directed, 0)); - - /* Convert output */ - IGRAPH_FINALLY(igraph_destroy, &c_graph); - 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_get_all_eids_between / /-------------------------------------------*/ diff --git a/tools/stimulus/functions-R.yaml b/tools/stimulus/functions-R.yaml index b03cfae9648..02ec6e31779 100644 --- a/tools/stimulus/functions-R.yaml +++ b/tools/stimulus/functions-R.yaml @@ -11,7 +11,10 @@ ####################################### igraph_empty: - IGNORE: RR + +# Not needed in R, we use igraph_emtpy() instead +igraph_empty_attrs: + IGNORE: RR, RC igraph_add_edges: IGNORE: RR, RC, RInit @@ -49,8 +52,6 @@ igraph_edge: igraph_edges: IGNORE: RR, RC -igraph_empty_attrs: - igraph_get_eid: IGNORE: RR, RC, RInit