From c217cec55cd7238e2a1340772fa6c6334e152257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Mon, 8 Sep 2025 13:10:59 +0200 Subject: [PATCH] chore: fix `full_bipartite_impl()` --- R/aaa-auto.R | 4 +--- src/rinterface.c | 20 +++----------------- src/vendor/cigraph/interfaces/functions.yaml | 3 +-- 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/R/aaa-auto.R b/R/aaa-auto.R index 6aafda4bfa..b06d696b1a 100644 --- a/R/aaa-auto.R +++ b/R/aaa-auto.R @@ -333,9 +333,7 @@ full_bipartite_impl <- function(n1, n2, directed=FALSE, mode=c("all", "out", "in on.exit( .Call(R_igraph_finalizer) ) # Function call res <- .Call(R_igraph_full_bipartite, n1, n2, directed, mode) - if (igraph_opt("add.vertex.names") && is_named(graph)) { - names(res$types) <- vertex_attr(graph, "name") - } + res } diff --git a/src/rinterface.c b/src/rinterface.c index 2f2328e4fe..b7baa4ac70 100644 --- a/src/rinterface.c +++ b/src/rinterface.c @@ -912,18 +912,14 @@ SEXP R_igraph_adjlist(SEXP adjlist, SEXP mode, SEXP duplicate) { SEXP R_igraph_full_bipartite(SEXP n1, SEXP n2, SEXP directed, SEXP mode) { /* Declarations */ igraph_t c_graph; - igraph_vector_bool_t c_types; igraph_integer_t c_n1; igraph_integer_t c_n2; igraph_bool_t c_directed; igraph_neimode_t c_mode; SEXP graph; - SEXP types; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ - IGRAPH_R_CHECK(igraph_vector_bool_init(&c_types, 0)); - IGRAPH_FINALLY(igraph_vector_bool_destroy, &c_types); IGRAPH_R_CHECK_INT(n1); c_n1 = (igraph_integer_t) REAL(n1)[0]; IGRAPH_R_CHECK_INT(n2); @@ -932,24 +928,14 @@ SEXP R_igraph_full_bipartite(SEXP n1, SEXP n2, SEXP directed, SEXP mode) { c_directed = LOGICAL(directed)[0]; c_mode = (igraph_neimode_t) Rf_asInteger(mode); /* Call igraph */ - IGRAPH_R_CHECK(igraph_full_bipartite(&c_graph, &c_types, c_n1, c_n2, c_directed, c_mode)); + IGRAPH_R_CHECK(igraph_full_bipartite(&c_graph, c_n1, c_n2, c_directed, c_mode)); /* Convert output */ - PROTECT(r_result=NEW_LIST(2)); - PROTECT(r_names=NEW_CHARACTER(2)); IGRAPH_FINALLY(igraph_destroy, &c_graph); PROTECT(graph=R_igraph_to_SEXP(&c_graph)); IGRAPH_I_DESTROY(&c_graph); IGRAPH_FINALLY_CLEAN(1); - PROTECT(types=R_igraph_vector_bool_to_SEXP(&c_types)); - igraph_vector_bool_destroy(&c_types); - IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, graph); - SET_VECTOR_ELT(r_result, 1, types); - SET_STRING_ELT(r_names, 0, Rf_mkChar("graph")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("types")); - SET_NAMES(r_result, r_names); - UNPROTECT(3); + r_result = graph; UNPROTECT(1); return(r_result); diff --git a/src/vendor/cigraph/interfaces/functions.yaml b/src/vendor/cigraph/interfaces/functions.yaml index 3407761b38..8042e8c029 100644 --- a/src/vendor/cigraph/interfaces/functions.yaml +++ b/src/vendor/cigraph/interfaces/functions.yaml @@ -207,9 +207,8 @@ igraph_adjlist: igraph_full_bipartite: PARAMS: |- - OUT GRAPH graph, OPTIONAL OUT ALL_BIPARTITE_TYPES types, INTEGER n1, + OUT GRAPH graph, INTEGER n1, INTEGER n2, BOOLEAN directed=False, NEIMODE mode=ALL - DEPS: types ON graph igraph_full_multipartite: PARAMS: |-