From 040d6aa80b2fe7ab75ae0e7aa81224c380c4e13a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 4 Nov 2025 21:52:53 +0000 Subject: [PATCH 01/10] Initial plan From 187387ac08ae9ea8a160fa0d2c4047976633e1db Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 4 Nov 2025 22:34:55 +0000 Subject: [PATCH 02/10] feat: remove IGNORE specs for 124 non-callback functions and regenerate interfaces - Removed IGNORE specifications for all non-callback functions (124 functions) - Kept IGNORE for 4 callback functions as specified - Added missing DEPS specifications for newly enabled functions - Regenerated R/aaa-auto.R and src/rinterface.c using Stimulus - Added 121 new _impl functions (from 364 to 485) Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com> --- R/aaa-auto.R | 7234 ++++++++++++++----- src/rinterface.c | 11295 ++++++++++++++++++++++-------- tools/stimulus/functions-R.yaml | 135 +- 3 files changed, 13898 insertions(+), 4766 deletions(-) diff --git a/R/aaa-auto.R b/R/aaa-auto.R index 190ba1df80..df43cbac6c 100644 --- a/R/aaa-auto.R +++ b/R/aaa-auto.R @@ -38,6 +38,25 @@ add_edges_impl <- function( 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 +} + add_vertices_impl <- function( graph, nv @@ -245,6 +264,25 @@ degree_impl <- function( res } +edge_impl <- function( + graph, + eid +) { + # Argument checks + ensure_igraph(graph) + eid <- as.numeric(eid) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_edge, + graph, + eid + ) + + res +} + edges_impl <- function( graph, eids @@ -266,6 +304,72 @@ edges_impl <- function( res } +get_eid_impl <- function( + graph, + from, + to, + directed = TRUE, + error = TRUE +) { + # Argument checks + ensure_igraph(graph) + from <- as_igraph_vs(graph, from) + if (length(from) == 0) { + cli::cli_abort( + "{.arg from} must specify at least one vertex", + call = rlang::caller_env() + ) + } + to <- as_igraph_vs(graph, to) + if (length(to) == 0) { + cli::cli_abort( + "{.arg to} must specify at least one vertex", + call = rlang::caller_env() + ) + } + directed <- as.logical(directed) + error <- as.logical(error) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_get_eid, + graph, + from - 1, + to - 1, + directed, + error + ) + + res +} + +get_eids_impl <- function( + graph, + pairs, + directed = TRUE, + error = TRUE +) { + # Argument checks + ensure_igraph(graph) + directed <- as.logical(directed) + error <- as.logical(error) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_get_eids, + graph, + pairs, + directed, + error + ) + if (igraph_opt("return.vs.es")) { + res <- create_es(graph, res) + } + res +} + get_all_eids_between_impl <- function( graph, from, @@ -341,6 +445,152 @@ incident_impl <- function( res } +is_same_graph_impl <- function( + graph1, + graph2 +) { + # Argument checks + ensure_igraph(graph1) + ensure_igraph(graph2) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_is_same_graph, + graph1, + graph2 + ) + + res +} + +create_impl <- function( + edges, + n = 0, + directed = TRUE +) { + # Argument checks + edges <- as.numeric(edges) + n <- as.numeric(n) + directed <- as.logical(directed) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_create, + edges, + n, + directed + ) + + res +} + +adjacency_impl <- function( + adjmatrix, + mode = DIRECTED, + loops = c("once", "none", "twice") +) { + # Argument checks + adjmatrix[] <- as.numeric(adjmatrix) + loops <- switch_igraph_arg(loops, "none" = 0L, "twice" = 1L, "once" = 2L) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_adjacency, + adjmatrix, + mode, + loops + ) + + res +} + +sparse_adjacency_impl <- function( + adjmatrix, + mode = DIRECTED, + loops = c("once", "none", "twice") +) { + # Argument checks + requireNamespace("Matrix", quietly = TRUE); adjmatrix <- as(as(as(adjmatrix, "dMatrix"), "generalMatrix"), "CsparseMatrix") + loops <- switch_igraph_arg(loops, "none" = 0L, "twice" = 1L, "once" = 2L) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_sparse_adjacency, + adjmatrix, + mode, + loops + ) + + res +} + +sparse_weighted_adjacency_impl <- function( + adjmatrix, + mode = DIRECTED, + loops = c("once", "none", "twice") +) { + # Argument checks + requireNamespace("Matrix", quietly = TRUE); adjmatrix <- as(as(as(adjmatrix, "dMatrix"), "generalMatrix"), "CsparseMatrix") + loops <- switch_igraph_arg(loops, "none" = 0L, "twice" = 1L, "once" = 2L) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_sparse_weighted_adjacency, + adjmatrix, + mode, + loops + ) + + res +} + +weighted_adjacency_impl <- function( + adjmatrix, + mode = DIRECTED, + loops = c("once", "none", "twice") +) { + # Argument checks + adjmatrix[] <- as.numeric(adjmatrix) + loops <- switch_igraph_arg(loops, "none" = 0L, "twice" = 1L, "once" = 2L) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_weighted_adjacency, + adjmatrix, + mode, + loops + ) + + res +} + +star_impl <- function( + n, + mode = OUT, + center = 0 +) { + # Argument checks + n <- as.numeric(n) + center <- as.numeric(center) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_star, + n, + mode, + center + ) + + res +} + wheel_impl <- function( n, mode = c("out", "in", "undirected", "mutual"), @@ -440,6 +690,31 @@ triangular_lattice_impl <- function( res } +ring_impl <- function( + n, + directed = FALSE, + mutual = FALSE, + circular = TRUE +) { + # Argument checks + n <- as.numeric(n) + directed <- as.logical(directed) + mutual <- as.logical(mutual) + circular <- as.logical(circular) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_ring, + n, + directed, + mutual, + circular + ) + + res +} + path_graph_impl <- function( n, directed = FALSE, @@ -484,6 +759,28 @@ cycle_graph_impl <- function( res } +kary_tree_impl <- function( + n, + children = 2, + type = c("out", "in", "undirected") +) { + # Argument checks + n <- as.numeric(n) + children <- as.numeric(children) + type <- switch_igraph_arg(type, "out" = 0L, "in" = 1L, "undirected" = 2L) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_kary_tree, + n, + children, + type + ) + + res +} + symmetric_tree_impl <- function( branches, type = c("out", "in", "undirected") @@ -525,6 +822,28 @@ regular_tree_impl <- function( res } +full_impl <- function( + n, + directed = FALSE, + loops = FALSE +) { + # Argument checks + n <- as.numeric(n) + directed <- as.logical(directed) + loops <- as.logical(loops) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_full, + n, + directed, + loops + ) + + res +} + full_citation_impl <- function( n, directed = TRUE @@ -581,7 +900,35 @@ extended_chordal_ring_impl <- function( res } -graph_power_impl <- function( +connect_neighborhood_impl <- function( + graph, + order = 2, + mode = c("all", "out", "in", "total") +) { + # Argument checks + ensure_igraph(graph) + order <- as.numeric(order) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_connect_neighborhood, + graph, + order, + mode + ) + + res +} + +graph_power_impl <- function( graph, order, directed = FALSE @@ -965,6 +1312,73 @@ turan_impl <- function( res } +weighted_sparsemat_impl <- function( + A, + directed, + attr, + loops = FALSE +) { + # Argument checks + requireNamespace("Matrix", quietly = TRUE); A <- as(as(as(A, "dMatrix"), "generalMatrix"), "CsparseMatrix") + directed <- as.logical(directed) + loops <- as.logical(loops) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_weighted_sparsemat, + A, + directed, + attr, + loops + ) + + res +} + +barabasi_game_impl <- function( + n, + power = 1.0, + m = 1, + outseq = NULL, + outpref = FALSE, + A = 1.0, + directed = TRUE, + algo = BAG, + start_from = NULL +) { + # Argument checks + n <- as.numeric(n) + power <- as.numeric(power) + m <- as.numeric(m) + if (!is.null(outseq)) { + outseq <- as.numeric(outseq) + } + outpref <- as.logical(outpref) + A <- as.numeric(A) + directed <- as.logical(directed) + if (!is.null(start_from)) { + ensure_igraph(start_from) + } + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_barabasi_game, + n, + power, + m, + outseq, + outpref, + A, + directed, + algo, + start_from + ) + + res +} + erdos_renyi_game_gnp_impl <- function( n, p, @@ -1015,6 +1429,29 @@ erdos_renyi_game_gnm_impl <- function( res } +degree_sequence_game_impl <- function( + out_deg, + in_deg = NULL, + method = CONFIGURATION +) { + # Argument checks + out_deg <- as.numeric(out_deg) + if (!is.null(in_deg)) { + in_deg <- as.numeric(in_deg) + } + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_degree_sequence_game, + out_deg, + in_deg, + method + ) + + res +} + growing_random_game_impl <- function( n, m = 1, @@ -1048,6 +1485,225 @@ growing_random_game_impl <- function( res } +barabasi_aging_game_impl <- function( + nodes, + m = 1, + outseq = NULL, + outpref = FALSE, + pa_exp = 1.0, + aging_exp = 0.0, + aging_bin = 1, + zero_deg_appeal = 1.0, + zero_age_appeal = 0.0, + deg_coef = 1.0, + age_coef = 1.0, + directed = TRUE +) { + # Argument checks + nodes <- as.numeric(nodes) + m <- as.numeric(m) + if (!is.null(outseq)) { + outseq <- as.numeric(outseq) + } + outpref <- as.logical(outpref) + pa_exp <- as.numeric(pa_exp) + aging_exp <- as.numeric(aging_exp) + aging_bin <- as.numeric(aging_bin) + zero_deg_appeal <- as.numeric(zero_deg_appeal) + zero_age_appeal <- as.numeric(zero_age_appeal) + deg_coef <- as.numeric(deg_coef) + age_coef <- as.numeric(age_coef) + directed <- as.logical(directed) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_barabasi_aging_game, + nodes, + m, + outseq, + outpref, + pa_exp, + aging_exp, + aging_bin, + zero_deg_appeal, + zero_age_appeal, + deg_coef, + age_coef, + directed + ) + + res +} + +recent_degree_game_impl <- function( + n, + power = 1.0, + window = 1, + m = 1, + outseq = NULL, + outpref = FALSE, + zero_appeal = 1.0, + directed = TRUE +) { + # Argument checks + n <- as.numeric(n) + power <- as.numeric(power) + window <- as.numeric(window) + m <- as.numeric(m) + if (!is.null(outseq)) { + outseq <- as.numeric(outseq) + } + outpref <- as.logical(outpref) + zero_appeal <- as.numeric(zero_appeal) + directed <- as.logical(directed) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_recent_degree_game, + n, + power, + window, + m, + outseq, + outpref, + zero_appeal, + directed + ) + + res +} + +recent_degree_aging_game_impl <- function( + nodes, + m = 1, + outseq = NULL, + outpref = FALSE, + pa_exp = 1.0, + aging_exp = 0.0, + aging_bin = 1, + window = 1, + zero_appeal = 1.0, + directed = TRUE +) { + # Argument checks + nodes <- as.numeric(nodes) + m <- as.numeric(m) + if (!is.null(outseq)) { + outseq <- as.numeric(outseq) + } + outpref <- as.logical(outpref) + pa_exp <- as.numeric(pa_exp) + aging_exp <- as.numeric(aging_exp) + aging_bin <- as.numeric(aging_bin) + window <- as.numeric(window) + zero_appeal <- as.numeric(zero_appeal) + directed <- as.logical(directed) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_recent_degree_aging_game, + nodes, + m, + outseq, + outpref, + pa_exp, + aging_exp, + aging_bin, + window, + zero_appeal, + directed + ) + + res +} + +callaway_traits_game_impl <- function( + nodes, + types, + edges_per_step = 1, + type_dist, + pref_matrix, + directed = FALSE +) { + # Argument checks + nodes <- as.numeric(nodes) + types <- as.numeric(types) + edges_per_step <- as.numeric(edges_per_step) + type_dist <- as.numeric(type_dist) + pref_matrix[] <- as.numeric(pref_matrix) + directed <- as.logical(directed) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_callaway_traits_game, + nodes, + types, + edges_per_step, + type_dist, + pref_matrix, + directed + ) + + res +} + +establishment_game_impl <- function( + nodes, + types, + k = 1, + type_dist, + pref_matrix, + directed = TRUE +) { + # Argument checks + nodes <- as.numeric(nodes) + types <- as.numeric(types) + k <- as.numeric(k) + type_dist <- as.numeric(type_dist) + pref_matrix[] <- as.numeric(pref_matrix) + directed <- as.logical(directed) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_establishment_game, + nodes, + types, + k, + type_dist, + pref_matrix, + directed + ) + + res +} + +grg_game_impl <- function( + nodes, + radius, + torus = FALSE +) { + # Argument checks + nodes <- as.numeric(nodes) + radius <- as.numeric(radius) + torus <- as.logical(torus) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_grg_game, + nodes, + radius, + torus + ) + + res +} + preference_game_impl <- function( nodes, types, @@ -1169,32 +1825,147 @@ rewire_directed_edges_impl <- function( res } -forest_fire_game_impl <- function( +watts_strogatz_game_impl <- function( + dim, + size, + nei, + p, + loops = FALSE, + multiple = FALSE +) { + # Argument checks + dim <- as.numeric(dim) + size <- as.numeric(size) + nei <- as.numeric(nei) + p <- as.numeric(p) + loops <- as.logical(loops) + multiple <- as.logical(multiple) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_watts_strogatz_game, + dim, + size, + nei, + p, + loops, + multiple + ) + + res +} + +lastcit_game_impl <- function( nodes, - fw_prob, - bw_factor = 1, - ambs = 1, + edges_per_node = 1, + agebins = 1, + preference, directed = TRUE ) { # Argument checks nodes <- as.numeric(nodes) - fw_prob <- as.numeric(fw_prob) - bw_factor <- as.numeric(bw_factor) - ambs <- as.numeric(ambs) + edges_per_node <- as.numeric(edges_per_node) + agebins <- as.numeric(agebins) + preference <- as.numeric(preference) directed <- as.logical(directed) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_forest_fire_game, + R_igraph_lastcit_game, nodes, - fw_prob, - bw_factor, - ambs, + edges_per_node, + agebins, + preference, directed ) - if (igraph_opt("add.params")) { + res +} + +cited_type_game_impl <- function( + nodes, + types, + pref, + edges_per_step = 1, + directed = TRUE +) { + # Argument checks + nodes <- as.numeric(nodes) + types <- as.numeric(types) - 1 + pref <- as.numeric(pref) + edges_per_step <- as.numeric(edges_per_step) + directed <- as.logical(directed) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_cited_type_game, + nodes, + types, + pref, + edges_per_step, + directed + ) + + res +} + +citing_cited_type_game_impl <- function( + nodes, + types, + pref, + edges_per_step = 1, + directed = TRUE +) { + # Argument checks + nodes <- as.numeric(nodes) + types <- as.numeric(types) - 1 + pref[] <- as.numeric(pref) + edges_per_step <- as.numeric(edges_per_step) + directed <- as.logical(directed) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_citing_cited_type_game, + nodes, + types, + pref, + edges_per_step, + directed + ) + + res +} + +forest_fire_game_impl <- function( + nodes, + fw_prob, + bw_factor = 1, + ambs = 1, + directed = TRUE +) { + # Argument checks + nodes <- as.numeric(nodes) + fw_prob <- as.numeric(fw_prob) + bw_factor <- as.numeric(bw_factor) + ambs <- as.numeric(ambs) + directed <- as.logical(directed) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_forest_fire_game, + nodes, + fw_prob, + bw_factor, + ambs, + directed + ) + + if (igraph_opt("add.params")) { res$name <- 'Forest fire model' res$fw_prob <- fw_prob res$bw_factor <- bw_factor @@ -1665,6 +2436,94 @@ are_adjacent_impl <- function( res } +are_connected_impl <- function( + graph, + v1, + v2 +) { + # Argument checks + ensure_igraph(graph) + v1 <- as_igraph_vs(graph, v1) + if (length(v1) == 0) { + cli::cli_abort( + "{.arg v1} must specify at least one vertex", + call = rlang::caller_env() + ) + } + v2 <- as_igraph_vs(graph, v2) + if (length(v2) == 0) { + cli::cli_abort( + "{.arg v2} must specify at least one vertex", + call = rlang::caller_env() + ) + } + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_are_connected, + graph, + v1 - 1, + v2 - 1 + ) + + res +} + +diameter_impl <- function( + graph, + directed = TRUE, + unconnected = TRUE +) { + # Argument checks + ensure_igraph(graph) + directed <- as.logical(directed) + unconnected <- as.logical(unconnected) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_diameter, + graph, + directed, + unconnected + ) + + res +} + +diameter_dijkstra_impl <- function( + graph, + weights = NULL, + directed = TRUE, + unconnected = TRUE +) { + # Argument checks + ensure_igraph(graph) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + directed <- as.logical(directed) + unconnected <- as.logical(unconnected) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_diameter_dijkstra, + graph, + weights, + directed, + unconnected + ) + + res +} + closeness_impl <- function( graph, vids = V(graph), @@ -1754,6 +2613,71 @@ closeness_cutoff_impl <- function( res } +distances_impl <- function( + graph, + from = V(graph), + to = V(graph), + mode = c("out", "in", "all", "total") +) { + # Argument checks + ensure_igraph(graph) + from <- as_igraph_vs(graph, from) + to <- as_igraph_vs(graph, to) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_distances, + graph, + from - 1, + to - 1, + mode + ) + + res +} + +distances_cutoff_impl <- function( + graph, + from = V(graph), + to = V(graph), + mode = c("out", "in", "all", "total"), + cutoff = -1 +) { + # Argument checks + ensure_igraph(graph) + from <- as_igraph_vs(graph, from) + to <- as_igraph_vs(graph, to) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + cutoff <- as.numeric(cutoff) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_distances_cutoff, + graph, + from - 1, + to - 1, + mode, + cutoff + ) + + res +} + get_shortest_path_impl <- function( graph, from, @@ -1918,11 +2842,13 @@ get_shortest_path_dijkstra_impl <- function( res } -get_all_shortest_paths_impl <- function( +get_shortest_path_astar_impl <- function( graph, from, to, - mode = c("out", "in", "all", "total") + weights = NULL, + mode = c("out", "in", "all", "total"), + heuristic = NULL ) { # Argument checks ensure_igraph(graph) @@ -1934,6 +2860,20 @@ get_all_shortest_paths_impl <- function( ) } to <- as_igraph_vs(graph, to) + if (length(to) == 0) { + cli::cli_abort( + "{.arg to} must specify at least one vertex", + call = rlang::caller_env() + ) + } + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } mode <- switch_igraph_arg( mode, "out" = 1L, @@ -1945,26 +2885,27 @@ get_all_shortest_paths_impl <- function( on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_get_all_shortest_paths, + R_igraph_get_shortest_path_astar, graph, from - 1, to - 1, - mode + weights, + mode, + heuristic ) if (igraph_opt("return.vs.es")) { - res$vpaths <- lapply(res$vpaths, unsafe_create_vs, graph = graph, verts = V(graph)) + res$vertices <- create_vs(graph, res$vertices) } if (igraph_opt("return.vs.es")) { - res$epaths <- lapply(res$epaths, unsafe_create_es, graph = graph, es = E(graph)) + res$edges <- create_es(graph, res$edges) } res } -get_all_shortest_paths_dijkstra_impl <- function( +get_shortest_paths_impl <- function( graph, from, to = V(graph), - weights = NULL, mode = c("out", "in", "all", "total") ) { # Argument checks @@ -1977,14 +2918,6 @@ get_all_shortest_paths_dijkstra_impl <- function( ) } to <- as_igraph_vs(graph, to) - if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { - weights <- E(graph)$weight - } - if (!is.null(weights) && !all(is.na(weights))) { - weights <- as.numeric(weights) - } else { - weights <- NULL - } mode <- switch_igraph_arg( mode, "out" = 1L, @@ -1996,42 +2929,37 @@ get_all_shortest_paths_dijkstra_impl <- function( on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_get_all_shortest_paths_dijkstra, + R_igraph_get_shortest_paths, graph, from - 1, to - 1, - weights, mode ) if (igraph_opt("return.vs.es")) { - res$vpaths <- lapply(res$vpaths, unsafe_create_vs, graph = graph, verts = V(graph)) + res$vertices <- lapply(res$vertices, unsafe_create_vs, graph = graph, verts = V(graph)) } if (igraph_opt("return.vs.es")) { - res$epaths <- lapply(res$epaths, unsafe_create_es, graph = graph, es = E(graph)) + res$edges <- lapply(res$edges, unsafe_create_es, graph = graph, es = E(graph)) } res } -voronoi_impl <- function( +get_all_shortest_paths_impl <- function( graph, - generators, - ..., - weights = NULL, - mode = c("out", "in", "all", "total"), - tiebreaker = c("random", "first", "last") + from, + to, + mode = c("out", "in", "all", "total") ) { # Argument checks - check_dots_empty() ensure_igraph(graph) - generators <- as_igraph_vs(graph, generators) - if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { - weights <- E(graph)$weight - } - if (!is.null(weights) && !all(is.na(weights))) { - weights <- as.numeric(weights) - } else { - weights <- NULL + from <- as_igraph_vs(graph, from) + if (length(from) == 0) { + cli::cli_abort( + "{.arg from} must specify at least one vertex", + call = rlang::caller_env() + ) } + to <- as_igraph_vs(graph, to) mode <- switch_igraph_arg( mode, "out" = 1L, @@ -2039,40 +2967,44 @@ voronoi_impl <- function( "all" = 3L, "total" = 3L ) - tiebreaker <- switch_igraph_arg(tiebreaker, "first" = 0L, "last" = 1L, "random" = 2L) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_voronoi, + R_igraph_get_all_shortest_paths, graph, - generators - 1, - weights, - mode, - tiebreaker + from - 1, + to - 1, + mode ) - + if (igraph_opt("return.vs.es")) { + res$vpaths <- lapply(res$vpaths, unsafe_create_vs, graph = graph, verts = V(graph)) + } + if (igraph_opt("return.vs.es")) { + res$epaths <- lapply(res$epaths, unsafe_create_es, graph = graph, es = E(graph)) + } res } -get_all_simple_paths_impl <- function( +distances_dijkstra_impl <- function( graph, - from, + from = V(graph), to = V(graph), - cutoff = -1, + weights = NULL, mode = c("out", "in", "all", "total") ) { # Argument checks ensure_igraph(graph) from <- as_igraph_vs(graph, from) - if (length(from) == 0) { - cli::cli_abort( - "{.arg from} must specify at least one vertex", - call = rlang::caller_env() - ) - } to <- as_igraph_vs(graph, to) - cutoff <- as.numeric(cutoff) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } mode <- switch_igraph_arg( mode, "out" = 1L, @@ -2084,31 +3016,29 @@ get_all_simple_paths_impl <- function( on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_get_all_simple_paths, + R_igraph_distances_dijkstra, graph, from - 1, to - 1, - cutoff, + weights, mode ) - if (igraph_opt("return.vs.es")) { - res <- create_vs(graph, res) - } + res } -get_k_shortest_paths_impl <- function( +distances_dijkstra_cutoff_impl <- function( graph, - from, - to, - ..., - k, + from = V(graph), + to = V(graph), weights = NULL, - mode = c("out", "in", "all", "total") + mode = c("out", "in", "all", "total"), + cutoff = -1 ) { # Argument checks - check_dots_empty() ensure_igraph(graph) + from <- as_igraph_vs(graph, from) + to <- as_igraph_vs(graph, to) if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } @@ -2117,21 +3047,6 @@ get_k_shortest_paths_impl <- function( } else { weights <- NULL } - k <- as.numeric(k) - from <- as_igraph_vs(graph, from) - if (length(from) == 0) { - cli::cli_abort( - "{.arg from} must specify at least one vertex", - call = rlang::caller_env() - ) - } - to <- as_igraph_vs(graph, to) - if (length(to) == 0) { - cli::cli_abort( - "{.arg to} must specify at least one vertex", - call = rlang::caller_env() - ) - } mode <- switch_igraph_arg( mode, "out" = 1L, @@ -2139,31 +3054,27 @@ get_k_shortest_paths_impl <- function( "all" = 3L, "total" = 3L ) + cutoff <- as.numeric(cutoff) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_get_k_shortest_paths, + R_igraph_distances_dijkstra_cutoff, graph, - weights, - k, from - 1, to - 1, - mode + weights, + mode, + cutoff ) - if (igraph_opt("return.vs.es")) { - res$vpaths <- lapply(res$vpaths, unsafe_create_vs, graph = graph, verts = V(graph)) - } - if (igraph_opt("return.vs.es")) { - res$epaths <- lapply(res$epaths, unsafe_create_es, graph = graph, es = E(graph)) - } + res } -get_widest_path_impl <- function( +get_shortest_paths_dijkstra_impl <- function( graph, from, - to, + to = V(graph), weights = NULL, mode = c("out", "in", "all", "total") ) { @@ -2177,12 +3088,6 @@ get_widest_path_impl <- function( ) } to <- as_igraph_vs(graph, to) - if (length(to) == 0) { - cli::cli_abort( - "{.arg to} must specify at least one vertex", - call = rlang::caller_env() - ) - } if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } @@ -2202,7 +3107,7 @@ get_widest_path_impl <- function( on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_get_widest_path, + R_igraph_get_shortest_paths_dijkstra, graph, from - 1, to - 1, @@ -2210,15 +3115,15 @@ get_widest_path_impl <- function( mode ) if (igraph_opt("return.vs.es")) { - res$vertices <- create_vs(graph, res$vertices) + res$vertices <- lapply(res$vertices, unsafe_create_vs, graph = graph, verts = V(graph)) } if (igraph_opt("return.vs.es")) { - res$edges <- create_es(graph, res$edges) + res$edges <- lapply(res$edges, unsafe_create_es, graph = graph, es = E(graph)) } res } -get_widest_paths_impl <- function( +get_shortest_paths_bellman_ford_impl <- function( graph, from, to = V(graph), @@ -2254,7 +3159,7 @@ get_widest_paths_impl <- function( on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_get_widest_paths, + R_igraph_get_shortest_paths_bellman_ford, graph, from - 1, to - 1, @@ -2270,9 +3175,9 @@ get_widest_paths_impl <- function( res } -widest_path_widths_dijkstra_impl <- function( +get_all_shortest_paths_dijkstra_impl <- function( graph, - from = V(graph), + from, to = V(graph), weights = NULL, mode = c("out", "in", "all", "total") @@ -2280,6 +3185,12 @@ widest_path_widths_dijkstra_impl <- function( # Argument checks ensure_igraph(graph) from <- as_igraph_vs(graph, from) + if (length(from) == 0) { + cli::cli_abort( + "{.arg from} must specify at least one vertex", + call = rlang::caller_env() + ) + } to <- as_igraph_vs(graph, to) if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight @@ -2300,18 +3211,23 @@ widest_path_widths_dijkstra_impl <- function( on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_widest_path_widths_dijkstra, + R_igraph_get_all_shortest_paths_dijkstra, graph, from - 1, to - 1, weights, mode ) - + if (igraph_opt("return.vs.es")) { + res$vpaths <- lapply(res$vpaths, unsafe_create_vs, graph = graph, verts = V(graph)) + } + if (igraph_opt("return.vs.es")) { + res$epaths <- lapply(res$epaths, unsafe_create_es, graph = graph, es = E(graph)) + } res } -widest_path_widths_floyd_warshall_impl <- function( +distances_bellman_ford_impl <- function( graph, from = V(graph), to = V(graph), @@ -2341,7 +3257,7 @@ widest_path_widths_floyd_warshall_impl <- function( on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_widest_path_widths_floyd_warshall, + R_igraph_distances_bellman_ford, graph, from - 1, to - 1, @@ -2352,14 +3268,16 @@ widest_path_widths_floyd_warshall_impl <- function( res } -spanner_impl <- function( +distances_johnson_impl <- function( graph, - stretch, + from = V(graph), + to = V(graph), weights = NULL ) { # Argument checks ensure_igraph(graph) - stretch <- as.numeric(stretch) + from <- as_igraph_vs(graph, from) + to <- as_igraph_vs(graph, to) if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } @@ -2372,28 +3290,28 @@ spanner_impl <- function( on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_spanner, + R_igraph_distances_johnson, graph, - stretch, + from - 1, + to - 1, weights ) - if (igraph_opt("return.vs.es")) { - res <- create_es(graph, res) - } + res } -betweenness_cutoff_impl <- function( +distances_floyd_warshall_impl <- function( graph, - vids = V(graph), - directed = TRUE, + from = V(graph), + to = V(graph), weights = NULL, - cutoff = -1 + mode = c("out", "in", "all", "total"), + method = AUTOMATIC ) { # Argument checks ensure_igraph(graph) - vids <- as_igraph_vs(graph, vids) - directed <- as.logical(directed) + from <- as_igraph_vs(graph, from) + to <- as_igraph_vs(graph, to) if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } @@ -2402,38 +3320,41 @@ betweenness_cutoff_impl <- function( } else { weights <- NULL } - cutoff <- as.numeric(cutoff) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_betweenness_cutoff, + R_igraph_distances_floyd_warshall, graph, - vids - 1, - directed, + from - 1, + to - 1, weights, - cutoff + mode, + method ) - if (igraph_opt("add.vertex.names") && is_named(graph)) { - names(res) <- vertex_attr(graph, "name", vids) - } + res } -betweenness_subset_impl <- function( +voronoi_impl <- function( graph, - vids = V(graph), - directed = TRUE, - sources = V(graph), - targets = V(graph), - weights = NULL + generators, + ..., + weights = NULL, + mode = c("out", "in", "all", "total"), + tiebreaker = c("random", "first", "last") ) { # Argument checks + check_dots_empty() ensure_igraph(graph) - vids <- as_igraph_vs(graph, vids) - directed <- as.logical(directed) - sources <- as_igraph_vs(graph, sources) - targets <- as_igraph_vs(graph, targets) + generators <- as_igraph_vs(graph, generators) if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } @@ -2442,62 +3363,83 @@ betweenness_subset_impl <- function( } else { weights <- NULL } + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + tiebreaker <- switch_igraph_arg(tiebreaker, "first" = 0L, "last" = 1L, "random" = 2L) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_betweenness_subset, + R_igraph_voronoi, graph, - vids - 1, - directed, - sources - 1, - targets - 1, - weights + generators - 1, + weights, + mode, + tiebreaker ) - if (igraph_opt("add.vertex.names") && is_named(graph)) { - names(res) <- vertex_attr(graph, "name", vids) - } + res } -edge_betweenness_impl <- function( +get_all_simple_paths_impl <- function( graph, - directed = TRUE, - weights = NULL + from, + to = V(graph), + cutoff = -1, + mode = c("out", "in", "all", "total") ) { # Argument checks ensure_igraph(graph) - directed <- as.logical(directed) - if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { - weights <- E(graph)$weight - } - if (!is.null(weights) && !all(is.na(weights))) { - weights <- as.numeric(weights) - } else { - weights <- NULL + from <- as_igraph_vs(graph, from) + if (length(from) == 0) { + cli::cli_abort( + "{.arg from} must specify at least one vertex", + call = rlang::caller_env() + ) } + to <- as_igraph_vs(graph, to) + cutoff <- as.numeric(cutoff) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_edge_betweenness, + R_igraph_get_all_simple_paths, graph, - directed, - weights + from - 1, + to - 1, + cutoff, + mode ) - + if (igraph_opt("return.vs.es")) { + res <- create_vs(graph, res) + } res } -edge_betweenness_cutoff_impl <- function( +get_k_shortest_paths_impl <- function( graph, - directed = TRUE, + from, + to, + ..., + k, weights = NULL, - cutoff = -1 + mode = c("out", "in", "all", "total") ) { # Argument checks + check_dots_empty() ensure_igraph(graph) - directed <- as.logical(directed) if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } @@ -2506,35 +3448,72 @@ edge_betweenness_cutoff_impl <- function( } else { weights <- NULL } - cutoff <- as.numeric(cutoff) + k <- as.numeric(k) + from <- as_igraph_vs(graph, from) + if (length(from) == 0) { + cli::cli_abort( + "{.arg from} must specify at least one vertex", + call = rlang::caller_env() + ) + } + to <- as_igraph_vs(graph, to) + if (length(to) == 0) { + cli::cli_abort( + "{.arg to} must specify at least one vertex", + call = rlang::caller_env() + ) + } + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_edge_betweenness_cutoff, + R_igraph_get_k_shortest_paths, graph, - directed, weights, - cutoff + k, + from - 1, + to - 1, + mode ) - + if (igraph_opt("return.vs.es")) { + res$vpaths <- lapply(res$vpaths, unsafe_create_vs, graph = graph, verts = V(graph)) + } + if (igraph_opt("return.vs.es")) { + res$epaths <- lapply(res$epaths, unsafe_create_es, graph = graph, es = E(graph)) + } res } -edge_betweenness_subset_impl <- function( +get_widest_path_impl <- function( graph, - eids = E(graph), - directed = TRUE, - sources = V(graph), - targets = V(graph), - weights = NULL + from, + to, + weights = NULL, + mode = c("out", "in", "all", "total") ) { # Argument checks ensure_igraph(graph) - eids <- as_igraph_es(graph, eids) - directed <- as.logical(directed) - sources <- as_igraph_vs(graph, sources) - targets <- as_igraph_vs(graph, targets) + from <- as_igraph_vs(graph, from) + if (length(from) == 0) { + cli::cli_abort( + "{.arg from} must specify at least one vertex", + call = rlang::caller_env() + ) + } + to <- as_igraph_vs(graph, to) + if (length(to) == 0) { + cli::cli_abort( + "{.arg to} must specify at least one vertex", + call = rlang::caller_env() + ) + } if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } @@ -2543,40 +3522,50 @@ edge_betweenness_subset_impl <- function( } else { weights <- NULL } + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_edge_betweenness_subset, + R_igraph_get_widest_path, graph, - eids - 1, - directed, - sources - 1, - targets - 1, - weights + from - 1, + to - 1, + weights, + mode ) - + if (igraph_opt("return.vs.es")) { + res$vertices <- create_vs(graph, res$vertices) + } + if (igraph_opt("return.vs.es")) { + res$edges <- create_es(graph, res$edges) + } res } -harmonic_centrality_cutoff_impl <- function( +get_widest_paths_impl <- function( graph, - vids = V(graph), - mode = c("out", "in", "all", "total"), + from, + to = V(graph), weights = NULL, - normalized = FALSE, - cutoff = -1 + mode = c("out", "in", "all", "total") ) { # Argument checks ensure_igraph(graph) - vids <- as_igraph_vs(graph, vids) - mode <- switch_igraph_arg( - mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) + from <- as_igraph_vs(graph, from) + if (length(from) == 0) { + cli::cli_abort( + "{.arg from} must specify at least one vertex", + call = rlang::caller_env() + ) + } + to <- as_igraph_vs(graph, to) if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } @@ -2585,45 +3574,44 @@ harmonic_centrality_cutoff_impl <- function( } else { weights <- NULL } - normalized <- as.logical(normalized) - cutoff <- as.numeric(cutoff) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_harmonic_centrality_cutoff, + R_igraph_get_widest_paths, graph, - vids - 1, - mode, + from - 1, + to - 1, weights, - normalized, - cutoff + mode ) - if (igraph_opt("add.vertex.names") && is_named(graph)) { - names(res) <- vertex_attr(graph, "name", vids) + if (igraph_opt("return.vs.es")) { + res$vertices <- lapply(res$vertices, unsafe_create_vs, graph = graph, verts = V(graph)) + } + if (igraph_opt("return.vs.es")) { + res$edges <- lapply(res$edges, unsafe_create_es, graph = graph, es = E(graph)) } res } -personalized_pagerank_impl <- function( +widest_path_widths_dijkstra_impl <- function( graph, - algo = c("prpack", "arpack"), - vids = V(graph), - directed = TRUE, - damping = 0.85, - personalized = NULL, + from = V(graph), + to = V(graph), weights = NULL, - options = NULL + mode = c("out", "in", "all", "total") ) { # Argument checks ensure_igraph(graph) - algo <- switch_igraph_arg(algo, "arpack" = 1L, "prpack" = 2L) - vids <- as_igraph_vs(graph, vids) - directed <- as.logical(directed) - damping <- as.numeric(damping) - if (!is.null(personalized)) { - personalized <- as.numeric(personalized) - } + from <- as_igraph_vs(graph, from) + to <- as_igraph_vs(graph, to) if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } @@ -2632,53 +3620,39 @@ personalized_pagerank_impl <- function( } else { weights <- NULL } - if (is.null(options)) { - if (algo == 0L) { - options <- list(niter = 1000, eps = 0.001) - } else if (algo == 1L) { - options <- arpack_defaults() - } else { - options <- NULL - } - } + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_personalized_pagerank, + R_igraph_widest_path_widths_dijkstra, graph, - algo, - vids - 1, - directed, - damping, - personalized, + from - 1, + to - 1, weights, - options + mode ) - if (igraph_opt("add.vertex.names") && is_named(graph)) { - names(res$vector) <- vertex_attr(graph, "name", vids) - } + res } -personalized_pagerank_vs_impl <- function( +widest_path_widths_floyd_warshall_impl <- function( graph, - algo = c("prpack", "arpack"), - vids = V(graph), - directed = TRUE, - damping = 0.85, - reset_vids, + from = V(graph), + to = V(graph), weights = NULL, - options = NULL, - details = FALSE + mode = c("out", "in", "all", "total") ) { # Argument checks ensure_igraph(graph) - algo <- switch_igraph_arg(algo, "arpack" = 1L, "prpack" = 2L) - vids <- as_igraph_vs(graph, vids) - directed <- as.logical(directed) - damping <- as.numeric(damping) - reset_vids <- as_igraph_vs(graph, reset_vids) + from <- as_igraph_vs(graph, from) + to <- as_igraph_vs(graph, to) if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } @@ -2687,137 +3661,180 @@ personalized_pagerank_vs_impl <- function( } else { weights <- NULL } - if (is.null(options)) { - if (algo == 0L) { - options <- list(niter = 1000, eps = 0.001) - } else if (algo == 1L) { - options <- arpack_defaults() - } else { - options <- NULL - } - } - + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_personalized_pagerank_vs, + R_igraph_widest_path_widths_floyd_warshall, graph, - algo, - vids - 1, - directed, - damping, - reset_vids - 1, + from - 1, + to - 1, weights, - options + mode ) - if (igraph_opt("add.vertex.names") && is_named(graph)) { - names(res$vector) <- vertex_attr(graph, "name", vids) - } - if (!details) { - res <- res$vector - } + res } -rewire_impl <- function( - rewire, - n, - mode = c("simple", "simple_loops") +spanner_impl <- function( + graph, + stretch, + weights = NULL ) { # Argument checks - ensure_igraph(rewire) - n <- as.numeric(n) - mode <- switch_igraph_arg(mode, "simple" = 0L, "simple_loops" = 1L) + ensure_igraph(graph) + stretch <- as.numeric(stretch) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_rewire, - rewire, - n, - mode + R_igraph_spanner, + graph, + stretch, + weights ) - + if (igraph_opt("return.vs.es")) { + res <- create_es(graph, res) + } res } -induced_subgraph_impl <- function( +subcomponent_impl <- function( graph, - vids, - impl = c("auto", "copy_and_delete", "create_from_scratch") + vid, + mode = c("all", "out", "in", "total") ) { # Argument checks ensure_igraph(graph) - vids <- as_igraph_vs(graph, vids) - impl <- switch_igraph_arg( - impl, - "auto" = 0L, - "copy_and_delete" = 1L, - "create_from_scratch" = 2L + vid <- as_igraph_vs(graph, vid) + if (length(vid) == 0) { + cli::cli_abort( + "{.arg vid} must specify at least one vertex", + call = rlang::caller_env() + ) + } + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L ) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_induced_subgraph, + R_igraph_subcomponent, graph, - vids - 1, - impl + vid - 1, + mode ) - + if (igraph_opt("return.vs.es")) { + res <- create_vs(graph, res) + } res } -subgraph_from_edges_impl <- function( +betweenness_impl <- function( graph, - eids, - delete_vertices = TRUE + vids = V(graph), + directed = TRUE, + weights = NULL ) { # Argument checks ensure_igraph(graph) - eids <- as_igraph_es(graph, eids) - delete_vertices <- as.logical(delete_vertices) + vids <- as_igraph_vs(graph, vids) + directed <- as.logical(directed) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_subgraph_from_edges, + R_igraph_betweenness, graph, - eids - 1, - delete_vertices + vids - 1, + directed, + weights ) - + if (igraph_opt("add.vertex.names") && is_named(graph)) { + names(res) <- vertex_attr(graph, "name", vids) + } res } -reverse_edges_impl <- function( +betweenness_cutoff_impl <- function( graph, - eids = E(graph) + vids = V(graph), + directed = TRUE, + weights = NULL, + cutoff = -1 ) { # Argument checks ensure_igraph(graph) - eids <- as_igraph_es(graph, eids) + vids <- as_igraph_vs(graph, vids) + directed <- as.logical(directed) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + cutoff <- as.numeric(cutoff) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_reverse_edges, + R_igraph_betweenness_cutoff, graph, - eids - 1 + vids - 1, + directed, + weights, + cutoff ) - + if (igraph_opt("add.vertex.names") && is_named(graph)) { + names(res) <- vertex_attr(graph, "name", vids) + } res } -average_path_length_dijkstra_impl <- function( +betweenness_subset_impl <- function( graph, - weights = NULL, + vids = V(graph), directed = TRUE, - unconnected = TRUE, - details = FALSE + sources = V(graph), + targets = V(graph), + weights = NULL ) { # Argument checks ensure_igraph(graph) + vids <- as_igraph_vs(graph, vids) + directed <- as.logical(directed) + sources <- as_igraph_vs(graph, sources) + targets <- as_igraph_vs(graph, targets) if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } @@ -2826,137 +3843,184 @@ average_path_length_dijkstra_impl <- function( } else { weights <- NULL } - directed <- as.logical(directed) - unconnected <- as.logical(unconnected) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_average_path_length_dijkstra, + R_igraph_betweenness_subset, graph, - weights, + vids - 1, directed, - unconnected + sources - 1, + targets - 1, + weights ) - if (!details) { - res <- res$res + if (igraph_opt("add.vertex.names") && is_named(graph)) { + names(res) <- vertex_attr(graph, "name", vids) } res } -path_length_hist_impl <- function( +edge_betweenness_impl <- function( graph, - directed = TRUE + directed = TRUE, + weights = NULL ) { # Argument checks ensure_igraph(graph) directed <- as.logical(directed) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_path_length_hist, + R_igraph_edge_betweenness, graph, - directed + directed, + weights ) res } -simplify_impl <- function( +edge_betweenness_cutoff_impl <- function( graph, - remove_multiple = TRUE, - remove_loops = TRUE, - edge_attr_comb = igraph_opt("edge.attr.comb") + directed = TRUE, + weights = NULL, + cutoff = -1 ) { # Argument checks ensure_igraph(graph) - remove_multiple <- as.logical(remove_multiple) - remove_loops <- as.logical(remove_loops) - edge_attr_comb <- igraph.i.attribute.combination(edge_attr_comb) + directed <- as.logical(directed) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + cutoff <- as.numeric(cutoff) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_simplify, + R_igraph_edge_betweenness_cutoff, graph, - remove_multiple, - remove_loops, - edge_attr_comb + directed, + weights, + cutoff ) res } -transitivity_undirected_impl <- function( +edge_betweenness_subset_impl <- function( graph, - mode = c("nan", "zero") + eids = E(graph), + directed = TRUE, + sources = V(graph), + targets = V(graph), + weights = NULL ) { # Argument checks ensure_igraph(graph) - mode <- switch_igraph_arg(mode, "nan" = 0L, "zero" = 1L) + eids <- as_igraph_es(graph, eids) + directed <- as.logical(directed) + sources <- as_igraph_vs(graph, sources) + targets <- as_igraph_vs(graph, targets) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_transitivity_undirected, + R_igraph_edge_betweenness_subset, graph, - mode + eids - 1, + directed, + sources - 1, + targets - 1, + weights ) res } -transitivity_local_undirected_impl <- function( +harmonic_centrality_impl <- function( graph, vids = V(graph), - mode = c("nan", "zero") -) { + mode = c("out", "in", "all", "total"), + weights = NULL, + normalized = FALSE +) { # Argument checks ensure_igraph(graph) vids <- as_igraph_vs(graph, vids) - mode <- switch_igraph_arg(mode, "nan" = 0L, "zero" = 1L) - - on.exit(.Call(R_igraph_finalizer)) - # Function call - res <- .Call( - R_igraph_transitivity_local_undirected, - graph, - vids - 1, - mode + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L ) - - res -} - -transitivity_avglocal_undirected_impl <- function( - graph, - mode = c("nan", "zero") -) { - # Argument checks - ensure_igraph(graph) - mode <- switch_igraph_arg(mode, "nan" = 0L, "zero" = 1L) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + normalized <- as.logical(normalized) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_transitivity_avglocal_undirected, + R_igraph_harmonic_centrality, graph, - mode + vids - 1, + mode, + weights, + normalized ) - + if (igraph_opt("add.vertex.names") && is_named(graph)) { + names(res) <- vertex_attr(graph, "name", vids) + } res } -transitivity_barrat_impl <- function( +harmonic_centrality_cutoff_impl <- function( graph, vids = V(graph), + mode = c("out", "in", "all", "total"), weights = NULL, - mode = c("nan", "zero") + normalized = FALSE, + cutoff = -1 ) { # Argument checks ensure_igraph(graph) vids <- as_igraph_vs(graph, vids) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } @@ -2965,79 +4029,151 @@ transitivity_barrat_impl <- function( } else { weights <- NULL } - mode <- switch_igraph_arg(mode, "nan" = 0L, "zero" = 1L) + normalized <- as.logical(normalized) + cutoff <- as.numeric(cutoff) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_transitivity_barrat, + R_igraph_harmonic_centrality_cutoff, graph, vids - 1, + mode, weights, - mode + normalized, + cutoff ) - + if (igraph_opt("add.vertex.names") && is_named(graph)) { + names(res) <- vertex_attr(graph, "name", vids) + } res } -ecc_impl <- function( +pagerank_impl <- function( graph, - eids = E(graph), - k = 3, - offset = FALSE, - normalize = TRUE + algo = c("prpack", "arpack"), + vids = V(graph), + directed = TRUE, + damping = 0.85, + weights = NULL, + options = NULL ) { # Argument checks ensure_igraph(graph) - eids <- as_igraph_es(graph, eids) - k <- as.numeric(k) - offset <- as.logical(offset) - normalize <- as.logical(normalize) + algo <- switch_igraph_arg(algo, "arpack" = 1L, "prpack" = 2L) + vids <- as_igraph_vs(graph, vids) + directed <- as.logical(directed) + damping <- as.numeric(damping) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + if (is.null(options)) { + if (algo == 0L) { + options <- list(niter = 1000, eps = 0.001) + } else if (algo == 1L) { + options <- arpack_defaults() + } else { + options <- NULL + } + } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_ecc, + R_igraph_pagerank, graph, - eids - 1, - k, - offset, - normalize + algo, + vids - 1, + directed, + damping, + weights, + options ) - + if (igraph_opt("add.vertex.names") && is_named(graph)) { + names(res$vector) <- vertex_attr(graph, "name", vids) + } res } -reciprocity_impl <- function( +personalized_pagerank_impl <- function( graph, - ignore_loops = TRUE, - mode = c("default", "ratio") + algo = c("prpack", "arpack"), + vids = V(graph), + directed = TRUE, + damping = 0.85, + personalized = NULL, + weights = NULL, + options = NULL ) { # Argument checks ensure_igraph(graph) - ignore_loops <- as.logical(ignore_loops) - mode <- switch_igraph_arg(mode, "default" = 0L, "ratio" = 1L) + algo <- switch_igraph_arg(algo, "arpack" = 1L, "prpack" = 2L) + vids <- as_igraph_vs(graph, vids) + directed <- as.logical(directed) + damping <- as.numeric(damping) + if (!is.null(personalized)) { + personalized <- as.numeric(personalized) + } + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + if (is.null(options)) { + if (algo == 0L) { + options <- list(niter = 1000, eps = 0.001) + } else if (algo == 1L) { + options <- arpack_defaults() + } else { + options <- NULL + } + } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_reciprocity, + R_igraph_personalized_pagerank, graph, - ignore_loops, - mode + algo, + vids - 1, + directed, + damping, + personalized, + weights, + options ) - + if (igraph_opt("add.vertex.names") && is_named(graph)) { + names(res$vector) <- vertex_attr(graph, "name", vids) + } res } -constraint_impl <- function( +personalized_pagerank_vs_impl <- function( graph, + algo = c("prpack", "arpack"), vids = V(graph), - weights = NULL + directed = TRUE, + damping = 0.85, + reset_vids, + weights = NULL, + options = NULL, + details = FALSE ) { # Argument checks ensure_igraph(graph) + algo <- switch_igraph_arg(algo, "arpack" = 1L, "prpack" = 2L) vids <- as_igraph_vs(graph, vids) + directed <- as.logical(directed) + damping <- as.numeric(damping) + reset_vids <- as_igraph_vs(graph, reset_vids) if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } @@ -3046,447 +4182,485 @@ constraint_impl <- function( } else { weights <- NULL } + if (is.null(options)) { + if (algo == 0L) { + options <- list(niter = 1000, eps = 0.001) + } else if (algo == 1L) { + options <- arpack_defaults() + } else { + options <- NULL + } + } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_constraint, + R_igraph_personalized_pagerank_vs, graph, + algo, vids - 1, - weights + directed, + damping, + reset_vids - 1, + weights, + options ) - + if (igraph_opt("add.vertex.names") && is_named(graph)) { + names(res$vector) <- vertex_attr(graph, "name", vids) + } + if (!details) { + res <- res$vector + } res } -maxdegree_impl <- function( - graph, - ..., - v = V(graph), - mode = c("all", "out", "in", "total"), - loops = TRUE +rewire_impl <- function( + rewire, + n, + mode = c("simple", "simple_loops") ) { # Argument checks - check_dots_empty() - ensure_igraph(graph) - v <- as_igraph_vs(graph, v) - mode <- switch_igraph_arg( - mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) - loops <- as.logical(loops) + ensure_igraph(rewire) + n <- as.numeric(n) + mode <- switch_igraph_arg(mode, "simple" = 0L, "simple_loops" = 1L) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_maxdegree, - graph, - v - 1, - mode, - loops + R_igraph_rewire, + rewire, + n, + mode ) res } -density_impl <- function( +induced_subgraph_impl <- function( graph, - loops = FALSE + vids, + impl = c("auto", "copy_and_delete", "create_from_scratch") ) { # Argument checks ensure_igraph(graph) - loops <- as.logical(loops) + vids <- as_igraph_vs(graph, vids) + impl <- switch_igraph_arg( + impl, + "auto" = 0L, + "copy_and_delete" = 1L, + "create_from_scratch" = 2L + ) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_density, + R_igraph_induced_subgraph, graph, - loops + vids - 1, + impl ) res } -mean_degree_impl <- function( +subgraph_from_edges_impl <- function( graph, - loops = TRUE + eids, + delete_vertices = TRUE ) { # Argument checks ensure_igraph(graph) - loops <- as.logical(loops) + eids <- as_igraph_es(graph, eids) + delete_vertices <- as.logical(delete_vertices) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_mean_degree, + R_igraph_subgraph_from_edges, graph, - loops + eids - 1, + delete_vertices ) res } -topological_sorting_impl <- function( +reverse_edges_impl <- function( graph, - mode = c("out", "in", "all", "total") + eids = E(graph) ) { # Argument checks ensure_igraph(graph) - mode <- switch_igraph_arg( - mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) + eids <- as_igraph_es(graph, eids) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_topological_sorting, + R_igraph_reverse_edges, graph, - mode + eids - 1 ) - if (igraph_opt("return.vs.es")) { - res <- create_vs(graph, res) - } + res } -feedback_arc_set_impl <- function( +average_path_length_impl <- function( graph, - weights = NULL, - algo = c("approx_eades", "exact_ip") + directed = TRUE, + unconn = TRUE, + details = FALSE ) { # Argument checks ensure_igraph(graph) - if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { - weights <- E(graph)$weight - } - if (!is.null(weights) && !all(is.na(weights))) { - weights <- as.numeric(weights) - } else { - weights <- NULL - } - algo <- switch_igraph_arg(algo, "exact_ip" = 0L, "approx_eades" = 1L) + directed <- as.logical(directed) + unconn <- as.logical(unconn) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_feedback_arc_set, + R_igraph_average_path_length, graph, - weights, - algo + directed, + unconn ) - if (igraph_opt("return.vs.es")) { - res <- create_es(graph, res) + if (!details) { + res <- res$res } res } -feedback_vertex_set_impl <- function( +average_path_length_dijkstra_impl <- function( graph, weights = NULL, - algo = c("exact_ip") + directed = TRUE, + unconnected = TRUE, + details = FALSE ) { # Argument checks ensure_igraph(graph) - if (is.null(weights) && "weight" %in% vertex_attr_names(graph)) { - weights <- V(graph)$weight + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight } if (!is.null(weights) && !all(is.na(weights))) { weights <- as.numeric(weights) } else { weights <- NULL } - algo <- switch_igraph_arg(algo, "exact_ip" = 0L) + directed <- as.logical(directed) + unconnected <- as.logical(unconnected) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_feedback_vertex_set, + R_igraph_average_path_length_dijkstra, graph, weights, - algo + directed, + unconnected ) - if (igraph_opt("return.vs.es")) { - res <- create_vs(graph, res) + if (!details) { + res <- res$res } res } -is_loop_impl <- function( +path_length_hist_impl <- function( graph, - eids = E(graph) + directed = TRUE ) { # Argument checks ensure_igraph(graph) - eids <- as_igraph_es(graph, eids) + directed <- as.logical(directed) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_is_loop, + R_igraph_path_length_hist, graph, - eids - 1 + directed ) res } -is_dag_impl <- function( - graph +simplify_impl <- function( + graph, + remove_multiple = TRUE, + remove_loops = TRUE, + edge_attr_comb = igraph_opt("edge.attr.comb") ) { # Argument checks ensure_igraph(graph) + remove_multiple <- as.logical(remove_multiple) + remove_loops <- as.logical(remove_loops) + edge_attr_comb <- igraph.i.attribute.combination(edge_attr_comb) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_is_dag, - graph + R_igraph_simplify, + graph, + remove_multiple, + remove_loops, + edge_attr_comb ) res } -is_acyclic_impl <- function( - graph +transitivity_undirected_impl <- function( + graph, + mode = c("nan", "zero") ) { # Argument checks ensure_igraph(graph) + mode <- switch_igraph_arg(mode, "nan" = 0L, "zero" = 1L) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_is_acyclic, - graph + R_igraph_transitivity_undirected, + graph, + mode ) res } -is_simple_impl <- function( - graph +transitivity_local_undirected_impl <- function( + graph, + vids = V(graph), + mode = c("nan", "zero") ) { # Argument checks ensure_igraph(graph) + vids <- as_igraph_vs(graph, vids) + mode <- switch_igraph_arg(mode, "nan" = 0L, "zero" = 1L) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_is_simple, - graph + R_igraph_transitivity_local_undirected, + graph, + vids - 1, + mode ) res } -is_multiple_impl <- function( +transitivity_avglocal_undirected_impl <- function( graph, - eids = E(graph) + mode = c("nan", "zero") ) { # Argument checks ensure_igraph(graph) - eids <- as_igraph_es(graph, eids) + mode <- switch_igraph_arg(mode, "nan" = 0L, "zero" = 1L) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_is_multiple, + R_igraph_transitivity_avglocal_undirected, graph, - eids - 1 + mode ) res } -has_loop_impl <- function( - graph +transitivity_barrat_impl <- function( + graph, + vids = V(graph), + weights = NULL, + mode = c("nan", "zero") ) { # Argument checks ensure_igraph(graph) + vids <- as_igraph_vs(graph, vids) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + mode <- switch_igraph_arg(mode, "nan" = 0L, "zero" = 1L) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_has_loop, - graph + R_igraph_transitivity_barrat, + graph, + vids - 1, + weights, + mode ) res } -has_multiple_impl <- function( - graph +ecc_impl <- function( + graph, + eids = E(graph), + k = 3, + offset = FALSE, + normalize = TRUE ) { # Argument checks ensure_igraph(graph) + eids <- as_igraph_es(graph, eids) + k <- as.numeric(k) + offset <- as.logical(offset) + normalize <- as.logical(normalize) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_has_multiple, - graph + R_igraph_ecc, + graph, + eids - 1, + k, + offset, + normalize ) res } -count_loops_impl <- function( - graph +reciprocity_impl <- function( + graph, + ignore_loops = TRUE, + mode = c("default", "ratio") ) { # Argument checks ensure_igraph(graph) + ignore_loops <- as.logical(ignore_loops) + mode <- switch_igraph_arg(mode, "default" = 0L, "ratio" = 1L) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_count_loops, - graph + R_igraph_reciprocity, + graph, + ignore_loops, + mode ) res } -count_multiple_impl <- function( +constraint_impl <- function( graph, - eids = E(graph) + vids = V(graph), + weights = NULL ) { # Argument checks ensure_igraph(graph) - eids <- as_igraph_es(graph, eids) + vids <- as_igraph_vs(graph, vids) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_count_multiple, + R_igraph_constraint, graph, - eids - 1 + vids - 1, + weights ) res } -girth_impl <- function( - graph +maxdegree_impl <- function( + graph, + ..., + v = V(graph), + mode = c("all", "out", "in", "total"), + loops = TRUE ) { # Argument checks + check_dots_empty() ensure_igraph(graph) + v <- as_igraph_vs(graph, v) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + loops <- as.logical(loops) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_girth, - graph - ) - if (igraph_opt("return.vs.es")) { - res$circle <- create_vs(graph, res$circle) - } - res -} - -is_perfect_impl <- function( - graph -) { - # Argument checks - ensure_igraph(graph) - - on.exit(.Call(R_igraph_finalizer)) - # Function call - res <- .Call( - R_igraph_is_perfect, - graph + R_igraph_maxdegree, + graph, + v - 1, + mode, + loops ) res } -eigenvector_centrality_impl <- function( +density_impl <- function( graph, - directed = FALSE, - scale = TRUE, - weights = NULL, - options = arpack_defaults() + loops = FALSE ) { # Argument checks ensure_igraph(graph) - directed <- as.logical(directed) - scale <- as.logical(scale) - if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { - weights <- E(graph)$weight - } - if (!is.null(weights) && !all(is.na(weights))) { - weights <- as.numeric(weights) - } else { - weights <- NULL - } - options <- modify_list(arpack_defaults(), options) + loops <- as.logical(loops) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_eigenvector_centrality, + R_igraph_density, graph, - directed, - scale, - weights, - options + loops ) - if (igraph_opt("add.vertex.names") && is_named(graph)) { - names(res$vector) <- vertex_attr(graph, "name", V(graph)) - } + res } -hub_and_authority_scores_impl <- function( +mean_degree_impl <- function( graph, - scale = TRUE, - weights = NULL, - options = arpack_defaults() + loops = TRUE ) { # Argument checks ensure_igraph(graph) - scale <- as.logical(scale) - if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { - weights <- E(graph)$weight - } - if (!is.null(weights) && !all(is.na(weights))) { - weights <- as.numeric(weights) - } else { - weights <- NULL - } - options <- modify_list(arpack_defaults(), options) + loops <- as.logical(loops) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_hub_and_authority_scores, + R_igraph_mean_degree, graph, - scale, - weights, - options + loops ) - if (igraph_opt("add.vertex.names") && is_named(graph)) { - names(res$hub) <- vertex_attr(graph, "name", V(graph)) - } - if (igraph_opt("add.vertex.names") && is_named(graph)) { - names(res$authority) <- vertex_attr(graph, "name", V(graph)) - } + res } -unfold_tree_impl <- function( +neighborhood_size_impl <- function( graph, + vids, + order, mode = c("all", "out", "in", "total"), - roots + mindist = 0 ) { # Argument checks ensure_igraph(graph) + vids <- as_igraph_vs(graph, vids) + order <- as.numeric(order) mode <- switch_igraph_arg( mode, "out" = 1L, @@ -3494,103 +4668,126 @@ unfold_tree_impl <- function( "all" = 3L, "total" = 3L ) - roots <- as.numeric(roots) + mindist <- as.numeric(mindist) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_unfold_tree, + R_igraph_neighborhood_size, graph, + vids - 1, + order, mode, - roots + mindist ) res } -is_mutual_impl <- function( +neighborhood_impl <- function( graph, - eids = E(graph), - loops = TRUE + vids, + order, + mode = c("all", "out", "in", "total"), + mindist = 0 ) { # Argument checks ensure_igraph(graph) - eids <- as_igraph_es(graph, eids) - loops <- as.logical(loops) + vids <- as_igraph_vs(graph, vids) + order <- as.numeric(order) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + mindist <- as.numeric(mindist) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_is_mutual, + R_igraph_neighborhood, graph, - eids - 1, - loops + vids - 1, + order, + mode, + mindist ) - + if (igraph_opt("return.vs.es")) { + res <- lapply(res, unsafe_create_vs, graph = graph, verts = V(graph)) + } res } -has_mutual_impl <- function( +neighborhood_graphs_impl <- function( graph, - loops = TRUE + vids, + order, + mode = c("all", "out", "in", "total"), + mindist = 0 ) { # Argument checks ensure_igraph(graph) - loops <- as.logical(loops) + vids <- as_igraph_vs(graph, vids) + order <- as.numeric(order) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + mindist <- as.numeric(mindist) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_has_mutual, + R_igraph_neighborhood_graphs, graph, - loops + vids - 1, + order, + mode, + mindist ) res } -maximum_cardinality_search_impl <- function( - graph +topological_sorting_impl <- function( + graph, + mode = c("out", "in", "all", "total") ) { # Argument checks ensure_igraph(graph) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_maximum_cardinality_search, - graph + R_igraph_topological_sorting, + graph, + mode ) if (igraph_opt("return.vs.es")) { - res$alpham1 <- create_vs(graph, res$alpham1) + res <- create_vs(graph, res) } res } -avg_nearest_neighbor_degree_impl <- function( +feedback_arc_set_impl <- function( graph, - vids = V(graph), - mode = c("all", "out", "in", "total"), - neighbor_degree_mode = c("all", "out", "in", "total"), - weights = NULL + weights = NULL, + algo = c("approx_eades", "exact_ip") ) { # Argument checks ensure_igraph(graph) - vids <- as_igraph_vs(graph, vids) - mode <- switch_igraph_arg( - mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) - neighbor_degree_mode <- switch_igraph_arg( - neighbor_degree_mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } @@ -3599,478 +4796,273 @@ avg_nearest_neighbor_degree_impl <- function( } else { weights <- NULL } + algo <- switch_igraph_arg(algo, "exact_ip" = 0L, "approx_eades" = 1L) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_avg_nearest_neighbor_degree, + R_igraph_feedback_arc_set, graph, - vids - 1, - mode, - neighbor_degree_mode, - weights + weights, + algo ) - if (igraph_opt("add.vertex.names") && is_named(graph)) { - names(res$knn) <- vertex_attr(graph, "name", vids) + if (igraph_opt("return.vs.es")) { + res <- create_es(graph, res) } res } -degree_correlation_vector_impl <- function( +feedback_vertex_set_impl <- function( graph, weights = NULL, - from_mode = c("out", "in", "all", "total"), - to_mode = c("in", "out", "all", "total"), - directed_neighbors = TRUE + algo = c("exact_ip") ) { # Argument checks ensure_igraph(graph) - if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { - weights <- E(graph)$weight + if (is.null(weights) && "weight" %in% vertex_attr_names(graph)) { + weights <- V(graph)$weight } if (!is.null(weights) && !all(is.na(weights))) { weights <- as.numeric(weights) } else { weights <- NULL } - from_mode <- switch_igraph_arg( - from_mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) - to_mode <- switch_igraph_arg( - to_mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) - directed_neighbors <- as.logical(directed_neighbors) + algo <- switch_igraph_arg(algo, "exact_ip" = 0L) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_degree_correlation_vector, + R_igraph_feedback_vertex_set, graph, weights, - from_mode, - to_mode, - directed_neighbors + algo ) - + if (igraph_opt("return.vs.es")) { + res <- create_vs(graph, res) + } res } -rich_club_sequence_impl <- function( +is_loop_impl <- function( graph, - weights = NULL, - vertex_order, - normalized = TRUE, - loops = FALSE, - directed = TRUE + eids = E(graph) ) { # Argument checks ensure_igraph(graph) - if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { - weights <- E(graph)$weight - } - if (!is.null(weights) && !all(is.na(weights))) { - weights <- as.numeric(weights) - } else { - weights <- NULL - } - vertex_order <- as.numeric(vertex_order) - 1 - normalized <- as.logical(normalized) - loops <- as.logical(loops) - directed <- as.logical(directed) + eids <- as_igraph_es(graph, eids) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_rich_club_sequence, + R_igraph_is_loop, graph, - weights, - vertex_order, - normalized, - loops, - directed + eids - 1 ) res } -strength_impl <- function( - graph, - vids = V(graph), - mode = c("all", "out", "in", "total"), - loops = TRUE, - weights = NULL +is_dag_impl <- function( + graph ) { # Argument checks ensure_igraph(graph) - vids <- as_igraph_vs(graph, vids) - mode <- switch_igraph_arg( - mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) - loops <- as.logical(loops) - if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { - weights <- E(graph)$weight - } - if (!is.null(weights) && !all(is.na(weights))) { - weights <- as.numeric(weights) - } else { - weights <- NULL - } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_strength, - graph, - vids - 1, - mode, - loops, - weights + R_igraph_is_dag, + graph ) - if (igraph_opt("add.vertex.names") && is_named(graph)) { - names(res) <- vertex_attr(graph, "name", vids) - } + res } -centralization_impl <- function( - scores, - theoretical_max = 0, - normalized = TRUE +is_acyclic_impl <- function( + graph ) { # Argument checks - scores <- as.numeric(scores) - theoretical_max <- as.numeric(theoretical_max) - normalized <- as.logical(normalized) + ensure_igraph(graph) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_centralization, - scores, - theoretical_max, - normalized + R_igraph_is_acyclic, + graph ) res } -centralization_degree_impl <- function( - graph, - mode = c("all", "out", "in", "total"), - loops = TRUE, - normalized = TRUE +is_simple_impl <- function( + graph ) { # Argument checks ensure_igraph(graph) - mode <- switch_igraph_arg( - mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) - loops <- as.logical(loops) - normalized <- as.logical(normalized) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_centralization_degree, - graph, - mode, - loops, - normalized + R_igraph_is_simple, + graph ) res } -centralization_degree_tmax_impl <- function( - graph = NULL, - nodes = 0, - mode = c("all", "out", "in", "total"), - loops +is_multiple_impl <- function( + graph, + eids = E(graph) ) { # Argument checks - if (!is.null(graph)) { - ensure_igraph(graph) - } - nodes <- as.numeric(nodes) - mode <- switch_igraph_arg( - mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) - loops <- as.logical(loops) + ensure_igraph(graph) + eids <- as_igraph_es(graph, eids) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_centralization_degree_tmax, + R_igraph_is_multiple, graph, - nodes, - mode, - loops + eids - 1 ) res } -centralization_betweenness_impl <- function( - graph, - directed = TRUE, - normalized = TRUE +has_loop_impl <- function( + graph ) { # Argument checks ensure_igraph(graph) - directed <- as.logical(directed) - normalized <- as.logical(normalized) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_centralization_betweenness, - graph, - directed, - normalized + R_igraph_has_loop, + graph ) res } -centralization_betweenness_tmax_impl <- function( - graph = NULL, - nodes = 0, - directed = TRUE +has_multiple_impl <- function( + graph ) { # Argument checks - if (!is.null(graph)) { - ensure_igraph(graph) - } - nodes <- as.numeric(nodes) - directed <- as.logical(directed) + ensure_igraph(graph) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_centralization_betweenness_tmax, - graph, - nodes, - directed + R_igraph_has_multiple, + graph ) res } -centralization_closeness_impl <- function( - graph, - mode = c("out", "in", "all", "total"), - normalized = TRUE +count_loops_impl <- function( + graph ) { # Argument checks ensure_igraph(graph) - mode <- switch_igraph_arg( - mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) - normalized <- as.logical(normalized) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_centralization_closeness, - graph, - mode, - normalized + R_igraph_count_loops, + graph ) res } -centralization_closeness_tmax_impl <- function( - graph = NULL, - nodes = 0, - mode = c("out", "in", "all", "total") +count_multiple_impl <- function( + graph, + eids = E(graph) ) { # Argument checks - if (!is.null(graph)) { - ensure_igraph(graph) - } - nodes <- as.numeric(nodes) - mode <- switch_igraph_arg( - mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) + ensure_igraph(graph) + eids <- as_igraph_es(graph, eids) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_centralization_closeness_tmax, + R_igraph_count_multiple, graph, - nodes, - mode + eids - 1 ) res } -centralization_eigenvector_centrality_impl <- function( - graph, - directed = FALSE, - scale = TRUE, - options = arpack_defaults(), - normalized = TRUE +girth_impl <- function( + graph ) { # Argument checks ensure_igraph(graph) - directed <- as.logical(directed) - scale <- as.logical(scale) - options <- modify_list(arpack_defaults(), options) - normalized <- as.logical(normalized) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_centralization_eigenvector_centrality, - graph, - directed, - scale, - options, - normalized + R_igraph_girth, + graph ) - + if (igraph_opt("return.vs.es")) { + res$circle <- create_vs(graph, res$circle) + } res } -centralization_eigenvector_centrality_tmax_impl <- function( - graph = NULL, - nodes = 0, - directed = FALSE, - scale = TRUE +is_perfect_impl <- function( + graph ) { # Argument checks - if (!is.null(graph)) { - ensure_igraph(graph) - } - nodes <- as.numeric(nodes) - directed <- as.logical(directed) - scale <- as.logical(scale) + ensure_igraph(graph) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_centralization_eigenvector_centrality_tmax, - graph, - nodes, - directed, - scale + R_igraph_is_perfect, + graph ) res } -assortativity_nominal_impl <- function( +add_edge_impl <- function( graph, - types, - directed = TRUE, - normalized = TRUE + from, + to ) { # Argument checks ensure_igraph(graph) - types <- as.numeric(types) - 1 - directed <- as.logical(directed) - normalized <- as.logical(normalized) + from <- as.numeric(from) + to <- as.numeric(to) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_assortativity_nominal, + R_igraph_add_edge, graph, - types, - directed, - normalized + from, + to ) res } -assortativity_impl <- function( +eigenvector_centrality_impl <- function( graph, - values, - values_in = NULL, - directed = TRUE, - normalized = TRUE + directed = FALSE, + scale = TRUE, + weights = NULL, + options = arpack_defaults() ) { # Argument checks ensure_igraph(graph) - values <- as.numeric(values) - if (!is.null(values_in)) { - values_in <- as.numeric(values_in) - } directed <- as.logical(directed) - normalized <- as.logical(normalized) - - on.exit(.Call(R_igraph_finalizer)) - # Function call - res <- .Call( - R_igraph_assortativity, - graph, - values, - values_in, - directed, - normalized - ) - - res -} - -assortativity_degree_impl <- function( - graph, - directed = TRUE -) { - # Argument checks - ensure_igraph(graph) - directed <- as.logical(directed) - - on.exit(.Call(R_igraph_finalizer)) - # Function call - res <- .Call( - R_igraph_assortativity_degree, - graph, - directed - ) - - res -} - -joint_degree_matrix_impl <- function( - graph, - weights = NULL, - max_out_degree = -1, - max_in_degree = -1 -) { - # Argument checks - ensure_igraph(graph) + scale <- as.logical(scale) if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } @@ -4079,34 +5071,33 @@ joint_degree_matrix_impl <- function( } else { weights <- NULL } - max_out_degree <- as.numeric(max_out_degree) - max_in_degree <- as.numeric(max_in_degree) + options <- modify_list(arpack_defaults(), options) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_joint_degree_matrix, + R_igraph_eigenvector_centrality, graph, + directed, + scale, weights, - max_out_degree, - max_in_degree + options ) - + if (igraph_opt("add.vertex.names") && is_named(graph)) { + names(res$vector) <- vertex_attr(graph, "name", V(graph)) + } res } -joint_degree_distribution_impl <- function( +hub_score_impl <- function( graph, + scale = TRUE, weights = NULL, - from_mode = c("out", "in", "all", "total"), - to_mode = c("in", "out", "all", "total"), - directed_neighbors = TRUE, - normalized = TRUE, - max_from_degree = -1, - max_to_degree = -1 + options = arpack_defaults() ) { # Argument checks ensure_igraph(graph) + scale <- as.logical(scale) if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } @@ -4115,52 +5106,32 @@ joint_degree_distribution_impl <- function( } else { weights <- NULL } - from_mode <- switch_igraph_arg( - from_mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) - to_mode <- switch_igraph_arg( - to_mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) - directed_neighbors <- as.logical(directed_neighbors) - normalized <- as.logical(normalized) - max_from_degree <- as.numeric(max_from_degree) - max_to_degree <- as.numeric(max_to_degree) + options <- modify_list(arpack_defaults(), options) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_joint_degree_distribution, + R_igraph_hub_score, graph, + scale, weights, - from_mode, - to_mode, - directed_neighbors, - normalized, - max_from_degree, - max_to_degree + options ) - + if (igraph_opt("add.vertex.names") && is_named(graph)) { + names(res$vector) <- vertex_attr(graph, "name", V(graph)) + } res } -joint_type_distribution_impl <- function( +authority_score_impl <- function( graph, + scale = TRUE, weights = NULL, - from_types, - to_types = NULL, - directed = TRUE, - normalized = TRUE + options = arpack_defaults() ) { # Argument checks ensure_igraph(graph) + scale <- as.logical(scale) if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } @@ -4169,60 +5140,32 @@ joint_type_distribution_impl <- function( } else { weights <- NULL } - from_types <- as.numeric(from_types) - 1 - if (!is.null(to_types)) { - to_types <- as.numeric(to_types) - 1 - } - directed <- as.logical(directed) - normalized <- as.logical(normalized) + options <- modify_list(arpack_defaults(), options) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_joint_type_distribution, + R_igraph_authority_score, graph, + scale, weights, - from_types, - to_types, - directed, - normalized - ) - - res -} - -contract_vertices_impl <- function( - graph, - mapping, - vertex_attr_comb = igraph_opt("vertex.attr.comb") -) { - # Argument checks - ensure_igraph(graph) - mapping <- as.numeric(mapping) - 1 - vertex_attr_comb <- igraph.i.attribute.combination(vertex_attr_comb) - - on.exit(.Call(R_igraph_finalizer)) - # Function call - res <- .Call( - R_igraph_contract_vertices, - graph, - mapping, - vertex_attr_comb + options ) - + if (igraph_opt("add.vertex.names") && is_named(graph)) { + names(res$vector) <- vertex_attr(graph, "name", V(graph)) + } res } -eccentricity_dijkstra_impl <- function( +hub_and_authority_scores_impl <- function( graph, - vids = V(graph), - ..., + scale = TRUE, weights = NULL, - mode = c("all", "out", "in", "total") + options = arpack_defaults() ) { # Argument checks - check_dots_empty() ensure_igraph(graph) + scale <- as.logical(scale) if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } @@ -4231,47 +5174,33 @@ eccentricity_dijkstra_impl <- function( } else { weights <- NULL } - vids <- as_igraph_vs(graph, vids) - mode <- switch_igraph_arg( - mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) + options <- modify_list(arpack_defaults(), options) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_eccentricity_dijkstra, + R_igraph_hub_and_authority_scores, graph, + scale, weights, - vids - 1, - mode + options ) if (igraph_opt("add.vertex.names") && is_named(graph)) { - names(res) <- vertex_attr(graph, "name", vids) + names(res$hub) <- vertex_attr(graph, "name", V(graph)) + } + if (igraph_opt("add.vertex.names") && is_named(graph)) { + names(res$authority) <- vertex_attr(graph, "name", V(graph)) } res } -graph_center_dijkstra_impl <- function( +unfold_tree_impl <- function( graph, - ..., - weights = NULL, - mode = c("all", "out", "in", "total") + mode = c("all", "out", "in", "total"), + roots ) { # Argument checks - check_dots_empty() ensure_igraph(graph) - if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { - weights <- E(graph)$weight - } - if (!is.null(weights) && !all(is.na(weights))) { - weights <- as.numeric(weights) - } else { - weights <- NULL - } mode <- switch_igraph_arg( mode, "out" = 1L, @@ -4279,98 +5208,129 @@ graph_center_dijkstra_impl <- function( "all" = 3L, "total" = 3L ) + roots <- as.numeric(roots) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_graph_center_dijkstra, + R_igraph_unfold_tree, graph, - weights, - mode + mode, + roots ) - if (igraph_opt("return.vs.es")) { - res <- create_vs(graph, res) - } + res } -radius_dijkstra_impl <- function( +is_mutual_impl <- function( graph, - ..., - weights = NULL, - mode = c("all", "out", "in", "total") + eids = E(graph), + loops = TRUE ) { # Argument checks - check_dots_empty() ensure_igraph(graph) - if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { - weights <- E(graph)$weight - } - if (!is.null(weights) && !all(is.na(weights))) { - weights <- as.numeric(weights) - } else { - weights <- NULL - } - mode <- switch_igraph_arg( - mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) + eids <- as_igraph_es(graph, eids) + loops <- as.logical(loops) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_radius_dijkstra, + R_igraph_is_mutual, graph, - weights, - mode + eids - 1, + loops ) res } -pseudo_diameter_impl <- function( +has_mutual_impl <- function( graph, - start_vid, - directed = TRUE, - unconnected = TRUE + loops = TRUE ) { # Argument checks ensure_igraph(graph) - start_vid <- as_igraph_vs(graph, start_vid) - if (length(start_vid) == 0) { - cli::cli_abort( - "{.arg start_vid} must specify at least one vertex", - call = rlang::caller_env() - ) - } - directed <- as.logical(directed) - unconnected <- as.logical(unconnected) + loops <- as.logical(loops) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_pseudo_diameter, + R_igraph_has_mutual, graph, - start_vid - 1, - directed, - unconnected + loops ) res } -pseudo_diameter_dijkstra_impl <- function( - graph, - weights = NULL, - start_vid, - directed = TRUE, - unconnected = TRUE +maximum_cardinality_search_impl <- function( + graph +) { + # Argument checks + ensure_igraph(graph) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_maximum_cardinality_search, + graph + ) + if (igraph_opt("return.vs.es")) { + res$alpham1 <- create_vs(graph, res$alpham1) + } + res +} + +is_chordal_impl <- function( + graph, + alpha = NULL, + alpham1 = NULL +) { + # Argument checks + ensure_igraph(graph) + if (!is.null(alpha)) { + alpha <- as.numeric(alpha) - 1 + } + if (!is.null(alpham1)) { + alpham1 <- as_igraph_vs(graph, alpham1) + } + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_is_chordal, + graph, + alpha, + alpham1 - 1 + ) + + res +} + +avg_nearest_neighbor_degree_impl <- function( + graph, + vids = V(graph), + mode = c("all", "out", "in", "total"), + neighbor_degree_mode = c("all", "out", "in", "total"), + weights = NULL ) { # Argument checks ensure_igraph(graph) + vids <- as_igraph_vs(graph, vids) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + neighbor_degree_mode <- switch_igraph_arg( + neighbor_degree_mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } @@ -4379,34 +5339,77 @@ pseudo_diameter_dijkstra_impl <- function( } else { weights <- NULL } - start_vid <- as_igraph_vs(graph, start_vid) - if (length(start_vid) == 0) { - cli::cli_abort( - "{.arg start_vid} must specify at least one vertex", - call = rlang::caller_env() - ) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_avg_nearest_neighbor_degree, + graph, + vids - 1, + mode, + neighbor_degree_mode, + weights + ) + if (igraph_opt("add.vertex.names") && is_named(graph)) { + names(res$knn) <- vertex_attr(graph, "name", vids) } - directed <- as.logical(directed) - unconnected <- as.logical(unconnected) + res +} + +degree_correlation_vector_impl <- function( + graph, + weights = NULL, + from_mode = c("out", "in", "all", "total"), + to_mode = c("in", "out", "all", "total"), + directed_neighbors = TRUE +) { + # Argument checks + ensure_igraph(graph) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + from_mode <- switch_igraph_arg( + from_mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + to_mode <- switch_igraph_arg( + to_mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + directed_neighbors <- as.logical(directed_neighbors) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_pseudo_diameter_dijkstra, + R_igraph_degree_correlation_vector, graph, weights, - start_vid - 1, - directed, - unconnected + from_mode, + to_mode, + directed_neighbors ) res } -diversity_impl <- function( +rich_club_sequence_impl <- function( graph, weights = NULL, - vids = V(graph) + vertex_order, + normalized = TRUE, + loops = FALSE, + directed = TRUE ) { # Argument checks ensure_igraph(graph) @@ -4418,32 +5421,44 @@ diversity_impl <- function( } else { weights <- NULL } - vids <- as_igraph_vs(graph, vids) + vertex_order <- as.numeric(vertex_order) - 1 + normalized <- as.logical(normalized) + loops <- as.logical(loops) + directed <- as.logical(directed) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_diversity, + R_igraph_rich_club_sequence, graph, weights, - vids - 1 + vertex_order, + normalized, + loops, + directed ) - if (igraph_opt("add.vertex.names") && is_named(graph)) { - names(res) <- vertex_attr(graph, "name", vids) - } + res } -random_walk_impl <- function( +strength_impl <- function( graph, - start, - steps, - weights = NULL, - mode = c("out", "in", "all", "total"), - stuck = c("return", "error") + vids = V(graph), + mode = c("all", "out", "in", "total"), + loops = TRUE, + weights = NULL ) { # Argument checks ensure_igraph(graph) + vids <- as_igraph_vs(graph, vids) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + loops <- as.logical(loops) if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } @@ -4452,13 +5467,1469 @@ random_walk_impl <- function( } else { weights <- NULL } - start <- as_igraph_vs(graph, start) - if (length(start) == 0) { - cli::cli_abort( - "{.arg start} must specify at least one vertex", - call = rlang::caller_env() - ) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_strength, + graph, + vids - 1, + mode, + loops, + weights + ) + if (igraph_opt("add.vertex.names") && is_named(graph)) { + names(res) <- vertex_attr(graph, "name", vids) + } + res +} + +centralization_impl <- function( + scores, + theoretical_max = 0, + normalized = TRUE +) { + # Argument checks + scores <- as.numeric(scores) + theoretical_max <- as.numeric(theoretical_max) + normalized <- as.logical(normalized) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_centralization, + scores, + theoretical_max, + normalized + ) + + res +} + +centralization_degree_impl <- function( + graph, + mode = c("all", "out", "in", "total"), + loops = TRUE, + normalized = TRUE +) { + # Argument checks + ensure_igraph(graph) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + loops <- as.logical(loops) + normalized <- as.logical(normalized) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_centralization_degree, + graph, + mode, + loops, + normalized + ) + + res +} + +centralization_degree_tmax_impl <- function( + graph = NULL, + nodes = 0, + mode = c("all", "out", "in", "total"), + loops +) { + # Argument checks + if (!is.null(graph)) { + ensure_igraph(graph) } + nodes <- as.numeric(nodes) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + loops <- as.logical(loops) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_centralization_degree_tmax, + graph, + nodes, + mode, + loops + ) + + res +} + +centralization_betweenness_impl <- function( + graph, + directed = TRUE, + normalized = TRUE +) { + # Argument checks + ensure_igraph(graph) + directed <- as.logical(directed) + normalized <- as.logical(normalized) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_centralization_betweenness, + graph, + directed, + normalized + ) + + res +} + +centralization_betweenness_tmax_impl <- function( + graph = NULL, + nodes = 0, + directed = TRUE +) { + # Argument checks + if (!is.null(graph)) { + ensure_igraph(graph) + } + nodes <- as.numeric(nodes) + directed <- as.logical(directed) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_centralization_betweenness_tmax, + graph, + nodes, + directed + ) + + res +} + +centralization_closeness_impl <- function( + graph, + mode = c("out", "in", "all", "total"), + normalized = TRUE +) { + # Argument checks + ensure_igraph(graph) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + normalized <- as.logical(normalized) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_centralization_closeness, + graph, + mode, + normalized + ) + + res +} + +centralization_closeness_tmax_impl <- function( + graph = NULL, + nodes = 0, + mode = c("out", "in", "all", "total") +) { + # Argument checks + if (!is.null(graph)) { + ensure_igraph(graph) + } + nodes <- as.numeric(nodes) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_centralization_closeness_tmax, + graph, + nodes, + mode + ) + + res +} + +centralization_eigenvector_centrality_impl <- function( + graph, + directed = FALSE, + scale = TRUE, + options = arpack_defaults(), + normalized = TRUE +) { + # Argument checks + ensure_igraph(graph) + directed <- as.logical(directed) + scale <- as.logical(scale) + options <- modify_list(arpack_defaults(), options) + normalized <- as.logical(normalized) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_centralization_eigenvector_centrality, + graph, + directed, + scale, + options, + normalized + ) + + res +} + +centralization_eigenvector_centrality_tmax_impl <- function( + graph = NULL, + nodes = 0, + directed = FALSE, + scale = TRUE +) { + # Argument checks + if (!is.null(graph)) { + ensure_igraph(graph) + } + nodes <- as.numeric(nodes) + directed <- as.logical(directed) + scale <- as.logical(scale) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_centralization_eigenvector_centrality_tmax, + graph, + nodes, + directed, + scale + ) + + res +} + +assortativity_nominal_impl <- function( + graph, + types, + directed = TRUE, + normalized = TRUE +) { + # Argument checks + ensure_igraph(graph) + types <- as.numeric(types) - 1 + directed <- as.logical(directed) + normalized <- as.logical(normalized) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_assortativity_nominal, + graph, + types, + directed, + normalized + ) + + res +} + +assortativity_impl <- function( + graph, + values, + values_in = NULL, + directed = TRUE, + normalized = TRUE +) { + # Argument checks + ensure_igraph(graph) + values <- as.numeric(values) + if (!is.null(values_in)) { + values_in <- as.numeric(values_in) + } + directed <- as.logical(directed) + normalized <- as.logical(normalized) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_assortativity, + graph, + values, + values_in, + directed, + normalized + ) + + res +} + +assortativity_degree_impl <- function( + graph, + directed = TRUE +) { + # Argument checks + ensure_igraph(graph) + directed <- as.logical(directed) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_assortativity_degree, + graph, + directed + ) + + res +} + +joint_degree_matrix_impl <- function( + graph, + weights = NULL, + max_out_degree = -1, + max_in_degree = -1 +) { + # Argument checks + ensure_igraph(graph) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + max_out_degree <- as.numeric(max_out_degree) + max_in_degree <- as.numeric(max_in_degree) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_joint_degree_matrix, + graph, + weights, + max_out_degree, + max_in_degree + ) + + res +} + +joint_degree_distribution_impl <- function( + graph, + weights = NULL, + from_mode = c("out", "in", "all", "total"), + to_mode = c("in", "out", "all", "total"), + directed_neighbors = TRUE, + normalized = TRUE, + max_from_degree = -1, + max_to_degree = -1 +) { + # Argument checks + ensure_igraph(graph) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + from_mode <- switch_igraph_arg( + from_mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + to_mode <- switch_igraph_arg( + to_mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + directed_neighbors <- as.logical(directed_neighbors) + normalized <- as.logical(normalized) + max_from_degree <- as.numeric(max_from_degree) + max_to_degree <- as.numeric(max_to_degree) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_joint_degree_distribution, + graph, + weights, + from_mode, + to_mode, + directed_neighbors, + normalized, + max_from_degree, + max_to_degree + ) + + res +} + +joint_type_distribution_impl <- function( + graph, + weights = NULL, + from_types, + to_types = NULL, + directed = TRUE, + normalized = TRUE +) { + # Argument checks + ensure_igraph(graph) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + from_types <- as.numeric(from_types) - 1 + if (!is.null(to_types)) { + to_types <- as.numeric(to_types) - 1 + } + directed <- as.logical(directed) + normalized <- as.logical(normalized) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_joint_type_distribution, + graph, + weights, + from_types, + to_types, + directed, + normalized + ) + + res +} + +contract_vertices_impl <- function( + graph, + mapping, + vertex_attr_comb = igraph_opt("vertex.attr.comb") +) { + # Argument checks + ensure_igraph(graph) + mapping <- as.numeric(mapping) - 1 + vertex_attr_comb <- igraph.i.attribute.combination(vertex_attr_comb) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_contract_vertices, + graph, + mapping, + vertex_attr_comb + ) + + res +} + +eccentricity_impl <- function( + graph, + vids = V(graph), + mode = c("all", "out", "in", "total") +) { + # Argument checks + ensure_igraph(graph) + vids <- as_igraph_vs(graph, vids) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_eccentricity, + graph, + vids - 1, + mode + ) + if (igraph_opt("add.vertex.names") && is_named(graph)) { + names(res) <- vertex_attr(graph, "name", vids) + } + res +} + +eccentricity_dijkstra_impl <- function( + graph, + vids = V(graph), + ..., + weights = NULL, + mode = c("all", "out", "in", "total") +) { + # Argument checks + check_dots_empty() + ensure_igraph(graph) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + vids <- as_igraph_vs(graph, vids) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_eccentricity_dijkstra, + graph, + weights, + vids - 1, + mode + ) + if (igraph_opt("add.vertex.names") && is_named(graph)) { + names(res) <- vertex_attr(graph, "name", vids) + } + res +} + +graph_center_impl <- function( + graph, + mode = c("all", "out", "in", "total") +) { + # Argument checks + ensure_igraph(graph) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_graph_center, + graph, + mode + ) + if (igraph_opt("return.vs.es")) { + res <- create_vs(graph, res) + } + res +} + +graph_center_dijkstra_impl <- function( + graph, + ..., + weights = NULL, + mode = c("all", "out", "in", "total") +) { + # Argument checks + check_dots_empty() + ensure_igraph(graph) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_graph_center_dijkstra, + graph, + weights, + mode + ) + if (igraph_opt("return.vs.es")) { + res <- create_vs(graph, res) + } + res +} + +radius_impl <- function( + graph, + mode = c("all", "out", "in", "total") +) { + # Argument checks + ensure_igraph(graph) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_radius, + graph, + mode + ) + + res +} + +radius_dijkstra_impl <- function( + graph, + ..., + weights = NULL, + mode = c("all", "out", "in", "total") +) { + # Argument checks + check_dots_empty() + ensure_igraph(graph) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_radius_dijkstra, + graph, + weights, + mode + ) + + res +} + +pseudo_diameter_impl <- function( + graph, + start_vid, + directed = TRUE, + unconnected = TRUE +) { + # Argument checks + ensure_igraph(graph) + start_vid <- as_igraph_vs(graph, start_vid) + if (length(start_vid) == 0) { + cli::cli_abort( + "{.arg start_vid} must specify at least one vertex", + call = rlang::caller_env() + ) + } + directed <- as.logical(directed) + unconnected <- as.logical(unconnected) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_pseudo_diameter, + graph, + start_vid - 1, + directed, + unconnected + ) + + res +} + +pseudo_diameter_dijkstra_impl <- function( + graph, + weights = NULL, + start_vid, + directed = TRUE, + unconnected = TRUE +) { + # Argument checks + ensure_igraph(graph) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + start_vid <- as_igraph_vs(graph, start_vid) + if (length(start_vid) == 0) { + cli::cli_abort( + "{.arg start_vid} must specify at least one vertex", + call = rlang::caller_env() + ) + } + directed <- as.logical(directed) + unconnected <- as.logical(unconnected) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_pseudo_diameter_dijkstra, + graph, + weights, + start_vid - 1, + directed, + unconnected + ) + + res +} + +diversity_impl <- function( + graph, + weights = NULL, + vids = V(graph) +) { + # Argument checks + ensure_igraph(graph) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + vids <- as_igraph_vs(graph, vids) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_diversity, + graph, + weights, + vids - 1 + ) + if (igraph_opt("add.vertex.names") && is_named(graph)) { + names(res) <- vertex_attr(graph, "name", vids) + } + res +} + +random_walk_impl <- function( + graph, + start, + steps, + weights = NULL, + mode = c("out", "in", "all", "total"), + stuck = c("return", "error") +) { + # Argument checks + ensure_igraph(graph) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + start <- as_igraph_vs(graph, start) + if (length(start) == 0) { + cli::cli_abort( + "{.arg start} must specify at least one vertex", + call = rlang::caller_env() + ) + } + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + steps <- as.numeric(steps) + stuck <- switch_igraph_arg(stuck, "error" = 0L, "return" = 1L) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_random_walk, + graph, + weights, + start - 1, + mode, + steps, + stuck + ) + if (igraph_opt("return.vs.es")) { + res$vertices <- create_vs(graph, res$vertices) + } + if (igraph_opt("return.vs.es")) { + res$edges <- create_es(graph, res$edges) + } + res +} + +random_edge_walk_impl <- function( + graph, + weights = NULL, + start, + mode = c("out", "in", "all", "total"), + steps, + stuck = c("return", "error") +) { + # Argument checks + ensure_igraph(graph) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + start <- as_igraph_vs(graph, start) + if (length(start) == 0) { + cli::cli_abort( + "{.arg start} must specify at least one vertex", + call = rlang::caller_env() + ) + } + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + steps <- as.numeric(steps) + stuck <- switch_igraph_arg(stuck, "error" = 0L, "return" = 1L) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_random_edge_walk, + graph, + weights, + start - 1, + mode, + steps, + stuck + ) + if (igraph_opt("return.vs.es")) { + res <- create_es(graph, res) + } + res +} + +global_efficiency_impl <- function( + graph, + weights = NULL, + directed = TRUE +) { + # Argument checks + ensure_igraph(graph) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + directed <- as.logical(directed) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_global_efficiency, + graph, + weights, + directed + ) + + res +} + +local_efficiency_impl <- function( + graph, + vids = V(graph), + weights = NULL, + directed = TRUE, + mode = c("all", "out", "in", "total") +) { + # Argument checks + ensure_igraph(graph) + vids <- as_igraph_vs(graph, vids) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + directed <- as.logical(directed) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_local_efficiency, + graph, + vids - 1, + weights, + directed, + mode + ) + if (igraph_opt("add.vertex.names") && is_named(graph)) { + names(res) <- vertex_attr(graph, "name", vids) + } + res +} + +average_local_efficiency_impl <- function( + graph, + weights = NULL, + directed = TRUE, + mode = c("all", "out", "in", "total") +) { + # Argument checks + ensure_igraph(graph) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + directed <- as.logical(directed) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_average_local_efficiency, + graph, + weights, + directed, + mode + ) + + res +} + +transitive_closure_dag_impl <- function( + graph +) { + # Argument checks + ensure_igraph(graph) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_transitive_closure_dag, + graph + ) + + res +} + +transitive_closure_impl <- function( + graph +) { + # Argument checks + ensure_igraph(graph) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_transitive_closure, + graph + ) + + res +} + +trussness_impl <- function( + graph +) { + # Argument checks + ensure_igraph(graph) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_trussness, + graph + ) + + res +} + +is_bigraphical_impl <- function( + degrees1, + degrees2, + allowed_edge_types = c("simple", "loops", "multi", "all") +) { + # Argument checks + degrees1 <- as.numeric(degrees1) + degrees2 <- as.numeric(degrees2) + allowed_edge_types <- switch_igraph_arg( + allowed_edge_types, + "simple" = 0L, + "loop" = 1L, + "loops" = 1L, + "multi" = 6L, + "multiple" = 6L, + "all" = 7L + ) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_is_bigraphical, + degrees1, + degrees2, + allowed_edge_types + ) + + res +} + +is_graphical_impl <- function( + out_deg, + in_deg = NULL, + allowed_edge_types = c("simple", "loops", "multi", "all") +) { + # Argument checks + out_deg <- as.numeric(out_deg) + if (!is.null(in_deg)) { + in_deg <- as.numeric(in_deg) + } + allowed_edge_types <- switch_igraph_arg( + allowed_edge_types, + "simple" = 0L, + "loop" = 1L, + "loops" = 1L, + "multi" = 6L, + "multiple" = 6L, + "all" = 7L + ) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_is_graphical, + out_deg, + in_deg, + allowed_edge_types + ) + + res +} + +bfs_impl <- function( + graph, + root, + roots = NULL, + mode = c("out", "in", "all", "total"), + unreachable, + restricted, + callback = NULL +) { + # Argument checks + ensure_igraph(graph) + root <- as_igraph_vs(graph, root) + if (length(root) == 0) { + cli::cli_abort( + "{.arg root} must specify at least one vertex", + call = rlang::caller_env() + ) + } + if (!is.null(roots)) { + roots <- as_igraph_vs(graph, roots) + } + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + unreachable <- as.logical(unreachable) + restricted <- as_igraph_vs(graph, restricted) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_bfs, + graph, + root - 1, + roots - 1, + mode, + unreachable, + restricted - 1, + callback + ) + if (igraph_opt("return.vs.es")) { + res$order <- create_vs(graph, res$order) + } + res +} + +bfs_simple_impl <- function( + graph, + root, + mode = c("out", "in", "all", "total") +) { + # Argument checks + ensure_igraph(graph) + root <- as_igraph_vs(graph, root) + if (length(root) == 0) { + cli::cli_abort( + "{.arg root} must specify at least one vertex", + call = rlang::caller_env() + ) + } + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_bfs_simple, + graph, + root - 1, + mode + ) + if (igraph_opt("return.vs.es")) { + res$order <- create_vs(graph, res$order) + } + res +} + +dfs_impl <- function( + graph, + root, + mode = c("out", "in", "all", "total"), + unreachable, + in_callback = NULL, + out_callback = NULL +) { + # Argument checks + ensure_igraph(graph) + root <- as_igraph_vs(graph, root) + if (length(root) == 0) { + cli::cli_abort( + "{.arg root} must specify at least one vertex", + call = rlang::caller_env() + ) + } + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + unreachable <- as.logical(unreachable) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_dfs, + graph, + root - 1, + mode, + unreachable, + in_callback, + out_callback + ) + if (igraph_opt("return.vs.es")) { + res$order <- create_vs(graph, res$order) + } + if (igraph_opt("return.vs.es")) { + res$order_out <- create_vs(graph, res$order_out) + } + res +} + +bipartite_projection_size_impl <- function( + graph, + types = NULL +) { + # Argument checks + ensure_igraph(graph) + types <- handle_vertex_type_arg(types, graph) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_bipartite_projection_size, + graph, + types + ) + + res +} + +bipartite_projection_impl <- function( + graph, + types, + probe1 = -1 +) { + # Argument checks + ensure_igraph(graph) + types <- handle_vertex_type_arg(types, graph) + probe1 <- as.numeric(probe1) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_bipartite_projection, + graph, + types, + probe1 + ) + + res +} + +create_bipartite_impl <- function( + types, + edges, + directed = FALSE +) { + # Argument checks + types <- handle_vertex_type_arg(types, res$graph) + edges <- as.numeric(edges) + directed <- as.logical(directed) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_create_bipartite, + types, + edges, + directed + ) + + res +} + +biadjacency_impl <- function( + incidence, + directed = FALSE, + mode = c("all", "out", "in", "total"), + multiple = FALSE +) { + # Argument checks + incidence[] <- as.numeric(incidence) + directed <- as.logical(directed) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + multiple <- as.logical(multiple) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_biadjacency, + incidence, + directed, + mode, + multiple + ) + if (igraph_opt("add.vertex.names") && is_named(res$graph)) { + names(res$types) <- vertex_attr(res$graph, "name", V(res$graph)) + } + res +} + +get_biadjacency_impl <- function( + graph, + types +) { + # Argument checks + ensure_igraph(graph) + types <- handle_vertex_type_arg(types, graph) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_get_biadjacency, + graph, + types + ) + + res +} + +is_bipartite_impl <- function( + graph +) { + # Argument checks + ensure_igraph(graph) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_is_bipartite, + graph + ) + if (igraph_opt("add.vertex.names") && is_named(graph)) { + names(res$type) <- vertex_attr(graph, "name", V(graph)) + } + res +} + +bipartite_game_gnp_impl <- function( + n1, + n2, + p, + directed = FALSE, + mode = c("all", "out", "in", "total") +) { + # Argument checks + n1 <- as.numeric(n1) + n2 <- as.numeric(n2) + p <- as.numeric(p) + directed <- as.logical(directed) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_bipartite_game_gnp, + n1, + n2, + p, + directed, + mode + ) + + res +} + +bipartite_game_gnm_impl <- function( + n1, + n2, + m, + directed = FALSE, + mode = c("all", "out", "in", "total") +) { + # Argument checks + n1 <- as.numeric(n1) + n2 <- as.numeric(n2) + m <- as.numeric(m) + directed <- as.logical(directed) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_bipartite_game_gnm, + n1, + n2, + m, + directed, + mode + ) + + res +} + +bipartite_game_impl <- function( + type, + n1, + n2, + p = 0.0, + m = 0, + directed = FALSE, + mode = c("all", "out", "in", "total") +) { + # Argument checks + n1 <- as.numeric(n1) + n2 <- as.numeric(n2) + p <- as.numeric(p) + m <- as.numeric(m) + directed <- as.logical(directed) mode <- switch_igraph_arg( mode, "out" = 1L, @@ -4466,36 +6937,47 @@ random_walk_impl <- function( "all" = 3L, "total" = 3L ) - steps <- as.numeric(steps) - stuck <- switch_igraph_arg(stuck, "error" = 0L, "return" = 1L) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_random_walk, - graph, - weights, - start - 1, - mode, - steps, - stuck + R_igraph_bipartite_game, + type, + n1, + n2, + p, + m, + directed, + mode ) - if (igraph_opt("return.vs.es")) { - res$vertices <- create_vs(graph, res$vertices) - } - if (igraph_opt("return.vs.es")) { - res$edges <- create_es(graph, res$edges) + if (igraph_opt("add.vertex.names") && is_named(res$graph)) { + names(res$types) <- vertex_attr(res$graph, "name", V(res$graph)) } res } -global_efficiency_impl <- function( +get_laplacian_impl <- function( graph, - weights = NULL, - directed = TRUE + mode = c("out", "in", "all", "total"), + normalization = c("unnormalized", "symmetric", "left", "right"), + weights = NULL ) { # Argument checks ensure_igraph(graph) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + normalization <- switch_igraph_arg( + normalization, + "unnormalized" = 0L, + "symmetric" = 1L, + "left" = 2L, + "right" = 3L + ) if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } @@ -4504,30 +6986,42 @@ global_efficiency_impl <- function( } else { weights <- NULL } - directed <- as.logical(directed) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_global_efficiency, + R_igraph_get_laplacian, graph, - weights, - directed + mode, + normalization, + weights ) res } -local_efficiency_impl <- function( +get_laplacian_sparse_impl <- function( graph, - vids = V(graph), - weights = NULL, - directed = TRUE, - mode = c("all", "out", "in", "total") + mode = c("out", "in", "all", "total"), + normalization = c("unnormalized", "symmetric", "left", "right"), + weights = NULL ) { # Argument checks ensure_igraph(graph) - vids <- as_igraph_vs(graph, vids) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + normalization <- switch_igraph_arg( + normalization, + "unnormalized" = 0L, + "symmetric" = 1L, + "left" = 2L, + "right" = 3L + ) if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } @@ -4536,102 +7030,87 @@ local_efficiency_impl <- function( } else { weights <- NULL } - directed <- as.logical(directed) - mode <- switch_igraph_arg( - mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_local_efficiency, + R_igraph_get_laplacian_sparse, graph, - vids - 1, - weights, - directed, - mode + mode, + normalization, + weights ) - if (igraph_opt("add.vertex.names") && is_named(graph)) { - names(res) <- vertex_attr(graph, "name", vids) - } + res } -average_local_efficiency_impl <- function( +connected_components_impl <- function( graph, - weights = NULL, - directed = TRUE, - mode = c("all", "out", "in", "total") + mode = c("weak", "strong"), + details = FALSE ) { # Argument checks ensure_igraph(graph) - if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { - weights <- E(graph)$weight - } - if (!is.null(weights) && !all(is.na(weights))) { - weights <- as.numeric(weights) - } else { - weights <- NULL - } - directed <- as.logical(directed) - mode <- switch_igraph_arg( - mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) + mode <- switch_igraph_arg(mode, "weak" = 1L, "strong" = 2L) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_average_local_efficiency, + R_igraph_connected_components, graph, - weights, - directed, mode ) - + if (!details) { + res <- res$membership + } res } -transitive_closure_dag_impl <- function( - graph +is_connected_impl <- function( + graph, + mode = c("weak", "strong") ) { # Argument checks ensure_igraph(graph) + mode <- switch_igraph_arg(mode, "weak" = 1L, "strong" = 2L) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_transitive_closure_dag, - graph + R_igraph_is_connected, + graph, + mode ) res } -transitive_closure_impl <- function( - graph +decompose_impl <- function( + graph, + mode = c("weak", "strong"), + maxcompno = -1, + minelements = 1 ) { # Argument checks ensure_igraph(graph) + mode <- switch_igraph_arg(mode, "weak" = 1L, "strong" = 2L) + maxcompno <- as.numeric(maxcompno) + minelements <- as.numeric(minelements) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_transitive_closure, - graph + R_igraph_decompose, + graph, + mode, + maxcompno, + minelements ) res } -trussness_impl <- function( +articulation_points_impl <- function( graph ) { # Argument checks @@ -4640,109 +7119,82 @@ trussness_impl <- function( on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_trussness, + R_igraph_articulation_points, graph ) - + if (igraph_opt("return.vs.es")) { + res <- create_vs(graph, res) + } res } -is_graphical_impl <- function( - out_deg, - in_deg = NULL, - allowed_edge_types = c("simple", "loops", "multi", "all") +biconnected_components_impl <- function( + graph ) { # Argument checks - out_deg <- as.numeric(out_deg) - if (!is.null(in_deg)) { - in_deg <- as.numeric(in_deg) - } - allowed_edge_types <- switch_igraph_arg( - allowed_edge_types, - "simple" = 0L, - "loop" = 1L, - "loops" = 1L, - "multi" = 6L, - "multiple" = 6L, - "all" = 7L - ) + ensure_igraph(graph) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_is_graphical, - out_deg, - in_deg, - allowed_edge_types + R_igraph_biconnected_components, + graph ) - + if (igraph_opt("return.vs.es")) { + res$tree_edges <- lapply(res$tree_edges, unsafe_create_es, graph = graph, es = E(graph)) + } + if (igraph_opt("return.vs.es")) { + res$component_edges <- lapply(res$component_edges, unsafe_create_es, graph = graph, es = E(graph)) + } + if (igraph_opt("return.vs.es")) { + res$components <- lapply(res$components, unsafe_create_vs, graph = graph, verts = V(graph)) + } + if (igraph_opt("return.vs.es")) { + res$articulation_points <- create_vs(graph, res$articulation_points) + } res } -bfs_simple_impl <- function( - graph, - root, - mode = c("out", "in", "all", "total") +bridges_impl <- function( + graph ) { # Argument checks ensure_igraph(graph) - root <- as_igraph_vs(graph, root) - if (length(root) == 0) { - cli::cli_abort( - "{.arg root} must specify at least one vertex", - call = rlang::caller_env() - ) - } - mode <- switch_igraph_arg( - mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_bfs_simple, - graph, - root - 1, - mode + R_igraph_bridges, + graph ) if (igraph_opt("return.vs.es")) { - res$order <- create_vs(graph, res$order) + res <- create_es(graph, res) } res } -bipartite_projection_size_impl <- function( - graph, - types = NULL +is_biconnected_impl <- function( + graph ) { # Argument checks ensure_igraph(graph) - types <- handle_vertex_type_arg(types, graph) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_bipartite_projection_size, - graph, - types + R_igraph_is_biconnected, + graph ) res -} - -biadjacency_impl <- function( - incidence, - directed = FALSE, - mode = c("all", "out", "in", "total"), - multiple = FALSE +} + +count_reachable_impl <- function( + graph, + mode = c("out", "in", "all", "total") ) { # Argument checks - incidence[] <- as.numeric(incidence) - directed <- as.logical(directed) + ensure_igraph(graph) mode <- switch_igraph_arg( mode, "out" = 1L, @@ -4750,303 +7202,294 @@ biadjacency_impl <- function( "all" = 3L, "total" = 3L ) - multiple <- as.logical(multiple) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_biadjacency, - incidence, - directed, - mode, - multiple + R_igraph_count_reachable, + graph, + mode ) - if (igraph_opt("add.vertex.names") && is_named(res$graph)) { - names(res$types) <- vertex_attr(res$graph, "name", V(res$graph)) - } + res } -get_biadjacency_impl <- function( +bond_percolation_impl <- function( graph, - types + edge_order = NULL ) { # Argument checks ensure_igraph(graph) - types <- handle_vertex_type_arg(types, graph) + if (!is.null(edge_order)) { + edge_order <- as_igraph_es(graph, edge_order) + } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_get_biadjacency, + R_igraph_bond_percolation, graph, - types + edge_order - 1 ) res } -is_bipartite_impl <- function( - graph +site_percolation_impl <- function( + graph, + vertex_order = NULL ) { # Argument checks ensure_igraph(graph) + if (!is.null(vertex_order)) { + vertex_order <- as_igraph_vs(graph, vertex_order) + } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_is_bipartite, - graph + R_igraph_site_percolation, + graph, + vertex_order - 1 ) - if (igraph_opt("add.vertex.names") && is_named(graph)) { - names(res$type) <- vertex_attr(graph, "name", V(graph)) - } + res } -bipartite_game_gnp_impl <- function( - n1, - n2, - p, - directed = FALSE, - mode = c("all", "out", "in", "total") +edgelist_percolation_impl <- function( + edges ) { # Argument checks - n1 <- as.numeric(n1) - n2 <- as.numeric(n2) - p <- as.numeric(p) - directed <- as.logical(directed) - mode <- switch_igraph_arg( - mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) + on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_bipartite_game_gnp, - n1, - n2, - p, - directed, - mode + R_igraph_edgelist_percolation, + edges ) res } -bipartite_game_gnm_impl <- function( - n1, - n2, - m, - directed = FALSE, - mode = c("all", "out", "in", "total") +is_clique_impl <- function( + graph, + candidate, + directed = FALSE ) { # Argument checks - n1 <- as.numeric(n1) - n2 <- as.numeric(n2) - m <- as.numeric(m) + ensure_igraph(graph) + candidate <- as_igraph_vs(graph, candidate) directed <- as.logical(directed) - mode <- switch_igraph_arg( - mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_bipartite_game_gnm, - n1, - n2, - m, - directed, - mode + R_igraph_is_clique, + graph, + candidate - 1, + directed ) res } -get_laplacian_impl <- function( +cliques_impl <- function( graph, - mode = c("out", "in", "all", "total"), - normalization = c("unnormalized", "symmetric", "left", "right"), - weights = NULL + min = 0, + max = 0 ) { # Argument checks ensure_igraph(graph) - mode <- switch_igraph_arg( - mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) - normalization <- switch_igraph_arg( - normalization, - "unnormalized" = 0L, - "symmetric" = 1L, - "left" = 2L, - "right" = 3L + min <- as.numeric(min) + max <- as.numeric(max) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_cliques, + graph, + min, + max ) - if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { - weights <- E(graph)$weight - } - if (!is.null(weights) && !all(is.na(weights))) { - weights <- as.numeric(weights) - } else { - weights <- NULL + if (igraph_opt("return.vs.es")) { + res <- lapply(res, unsafe_create_vs, graph = graph, verts = V(graph)) } + res +} + +clique_size_hist_impl <- function( + graph, + min_size = 0, + max_size = 0 +) { + # Argument checks + ensure_igraph(graph) + min_size <- as.numeric(min_size) + max_size <- as.numeric(max_size) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_get_laplacian, + R_igraph_clique_size_hist, graph, - mode, - normalization, - weights + min_size, + max_size ) res } -get_laplacian_sparse_impl <- function( - graph, - mode = c("out", "in", "all", "total"), - normalization = c("unnormalized", "symmetric", "left", "right"), - weights = NULL +largest_cliques_impl <- function( + graph ) { # Argument checks ensure_igraph(graph) - mode <- switch_igraph_arg( - mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) - normalization <- switch_igraph_arg( - normalization, - "unnormalized" = 0L, - "symmetric" = 1L, - "left" = 2L, - "right" = 3L + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_largest_cliques, + graph ) - if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { - weights <- E(graph)$weight - } - if (!is.null(weights) && !all(is.na(weights))) { - weights <- as.numeric(weights) - } else { - weights <- NULL + if (igraph_opt("return.vs.es")) { + res <- lapply(res, unsafe_create_vs, graph = graph, verts = V(graph)) } + res +} + +maximal_cliques_impl <- function( + graph, + min_size = 0, + max_size = 0 +) { + # Argument checks + ensure_igraph(graph) + min_size <- as.numeric(min_size) + max_size <- as.numeric(max_size) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_get_laplacian_sparse, + R_igraph_maximal_cliques, graph, - mode, - normalization, - weights + min_size, + max_size ) - + if (igraph_opt("return.vs.es")) { + res <- lapply(res, unsafe_create_vs, graph = graph, verts = V(graph)) + } res } -connected_components_impl <- function( +maximal_cliques_subset_impl <- function( graph, - mode = c("weak", "strong"), + subset, + outfile = NULL, + min_size = 0, + max_size = 0, details = FALSE ) { # Argument checks ensure_igraph(graph) - mode <- switch_igraph_arg(mode, "weak" = 1L, "strong" = 2L) + subset <- as_igraph_vs(graph, subset) + if (!is.null(outfile)) { + check_string(outfile) + + } + min_size <- as.numeric(min_size) + max_size <- as.numeric(max_size) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_connected_components, + R_igraph_maximal_cliques_subset, graph, - mode + subset - 1, + outfile, + min_size, + max_size ) + if (igraph_opt("return.vs.es")) { + res$res <- lapply(res$res, unsafe_create_vs, graph = graph, verts = V(graph)) + } if (!details) { - res <- res$membership + res <- res$res } res } -is_connected_impl <- function( +maximal_cliques_count_impl <- function( graph, - mode = c("weak", "strong") + min_size = 0, + max_size = 0 ) { # Argument checks ensure_igraph(graph) - mode <- switch_igraph_arg(mode, "weak" = 1L, "strong" = 2L) + min_size <- as.numeric(min_size) + max_size <- as.numeric(max_size) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_is_connected, + R_igraph_maximal_cliques_count, graph, - mode + min_size, + max_size ) res } -articulation_points_impl <- function( - graph +maximal_cliques_file_impl <- function( + graph, + res, + min_size = 0, + max_size = 0 ) { # Argument checks ensure_igraph(graph) + check_string(res) + + min_size <- as.numeric(min_size) + max_size <- as.numeric(max_size) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_articulation_points, - graph + R_igraph_maximal_cliques_file, + graph, + res, + min_size, + max_size ) - if (igraph_opt("return.vs.es")) { - res <- create_vs(graph, res) - } + res } -biconnected_components_impl <- function( - graph +maximal_cliques_hist_impl <- function( + graph, + min_size = 0, + max_size = 0 ) { # Argument checks ensure_igraph(graph) + min_size <- as.numeric(min_size) + max_size <- as.numeric(max_size) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_biconnected_components, - graph + R_igraph_maximal_cliques_hist, + graph, + min_size, + max_size ) - if (igraph_opt("return.vs.es")) { - res$tree_edges <- lapply(res$tree_edges, unsafe_create_es, graph = graph, es = E(graph)) - } - if (igraph_opt("return.vs.es")) { - res$component_edges <- lapply(res$component_edges, unsafe_create_es, graph = graph, es = E(graph)) - } - if (igraph_opt("return.vs.es")) { - res$components <- lapply(res$components, unsafe_create_vs, graph = graph, verts = V(graph)) - } - if (igraph_opt("return.vs.es")) { - res$articulation_points <- create_vs(graph, res$articulation_points) - } + res } -bridges_impl <- function( +clique_number_impl <- function( graph ) { # Argument checks @@ -5055,153 +7498,176 @@ bridges_impl <- function( on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_bridges, + R_igraph_clique_number, graph ) - if (igraph_opt("return.vs.es")) { - res <- create_es(graph, res) - } + res } -is_biconnected_impl <- function( - graph +weighted_cliques_impl <- function( + graph, + vertex_weights = NULL, + min_weight = 0, + max_weight = 0, + maximal = FALSE ) { # Argument checks ensure_igraph(graph) + if (is.null(vertex_weights) && "weight" %in% vertex_attr_names(graph)) { + vertex_weights <- V(graph)$weight + } + if (!is.null(vertex_weights) && !all(is.na(vertex_weights))) { + vertex_weights <- as.numeric(vertex_weights) + } else { + vertex_weights <- NULL + } + min_weight <- as.numeric(min_weight) + max_weight <- as.numeric(max_weight) + maximal <- as.logical(maximal) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_is_biconnected, - graph + R_igraph_weighted_cliques, + graph, + vertex_weights, + min_weight, + max_weight, + maximal ) - + if (igraph_opt("return.vs.es")) { + res <- lapply(res, unsafe_create_vs, graph = graph, verts = V(graph)) + } res } -count_reachable_impl <- function( +largest_weighted_cliques_impl <- function( graph, - mode = c("out", "in", "all", "total") + vertex_weights = NULL ) { # Argument checks ensure_igraph(graph) - mode <- switch_igraph_arg( - mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) + if (is.null(vertex_weights) && "weight" %in% vertex_attr_names(graph)) { + vertex_weights <- V(graph)$weight + } + if (!is.null(vertex_weights) && !all(is.na(vertex_weights))) { + vertex_weights <- as.numeric(vertex_weights) + } else { + vertex_weights <- NULL + } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_count_reachable, + R_igraph_largest_weighted_cliques, graph, - mode + vertex_weights ) - + if (igraph_opt("return.vs.es")) { + res <- lapply(res, unsafe_create_vs, graph = graph, verts = V(graph)) + } res } -bond_percolation_impl <- function( +weighted_clique_number_impl <- function( graph, - edge_order = NULL + vertex_weights = NULL ) { # Argument checks ensure_igraph(graph) - if (!is.null(edge_order)) { - edge_order <- as_igraph_es(graph, edge_order) + if (is.null(vertex_weights) && "weight" %in% vertex_attr_names(graph)) { + vertex_weights <- V(graph)$weight + } + if (!is.null(vertex_weights) && !all(is.na(vertex_weights))) { + vertex_weights <- as.numeric(vertex_weights) + } else { + vertex_weights <- NULL } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_bond_percolation, + R_igraph_weighted_clique_number, graph, - edge_order - 1 + vertex_weights ) res } -site_percolation_impl <- function( +is_independent_vertex_set_impl <- function( graph, - vertex_order = NULL + candidate ) { # Argument checks ensure_igraph(graph) - if (!is.null(vertex_order)) { - vertex_order <- as_igraph_vs(graph, vertex_order) - } + candidate <- as_igraph_vs(graph, candidate) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_site_percolation, + R_igraph_is_independent_vertex_set, graph, - vertex_order - 1 + candidate - 1 ) res } -edgelist_percolation_impl <- function( - edges +independent_vertex_sets_impl <- function( + graph, + min_size = 0, + max_size = 0 ) { # Argument checks - + ensure_igraph(graph) + min_size <- as.numeric(min_size) + max_size <- as.numeric(max_size) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_edgelist_percolation, - edges + R_igraph_independent_vertex_sets, + graph, + min_size, + max_size ) - + if (igraph_opt("return.vs.es")) { + res <- lapply(res, unsafe_create_vs, graph = graph, verts = V(graph)) + } res } -is_clique_impl <- function( - graph, - candidate, - directed = FALSE +largest_independent_vertex_sets_impl <- function( + graph ) { # Argument checks ensure_igraph(graph) - candidate <- as_igraph_vs(graph, candidate) - directed <- as.logical(directed) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_is_clique, - graph, - candidate - 1, - directed + R_igraph_largest_independent_vertex_sets, + graph ) - + if (igraph_opt("return.vs.es")) { + res <- lapply(res, unsafe_create_vs, graph = graph, verts = V(graph)) + } res } -cliques_impl <- function( - graph, - min = 0, - max = 0 +maximal_independent_vertex_sets_impl <- function( + graph ) { # Argument checks ensure_igraph(graph) - min <- as.numeric(min) - max <- as.numeric(max) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_cliques, - graph, - min, - max + R_igraph_maximal_independent_vertex_sets, + graph ) if (igraph_opt("return.vs.es")) { res <- lapply(res, unsafe_create_vs, graph = graph, verts = V(graph)) @@ -5209,29 +7675,23 @@ cliques_impl <- function( res } -clique_size_hist_impl <- function( - graph, - min_size = 0, - max_size = 0 +independence_number_impl <- function( + graph ) { # Argument checks ensure_igraph(graph) - min_size <- as.numeric(min_size) - max_size <- as.numeric(max_size) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_clique_size_hist, - graph, - min_size, - max_size + R_igraph_independence_number, + graph ) res } -largest_cliques_impl <- function( +layout_random_impl <- function( graph ) { # Argument checks @@ -5240,238 +7700,367 @@ largest_cliques_impl <- function( on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_largest_cliques, + R_igraph_layout_random, graph ) - if (igraph_opt("return.vs.es")) { - res <- lapply(res, unsafe_create_vs, graph = graph, verts = V(graph)) - } + res } -maximal_cliques_count_impl <- function( +layout_circle_impl <- function( graph, - min_size = 0, - max_size = 0 + order = V(graph) ) { # Argument checks ensure_igraph(graph) - min_size <- as.numeric(min_size) - max_size <- as.numeric(max_size) + order <- as_igraph_vs(graph, order) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_maximal_cliques_count, + R_igraph_layout_circle, graph, - min_size, - max_size + order - 1 ) res } -maximal_cliques_hist_impl <- function( +layout_star_impl <- function( graph, - min_size = 0, - max_size = 0 + center = V(graph)[1], + order = NULL ) { # Argument checks ensure_igraph(graph) - min_size <- as.numeric(min_size) - max_size <- as.numeric(max_size) + center <- as_igraph_vs(graph, center) + if (length(center) == 0) { + cli::cli_abort( + "{.arg center} must specify at least one vertex", + call = rlang::caller_env() + ) + } + if (!is.null(order)) { + order <- as.numeric(order) - 1 + } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_maximal_cliques_hist, + R_igraph_layout_star, graph, - min_size, - max_size + center - 1, + order ) res } -clique_number_impl <- function( - graph +layout_grid_impl <- function( + graph, + width = 0 ) { # Argument checks ensure_igraph(graph) + width <- as.numeric(width) on.exit(.Call(R_igraph_finalizer)) # Function call - res <- .Call( - R_igraph_clique_number, - graph + res <- .Call( + R_igraph_layout_grid, + graph, + width ) res } -weighted_cliques_impl <- function( +layout_grid_3d_impl <- function( graph, - vertex_weights = NULL, - min_weight = 0, - max_weight = 0, - maximal = FALSE + width = 0, + height = 0 ) { # Argument checks ensure_igraph(graph) - if (is.null(vertex_weights) && "weight" %in% vertex_attr_names(graph)) { - vertex_weights <- V(graph)$weight - } - if (!is.null(vertex_weights) && !all(is.na(vertex_weights))) { - vertex_weights <- as.numeric(vertex_weights) - } else { - vertex_weights <- NULL - } - min_weight <- as.numeric(min_weight) - max_weight <- as.numeric(max_weight) - maximal <- as.logical(maximal) + width <- as.numeric(width) + height <- as.numeric(height) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_weighted_cliques, + R_igraph_layout_grid_3d, graph, - vertex_weights, - min_weight, - max_weight, - maximal + width, + height ) - if (igraph_opt("return.vs.es")) { - res <- lapply(res, unsafe_create_vs, graph = graph, verts = V(graph)) - } + res } -largest_weighted_cliques_impl <- function( +layout_fruchterman_reingold_impl <- function( graph, - vertex_weights = NULL + coords = NULL, + use_seed = FALSE, + niter = 500, + start_temp = sqrt(vcount(graph)), + grid = AUTO, + weights = NULL, + minx = NULL, + maxx = NULL, + miny = NULL, + maxy = NULL ) { # Argument checks ensure_igraph(graph) - if (is.null(vertex_weights) && "weight" %in% vertex_attr_names(graph)) { - vertex_weights <- V(graph)$weight + if (!is.null(coords)) { + coords[] <- as.numeric(coords) } - if (!is.null(vertex_weights) && !all(is.na(vertex_weights))) { - vertex_weights <- as.numeric(vertex_weights) + use_seed <- as.logical(use_seed) + niter <- as.numeric(niter) + start_temp <- as.numeric(start_temp) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) } else { - vertex_weights <- NULL + weights <- NULL + } + if (!is.null(minx)) { + minx <- as.numeric(minx) + } + if (!is.null(maxx)) { + maxx <- as.numeric(maxx) } + if (!is.null(miny)) { + miny <- as.numeric(miny) + } + if (!is.null(maxy)) { + maxy <- as.numeric(maxy) + } + if (!missing(coolexp)) { warning("Argument `coolexp' is deprecated and has no effect") } + if (!missing(maxdelta)) { warning("Argument `maxdelta' is deprecated and has no effect") } + if (!missing(area)) { warning("Argument `area' is deprecated and has no effect") } + if (!missing(repulserad)) { warning("Argument `repulserad' is deprecated and has no effect") } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_largest_weighted_cliques, + R_igraph_layout_fruchterman_reingold, graph, - vertex_weights + coords, + use_seed, + niter, + start_temp, + grid, + weights, + minx, + maxx, + miny, + maxy ) - if (igraph_opt("return.vs.es")) { - res <- lapply(res, unsafe_create_vs, graph = graph, verts = V(graph)) - } + res } -weighted_clique_number_impl <- function( +layout_kamada_kawai_impl <- function( graph, - vertex_weights = NULL + coords, + use_seed = FALSE, + maxiter = 500, + epsilon = 0.0, + kkconst = vcount(graph), + weights = NULL, + minx = NULL, + maxx = NULL, + miny = NULL, + maxy = NULL ) { # Argument checks ensure_igraph(graph) - if (is.null(vertex_weights) && "weight" %in% vertex_attr_names(graph)) { - vertex_weights <- V(graph)$weight + coords[] <- as.numeric(coords) + use_seed <- as.logical(use_seed) + maxiter <- as.numeric(maxiter) + epsilon <- as.numeric(epsilon) + kkconst <- as.numeric(kkconst) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight } - if (!is.null(vertex_weights) && !all(is.na(vertex_weights))) { - vertex_weights <- as.numeric(vertex_weights) + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) } else { - vertex_weights <- NULL + weights <- NULL + } + if (!is.null(minx)) { + minx <- as.numeric(minx) + } + if (!is.null(maxx)) { + maxx <- as.numeric(maxx) + } + if (!is.null(miny)) { + miny <- as.numeric(miny) + } + if (!is.null(maxy)) { + maxy <- as.numeric(maxy) } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_weighted_clique_number, + R_igraph_layout_kamada_kawai, graph, - vertex_weights + coords, + use_seed, + maxiter, + epsilon, + kkconst, + weights, + minx, + maxx, + miny, + maxy ) res } -is_independent_vertex_set_impl <- function( +layout_lgl_impl <- function( graph, - candidate + maxiter = 150, + maxdelta = VCOUNT(graph), + area = VCOUNT(graph)^2, + coolexp = 1.5, + repulserad = VCOUNT(graph)^3, + cellsize = VCOUNT(graph), + root = -1 ) { # Argument checks ensure_igraph(graph) - candidate <- as_igraph_vs(graph, candidate) + maxiter <- as.numeric(maxiter) + maxdelta <- as.numeric(maxdelta) + area <- as.numeric(area) + coolexp <- as.numeric(coolexp) + repulserad <- as.numeric(repulserad) + cellsize <- as.numeric(cellsize) + root <- as.numeric(root) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_is_independent_vertex_set, + R_igraph_layout_lgl, graph, - candidate - 1 + maxiter, + maxdelta, + area, + coolexp, + repulserad, + cellsize, + root ) res } -largest_independent_vertex_sets_impl <- function( - graph +layout_reingold_tilford_impl <- function( + graph, + mode = c("out", "in", "all", "total"), + roots = NULL, + rootlevel = NULL ) { # Argument checks ensure_igraph(graph) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + if (!is.null(roots)) { + roots <- as_igraph_vs(graph, roots) + } + if (!is.null(rootlevel)) { + rootlevel <- as.numeric(rootlevel) + } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_largest_independent_vertex_sets, - graph + R_igraph_layout_reingold_tilford, + graph, + mode, + roots - 1, + rootlevel ) - if (igraph_opt("return.vs.es")) { - res <- lapply(res, unsafe_create_vs, graph = graph, verts = V(graph)) - } + res } -maximal_independent_vertex_sets_impl <- function( - graph +layout_reingold_tilford_circular_impl <- function( + graph, + mode = c("out", "in", "all", "total"), + roots = NULL, + rootlevel = NULL ) { # Argument checks ensure_igraph(graph) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + if (!is.null(roots)) { + roots <- as_igraph_vs(graph, roots) + } + if (!is.null(rootlevel)) { + rootlevel <- as.numeric(rootlevel) + } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_maximal_independent_vertex_sets, - graph + R_igraph_layout_reingold_tilford_circular, + graph, + mode, + roots - 1, + rootlevel ) - if (igraph_opt("return.vs.es")) { - res <- lapply(res, unsafe_create_vs, graph = graph, verts = V(graph)) - } + res } -independence_number_impl <- function( - graph +roots_for_tree_layout_impl <- function( + graph, + mode = c("out", "in", "all", "total"), + heuristic ) { # Argument checks ensure_igraph(graph) + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_independence_number, - graph + R_igraph_roots_for_tree_layout, + graph, + mode, + heuristic ) - + if (igraph_opt("return.vs.es")) { + res <- create_vs(graph, res) + } res } -layout_random_impl <- function( +layout_random_3d_impl <- function( graph ) { # Argument checks @@ -5480,159 +8069,297 @@ layout_random_impl <- function( on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_layout_random, + R_igraph_layout_random_3d, graph ) res } -layout_circle_impl <- function( - graph, - order = V(graph) +layout_sphere_impl <- function( + graph ) { # Argument checks ensure_igraph(graph) - order <- as_igraph_vs(graph, order) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_layout_circle, - graph, - order - 1 + R_igraph_layout_sphere, + graph ) res } -layout_star_impl <- function( +layout_fruchterman_reingold_3d_impl <- function( graph, - center = V(graph)[1], - order = NULL + coords = NULL, + use_seed = FALSE, + niter = 500, + start_temp = sqrt(vcount(graph)), + weights = NULL, + minx = NULL, + maxx = NULL, + miny = NULL, + maxy = NULL, + minz = NULL, + maxz = NULL ) { # Argument checks ensure_igraph(graph) - center <- as_igraph_vs(graph, center) - if (length(center) == 0) { - cli::cli_abort( - "{.arg center} must specify at least one vertex", - call = rlang::caller_env() - ) + if (!is.null(coords)) { + coords[] <- as.numeric(coords) } - if (!is.null(order)) { - order <- as.numeric(order) - 1 + use_seed <- as.logical(use_seed) + niter <- as.numeric(niter) + start_temp <- as.numeric(start_temp) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL } + if (!is.null(minx)) { + minx <- as.numeric(minx) + } + if (!is.null(maxx)) { + maxx <- as.numeric(maxx) + } + if (!is.null(miny)) { + miny <- as.numeric(miny) + } + if (!is.null(maxy)) { + maxy <- as.numeric(maxy) + } + if (!is.null(minz)) { + minz <- as.numeric(minz) + } + if (!is.null(maxz)) { + maxz <- as.numeric(maxz) + } + if (!missing(coolexp)) { warning("Argument `coolexp' is deprecated and has no effect") } + if (!missing(maxdelta)) { warning("Argument `maxdelta' is deprecated and has no effect") } + if (!missing(area)) { warning("Argument `area' is deprecated and has no effect") } + if (!missing(repulserad)) { warning("Argument `repulserad' is deprecated and has no effect") } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_layout_star, + R_igraph_layout_fruchterman_reingold_3d, graph, - center - 1, - order + coords, + use_seed, + niter, + start_temp, + weights, + minx, + maxx, + miny, + maxy, + minz, + maxz ) res } -layout_grid_impl <- function( +layout_kamada_kawai_3d_impl <- function( graph, - width = 0 + coords, + use_seed = FALSE, + maxiter = 500, + epsilon = 0.0, + kkconst = vcount(graph), + weights = NULL, + minx = NULL, + maxx = NULL, + miny = NULL, + maxy = NULL, + minz = NULL, + maxz = NULL ) { # Argument checks ensure_igraph(graph) - width <- as.numeric(width) + coords[] <- as.numeric(coords) + use_seed <- as.logical(use_seed) + maxiter <- as.numeric(maxiter) + epsilon <- as.numeric(epsilon) + kkconst <- as.numeric(kkconst) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + if (!is.null(minx)) { + minx <- as.numeric(minx) + } + if (!is.null(maxx)) { + maxx <- as.numeric(maxx) + } + if (!is.null(miny)) { + miny <- as.numeric(miny) + } + if (!is.null(maxy)) { + maxy <- as.numeric(maxy) + } + if (!is.null(minz)) { + minz <- as.numeric(minz) + } + if (!is.null(maxz)) { + maxz <- as.numeric(maxz) + } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_layout_grid, + R_igraph_layout_kamada_kawai_3d, graph, - width + coords, + use_seed, + maxiter, + epsilon, + kkconst, + weights, + minx, + maxx, + miny, + maxy, + minz, + maxz ) res } -layout_grid_3d_impl <- function( +layout_graphopt_impl <- function( graph, - width = 0, - height = 0 + res, + niter = 500, + node_charge = 0.001, + node_mass = 30, + spring_length = 0, + spring_constant = 1, + max_sa_movement = 5, + use_seed = FALSE ) { # Argument checks ensure_igraph(graph) - width <- as.numeric(width) - height <- as.numeric(height) + res[] <- as.numeric(res) + niter <- as.numeric(niter) + node_charge <- as.numeric(node_charge) + node_mass <- as.numeric(node_mass) + spring_length <- as.numeric(spring_length) + spring_constant <- as.numeric(spring_constant) + max_sa_movement <- as.numeric(max_sa_movement) + use_seed <- as.logical(use_seed) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_layout_grid_3d, + R_igraph_layout_graphopt, graph, - width, - height + res, + niter, + node_charge, + node_mass, + spring_length, + spring_constant, + max_sa_movement, + use_seed ) res } -roots_for_tree_layout_impl <- function( +layout_drl_impl <- function( graph, - mode = c("out", "in", "all", "total"), - heuristic + res, + use_seed = FALSE, + options = drl_defaults$default, + weights = NULL ) { # Argument checks ensure_igraph(graph) - mode <- switch_igraph_arg( - mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) + res[] <- as.numeric(res) + use_seed <- as.logical(use_seed) + options <- modify_list(drl_defaults$default, options) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_roots_for_tree_layout, + R_igraph_layout_drl, graph, - mode, - heuristic + res, + use_seed, + options, + weights ) - if (igraph_opt("return.vs.es")) { - res <- create_vs(graph, res) - } + res } -layout_random_3d_impl <- function( - graph +layout_drl_3d_impl <- function( + graph, + res, + use_seed = FALSE, + options = drl_defaults$default, + weights = NULL ) { # Argument checks ensure_igraph(graph) + res[] <- as.numeric(res) + use_seed <- as.logical(use_seed) + options <- modify_list(drl_defaults$default, options) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_layout_random_3d, - graph + R_igraph_layout_drl_3d, + graph, + res, + use_seed, + options, + weights ) res } -layout_sphere_impl <- function( - graph +layout_merge_dla_impl <- function( + graphs, + coords ) { # Argument checks - ensure_igraph(graph) + on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_layout_sphere, - graph + R_igraph_layout_merge_dla, + graphs, + coords ) res @@ -6173,30 +8900,276 @@ similarity_jaccard_pairs_impl <- function( res } -compare_communities_impl <- function( - comm1, - comm2, - method = c("vi", "nmi", "split.join", "rand", "adjusted.rand") +compare_communities_impl <- function( + comm1, + comm2, + method = c("vi", "nmi", "split.join", "rand", "adjusted.rand") +) { + # Argument checks + comm1 <- as.numeric(comm1) + comm2 <- as.numeric(comm2) + method <- switch_igraph_arg( + method, + "vi" = 0L, + "nmi" = 1L, + "split.join" = 2L, + "rand" = 3L, + "adjusted.rand" = 4L + ) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_compare_communities, + comm1, + comm2, + method + ) + + res +} + +community_spinglass_impl <- function( + graph, + weights = NULL, + spins = 25, + parupdate = FALSE, + starttemp = 1, + stoptemp = 0.01, + coolfact = 0.99, + update_rule = CONFIG, + gamma = 1.0, + implementation = ORIG, + lambda = 1.0 +) { + # Argument checks + ensure_igraph(graph) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + spins <- as.numeric(spins) + parupdate <- as.logical(parupdate) + starttemp <- as.numeric(starttemp) + stoptemp <- as.numeric(stoptemp) + coolfact <- as.numeric(coolfact) + gamma <- as.numeric(gamma) + lambda <- as.numeric(lambda) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_community_spinglass, + graph, + weights, + spins, + parupdate, + starttemp, + stoptemp, + coolfact, + update_rule, + gamma, + implementation, + lambda + ) + + res +} + +community_spinglass_single_impl <- function( + graph, + weights = NULL, + vertex, + spins = 25, + update_rule = CONFIG, + gamma = 1.0 +) { + # Argument checks + ensure_igraph(graph) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + vertex <- as.numeric(vertex) + spins <- as.numeric(spins) + gamma <- as.numeric(gamma) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_community_spinglass_single, + graph, + weights, + vertex, + spins, + update_rule, + gamma + ) + + res +} + +community_walktrap_impl <- function( + graph, + weights = NULL, + steps = 4 +) { + # Argument checks + ensure_igraph(graph) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + steps <- as.numeric(steps) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_community_walktrap, + graph, + weights, + steps + ) + + res +} + +community_edge_betweenness_impl <- function( + graph, + directed = TRUE, + weights = NULL +) { + # Argument checks + ensure_igraph(graph) + directed <- as.logical(directed) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_community_edge_betweenness, + graph, + directed, + weights + ) + + res +} + +community_eb_get_merges_impl <- function( + graph, + directed, + edges, + weights = NULL +) { + # Argument checks + ensure_igraph(graph) + directed <- as.logical(directed) + edges <- as_igraph_es(graph, edges) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_community_eb_get_merges, + graph, + directed, + edges - 1, + weights + ) + + res +} + +community_fastgreedy_impl <- function( + graph, + weights = NULL +) { + # Argument checks + ensure_igraph(graph) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_community_fastgreedy, + graph, + weights + ) + + res +} + +community_to_membership_impl <- function( + merges, + nodes, + steps +) { + # Argument checks + nodes <- as.numeric(nodes) + steps <- as.numeric(steps) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_community_to_membership, + merges, + nodes, + steps + ) + + res +} + +le_community_to_membership_impl <- function( + merges, + steps, + membership ) { # Argument checks - comm1 <- as.numeric(comm1) - comm2 <- as.numeric(comm2) - method <- switch_igraph_arg( - method, - "vi" = 0L, - "nmi" = 1L, - "split.join" = 2L, - "rand" = 3L, - "adjusted.rand" = 4L - ) + steps <- as.numeric(steps) + membership <- as.numeric(membership) on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_compare_communities, - comm1, - comm2, - method + R_igraph_le_community_to_membership, + merges, + steps, + membership ) res @@ -6269,6 +9242,60 @@ modularity_matrix_impl <- function( res } +reindex_membership_impl <- function( + membership +) { + # Argument checks + membership <- as.numeric(membership) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_reindex_membership, + membership + ) + + res +} + +community_leading_eigenvector_impl <- function( + graph, + weights = NULL, + steps = -1, + options = arpack_defaults(), + start = FALSE, + callback = NULL +) { + # Argument checks + ensure_igraph(graph) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + steps <- as.numeric(steps) + options <- modify_list(arpack_defaults(), options) + start <- as.logical(start) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_community_leading_eigenvector, + graph, + weights, + steps, + options, + start, + callback + ) + + class(res) <- "igraph.eigenc" + res +} + community_fluid_communities_impl <- function( graph, no_of_communities @@ -6499,6 +9526,48 @@ community_infomap_impl <- function( res } +community_voronoi_impl <- function( + graph, + lengths = NULL, + weights = NULL, + mode = c("out", "in", "all", "total"), + radius = -1 +) { + # Argument checks + ensure_igraph(graph) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + mode <- switch_igraph_arg( + mode, + "out" = 1L, + "in" = 2L, + "all" = 3L, + "total" = 3L + ) + radius <- as.numeric(radius) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_community_voronoi, + graph, + lengths, + weights, + mode, + radius + ) + if (igraph_opt("return.vs.es")) { + res$generators <- create_vs(graph, res$generators) + } + res +} + graphlets_impl <- function( graph, weights = NULL, @@ -6519,7 +9588,7 @@ graphlets_impl <- function( on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - Rx_igraph_graphlets, + R_igraph_graphlets, graph, weights, niter @@ -6829,6 +9898,38 @@ from_hrg_dendrogram_impl <- function( res } +get_adjacency_impl <- function( + graph, + type = c("both", "upper", "lower"), + weights = NULL, + loops = c("once", "none", "twice") +) { + # Argument checks + ensure_igraph(graph) + type <- switch_igraph_arg(type, "upper" = 0L, "lower" = 1L, "both" = 2L) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + loops <- switch_igraph_arg(loops, "none" = 0L, "twice" = 1L, "once" = 2L) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_get_adjacency, + graph, + type, + weights, + loops + ) + + res +} + get_adjacency_sparse_impl <- function( graph, type = c("both", "upper", "lower"), @@ -6985,6 +10086,83 @@ to_undirected_impl <- function( res } +read_graph_edgelist_impl <- function( + instream, + n = 0, + directed = TRUE +) { + # Argument checks + check_string(instream) + + n <- as.numeric(n) + directed <- as.logical(directed) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_read_graph_edgelist, + instream, + n, + directed + ) + + res +} + +read_graph_ncol_impl <- function( + instream, + predefnames = NULL, + names = TRUE, + weights = True, + directed = TRUE +) { + # Argument checks + check_string(instream) + + names <- as.logical(names) + weights <- switch_igraph_arg(weights, "no" = 0L, "yes" = 1L, "auto" = 2L) + directed <- as.logical(directed) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_read_graph_ncol, + instream, + predefnames, + names, + weights, + directed + ) + + res +} + +read_graph_lgl_impl <- function( + instream, + names = TRUE, + weights = True, + directed = TRUE +) { + # Argument checks + check_string(instream) + + names <- as.logical(names) + weights <- switch_igraph_arg(weights, "no" = 0L, "yes" = 1L, "auto" = 2L) + directed <- as.logical(directed) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_read_graph_lgl, + instream, + names, + weights, + directed + ) + + res +} + read_graph_pajek_impl <- function( instream ) { @@ -7022,6 +10200,26 @@ read_graph_graphml_impl <- function( res } +read_graph_dimacs_flow_impl <- function( + instream, + directed = TRUE +) { + # Argument checks + check_string(instream) + + directed <- as.logical(directed) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_read_graph_dimacs_flow, + instream, + directed + ) + + res +} + read_graph_graphdb_impl <- function( instream, directed = FALSE @@ -7099,6 +10297,57 @@ write_graph_edgelist_impl <- function( res } +write_graph_ncol_impl <- function( + graph, + outstream, + names = "name", + weights = "weight" +) { + # Argument checks + ensure_igraph(graph) + check_string(outstream) + + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_write_graph_ncol, + graph, + outstream, + names, + weights + ) + + res +} + +write_graph_lgl_impl <- function( + graph, + outstream, + names = "name", + weights = "weight", + isolates = TRUE +) { + # Argument checks + ensure_igraph(graph) + check_string(outstream) + + isolates <- as.logical(isolates) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_write_graph_lgl, + graph, + outstream, + names, + weights, + isolates + ) + + res +} + write_graph_leda_impl <- function( graph, outstream, @@ -7166,6 +10415,47 @@ write_graph_pajek_impl <- function( res } +write_graph_dimacs_flow_impl <- function( + graph, + outstream, + source = 0, + target = 0, + capacity +) { + # Argument checks + ensure_igraph(graph) + check_string(outstream) + + source <- as_igraph_vs(graph, source) + if (length(source) == 0) { + cli::cli_abort( + "{.arg source} must specify at least one vertex", + call = rlang::caller_env() + ) + } + target <- as_igraph_vs(graph, target) + if (length(target) == 0) { + cli::cli_abort( + "{.arg target} must specify at least one vertex", + call = rlang::caller_env() + ) + } + capacity <- as.numeric(capacity) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_write_graph_dimacs_flow, + graph, + outstream, + source - 1, + target - 1, + capacity + ) + + res +} + write_graph_gml_impl <- function( graph, outstream, @@ -7679,6 +10969,22 @@ disjoint_union_impl <- function( res } +disjoint_union_many_impl <- function( + graphs +) { + # Argument checks + + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_disjoint_union_many, + graphs + ) + + res +} + join_impl <- function( left, right @@ -7717,6 +11023,22 @@ union_impl <- function( res } +union_many_impl <- function( + graphs +) { + # Argument checks + + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_union_many, + graphs + ) + + res +} + intersection_impl <- function( left, right @@ -7736,6 +11058,22 @@ intersection_impl <- function( res } +intersection_many_impl <- function( + graphs +) { + # Argument checks + + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_intersection_many, + graphs + ) + + res +} + difference_impl <- function( orig, sub @@ -7974,6 +11312,50 @@ maxflow_impl <- function( res } +maxflow_value_impl <- function( + graph, + source, + target, + capacity = NULL +) { + # Argument checks + ensure_igraph(graph) + source <- as_igraph_vs(graph, source) + if (length(source) == 0) { + cli::cli_abort( + "{.arg source} must specify at least one vertex", + call = rlang::caller_env() + ) + } + target <- as_igraph_vs(graph, target) + if (length(target) == 0) { + cli::cli_abort( + "{.arg target} must specify at least one vertex", + call = rlang::caller_env() + ) + } + if (is.null(capacity) && "capacity" %in% edge_attr_names(graph)) { + capacity <- E(graph)$capacity + } + if (!is.null(capacity) && !all(is.na(capacity))) { + capacity <- as.numeric(capacity) + } else { + capacity <- NULL + } + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_maxflow_value, + graph, + source - 1, + target - 1, + capacity + ) + + res +} + mincut_impl <- function( graph, capacity = NULL @@ -8144,39 +11526,221 @@ st_mincut_impl <- function( res } +st_mincut_value_impl <- function( + graph, + source, + target, + capacity = NULL +) { + # Argument checks + ensure_igraph(graph) + source <- as_igraph_vs(graph, source) + if (length(source) == 0) { + cli::cli_abort( + "{.arg source} must specify at least one vertex", + call = rlang::caller_env() + ) + } + target <- as_igraph_vs(graph, target) + if (length(target) == 0) { + cli::cli_abort( + "{.arg target} must specify at least one vertex", + call = rlang::caller_env() + ) + } + if (is.null(capacity) && "capacity" %in% edge_attr_names(graph)) { + capacity <- E(graph)$capacity + } + if (!is.null(capacity) && !all(is.na(capacity))) { + capacity <- as.numeric(capacity) + } else { + capacity <- NULL + } + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_st_mincut_value, + graph, + source - 1, + target - 1, + capacity + ) + + res +} + +st_vertex_connectivity_impl <- function( + graph, + source, + target, + neighbors = NUMBER_OF_NODES +) { + # Argument checks + ensure_igraph(graph) + source <- as_igraph_vs(graph, source) + if (length(source) == 0) { + cli::cli_abort( + "{.arg source} must specify at least one vertex", + call = rlang::caller_env() + ) + } + target <- as_igraph_vs(graph, target) + if (length(target) == 0) { + cli::cli_abort( + "{.arg target} must specify at least one vertex", + call = rlang::caller_env() + ) + } + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_st_vertex_connectivity, + graph, + source - 1, + target - 1, + neighbors + ) + + res +} + vertex_connectivity_impl <- function( graph, checks = TRUE ) { # Argument checks ensure_igraph(graph) - checks <- as.logical(checks) + checks <- as.logical(checks) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_vertex_connectivity, + graph, + checks + ) + + res +} + +st_edge_connectivity_impl <- function( + graph, + source, + target +) { + # Argument checks + ensure_igraph(graph) + source <- as_igraph_vs(graph, source) + if (length(source) == 0) { + cli::cli_abort( + "{.arg source} must specify at least one vertex", + call = rlang::caller_env() + ) + } + target <- as_igraph_vs(graph, target) + if (length(target) == 0) { + cli::cli_abort( + "{.arg target} must specify at least one vertex", + call = rlang::caller_env() + ) + } + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_st_edge_connectivity, + graph, + source - 1, + target - 1 + ) + + res +} + +edge_connectivity_impl <- function( + graph, + checks = TRUE +) { + # Argument checks + ensure_igraph(graph) + checks <- as.logical(checks) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_edge_connectivity, + graph, + checks + ) + + res +} + +edge_disjoint_paths_impl <- function( + graph, + source, + target +) { + # Argument checks + ensure_igraph(graph) + source <- as_igraph_vs(graph, source) + if (length(source) == 0) { + cli::cli_abort( + "{.arg source} must specify at least one vertex", + call = rlang::caller_env() + ) + } + target <- as_igraph_vs(graph, target) + if (length(target) == 0) { + cli::cli_abort( + "{.arg target} must specify at least one vertex", + call = rlang::caller_env() + ) + } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_vertex_connectivity, + R_igraph_edge_disjoint_paths, graph, - checks + source - 1, + target - 1 ) res } -edge_connectivity_impl <- function( +vertex_disjoint_paths_impl <- function( graph, - checks = TRUE + source, + target ) { # Argument checks ensure_igraph(graph) - checks <- as.logical(checks) + source <- as_igraph_vs(graph, source) + if (length(source) == 0) { + cli::cli_abort( + "{.arg source} must specify at least one vertex", + call = rlang::caller_env() + ) + } + target <- as_igraph_vs(graph, target) + if (length(target) == 0) { + cli::cli_abort( + "{.arg target} must specify at least one vertex", + call = rlang::caller_env() + ) + } on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - R_igraph_edge_connectivity, + R_igraph_vertex_disjoint_paths, graph, - checks + source - 1, + target - 1 ) res @@ -9238,6 +12802,22 @@ automorphism_group_impl <- function( res } +subisomorphic_lad_impl <- function( + graph +) { + # Argument checks + ensure_igraph(graph) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_subisomorphic_lad, + graph + ) + + res +} + simplify_and_colorize_impl <- function( graph ) { @@ -9381,7 +12961,7 @@ adjacency_spectral_embedding_impl <- function( on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - Rx_igraph_adjacency_spectral_embedding, + R_igraph_adjacency_spectral_embedding, graph, no, weights, @@ -9424,7 +13004,7 @@ laplacian_spectral_embedding_impl <- function( on.exit(.Call(R_igraph_finalizer)) # Function call res <- .Call( - Rx_igraph_laplacian_spectral_embedding, + R_igraph_laplacian_spectral_embedding, graph, no, weights, @@ -9539,6 +13119,28 @@ running_mean_impl <- function( res } +random_sample_impl <- function( + l, + h, + length +) { + # Argument checks + l <- as.numeric(l) + h <- as.numeric(h) + length <- as.numeric(length) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_random_sample, + l, + h, + length + ) + + res +} + convex_hull_2d_impl <- function( data ) { @@ -9571,6 +13173,132 @@ dim_select_impl <- function( res } +almost_equals_impl <- function( + a, + b, + eps +) { + # Argument checks + + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_almost_equals, + a, + b, + eps + ) + + res +} + +cmp_epsilon_impl <- function( + a, + b, + eps +) { + # Argument checks + + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_cmp_epsilon, + a, + b, + eps + ) + + res +} + +eigen_matrix_impl <- function( + A, + sA, + fun, + n, + algorithm, + which, + options = arpack_defaults() +) { + # Argument checks + A[] <- as.numeric(A) + requireNamespace("Matrix", quietly = TRUE); sA <- as(as(as(sA, "dMatrix"), "generalMatrix"), "CsparseMatrix") + n <- as.integer(n) + algorithm <- switch_igraph_arg( + algorithm, + "auto" = 0L, + "lapack" = 1L, + "arpack" = 2L, + "comp_auto" = 3L, + "comp_lapack" = 4L, + "comp_arpack" = 5L + ) + which.tmp <- eigen_defaults() + which.tmp[names(which)] <- which + which <- which.tmp + options <- modify_list(arpack_defaults(), options) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_eigen_matrix, + A, + sA, + fun, + n, + algorithm, + which, + options + ) + + res +} + +eigen_matrix_symmetric_impl <- function( + A, + sA, + fun, + n, + algorithm, + which, + options = arpack_defaults() +) { + # Argument checks + A[] <- as.numeric(A) + requireNamespace("Matrix", quietly = TRUE); sA <- as(as(as(sA, "dMatrix"), "generalMatrix"), "CsparseMatrix") + n <- as.integer(n) + algorithm <- switch_igraph_arg( + algorithm, + "auto" = 0L, + "lapack" = 1L, + "arpack" = 2L, + "comp_auto" = 3L, + "comp_lapack" = 4L, + "comp_arpack" = 5L + ) + which.tmp <- eigen_defaults() + which.tmp[names(which)] <- which + which <- which.tmp + options <- modify_list(arpack_defaults(), options) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_eigen_matrix_symmetric, + A, + sA, + fun, + n, + algorithm, + which, + options + ) + + res +} + solve_lsap_impl <- function( c, n @@ -9927,6 +13655,34 @@ is_complete_impl <- function( res } +minimum_spanning_tree_impl <- function( + graph, + weights = NULL +) { + # Argument checks + ensure_igraph(graph) + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { + weights <- E(graph)$weight + } + if (!is.null(weights) && !all(is.na(weights))) { + weights <- as.numeric(weights) + } else { + weights <- NULL + } + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_minimum_spanning_tree, + graph, + weights + ) + if (igraph_opt("return.vs.es")) { + res <- create_es(graph, res) + } + res +} + minimum_spanning_tree_unweighted_impl <- function( graph ) { @@ -10284,6 +14040,104 @@ stochastic_imitation_impl <- function( res } +convergence_degree_impl <- function( + graph +) { + # Argument checks + ensure_igraph(graph) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_convergence_degree, + graph + ) + + res +} + +has_attribute_table_impl <- function( +) { + # Argument checks + + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_has_attribute_table + ) + + res +} + +progress_impl <- function( + message, + percent +) { + # Argument checks + percent <- as.numeric(percent) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_progress, + message, + percent + ) + + res +} + +status_impl <- function( + message +) { + # Argument checks + + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_status, + message + ) + + res +} + +strerror_impl <- function( + igraph_errno +) { + # Argument checks + + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_strerror, + igraph_errno + ) + + res +} + +expand_path_to_pairs_impl <- function( + path +) { + # Argument checks + path <- as_igraph_vs(path, path) + + on.exit(.Call(R_igraph_finalizer)) + # Function call + res <- .Call( + R_igraph_expand_path_to_pairs, + path - 1 + ) + if (igraph_opt("return.vs.es")) { + res <- create_vs(path, res) + } + res +} + invalidate_cache_impl <- function( graph ) { diff --git a/src/rinterface.c b/src/rinterface.c index e627617568..861b5e5824 100644 --- a/src/rinterface.c +++ b/src/rinterface.c @@ -88,6 +88,37 @@ SEXP R_igraph_add_edges(SEXP graph, SEXP edges) { 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=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; + + UNPROTECT(1); + return(r_result); +} + /*-------------------------------------------/ / igraph_add_vertices / /-------------------------------------------*/ @@ -386,6 +417,46 @@ SEXP R_igraph_degree(SEXP graph, SEXP vids, SEXP mode, SEXP loops) { return(r_result); } +/*-------------------------------------------/ +/ igraph_edge / +/-------------------------------------------*/ +SEXP R_igraph_edge(SEXP graph, SEXP eid) { + /* Declarations */ + igraph_t c_graph; + igraph_integer_t c_eid; + igraph_integer_t c_from; + igraph_integer_t c_to; + SEXP from; + SEXP to; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK_INT(eid); + c_eid = (igraph_integer_t) REAL(eid)[0]; + c_from=0; + c_to=0; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_edge(&c_graph, c_eid, &c_from, &c_to)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + PROTECT(from=NEW_NUMERIC(1)); + REAL(from)[0]=(double) c_from; + PROTECT(to=NEW_NUMERIC(1)); + REAL(to)[0]=(double) c_to; + SET_VECTOR_ELT(r_result, 0, from); + SET_VECTOR_ELT(r_result, 1, to); + SET_STRING_ELT(r_names, 0, Rf_mkChar("from")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("to")); + SET_NAMES(r_result, r_names); + UNPROTECT(3); + + UNPROTECT(1); + return(r_result); +} + /*-------------------------------------------/ / igraph_edges / /-------------------------------------------*/ @@ -418,6 +489,77 @@ SEXP R_igraph_edges(SEXP graph, SEXP eids) { return(r_result); } +/*-------------------------------------------/ +/ igraph_get_eid / +/-------------------------------------------*/ +SEXP R_igraph_get_eid(SEXP graph, SEXP from, SEXP to, SEXP directed, SEXP error) { + /* Declarations */ + igraph_t c_graph; + igraph_integer_t c_eid; + igraph_integer_t c_from; + igraph_integer_t c_to; + igraph_bool_t c_directed; + igraph_bool_t c_error; + SEXP eid; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + c_from = (igraph_integer_t) REAL(from)[0]; + c_to = (igraph_integer_t) REAL(to)[0]; + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + IGRAPH_R_CHECK_BOOL(error); + c_error = LOGICAL(error)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_get_eid(&c_graph, c_eid, c_from, c_to, c_directed, c_error)); + + /* Convert output */ + + r_result = eid; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_get_eids / +/-------------------------------------------*/ +SEXP R_igraph_get_eids(SEXP graph, SEXP pairs, SEXP directed, SEXP error) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_int_t c_eids; + igraph_vector_int_t c_pairs; + igraph_bool_t c_directed; + igraph_bool_t c_error; + SEXP eids; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_eids, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_eids); + Rz_SEXP_to_vector_int_copy(pairs, &c_pairs); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_pairs); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + IGRAPH_R_CHECK_BOOL(error); + c_error = LOGICAL(error)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_get_eids(&c_graph, &c_eids, &c_pairs, c_directed, c_error)); + + /* Convert output */ + PROTECT(eids=Ry_igraph_vector_int_to_SEXPp1(&c_eids)); + igraph_vector_int_destroy(&c_eids); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_pairs); + IGRAPH_FINALLY_CLEAN(1); + r_result = eids; + + UNPROTECT(1); + return(r_result); +} + /*-------------------------------------------/ / igraph_get_all_eids_between / /-------------------------------------------*/ @@ -483,6 +625,67 @@ SEXP R_igraph_incident(SEXP graph, SEXP vid, SEXP mode) { return(r_result); } +/*-------------------------------------------/ +/ igraph_is_same_graph / +/-------------------------------------------*/ +SEXP R_igraph_is_same_graph(SEXP graph1, SEXP graph2) { + /* Declarations */ + igraph_t c_graph1; + igraph_t c_graph2; + igraph_bool_t c_res; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph1, &c_graph1); + Rz_SEXP_to_igraph(graph2, &c_graph2); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_is_same_graph(&c_graph1, &c_graph2, &c_res)); + + /* Convert output */ + PROTECT(res=NEW_LOGICAL(1)); + LOGICAL(res)[0]=c_res; + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_create / +/-------------------------------------------*/ +SEXP R_igraph_create(SEXP edges, SEXP n, SEXP directed) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_int_t c_edges; + igraph_integer_t c_n; + igraph_bool_t c_directed; + SEXP graph; + + SEXP r_result; + /* Convert input */ + IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(edges, &c_edges)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edges); + 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_create(&c_graph, &c_edges, c_n, c_directed)); + + /* Convert output */ + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_edges); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; + + UNPROTECT(1); + return(r_result); +} + /*-------------------------------------------/ / igraph_adjacency / /-------------------------------------------*/ @@ -513,6 +716,96 @@ SEXP R_igraph_adjacency(SEXP adjmatrix, SEXP mode, SEXP loops) { return(r_result); } +/*-------------------------------------------/ +/ igraph_sparse_adjacency / +/-------------------------------------------*/ +SEXP R_igraph_sparse_adjacency(SEXP adjmatrix, SEXP mode, SEXP loops) { + /* Declarations */ + igraph_t c_graph; + igraph_sparsemat_t c_adjmatrix; + igraph_adjacency_t c_mode; + igraph_loops_t c_loops; + SEXP graph; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_sparsemat(adjmatrix, &c_adjmatrix); + c_mode = (igraph_adjacency_t) Rf_asInteger(mode); + c_loops = (igraph_loops_t) Rf_asInteger(loops); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_sparse_adjacency(&c_graph, &c_adjmatrix, c_mode, c_loops)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(adjmatrix=Ry_igraph_sparsemat_to_SEXP(&c_adjmatrix)); + igraph_sparsemat_destroy(&c_adjmatrix); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, graph); + SET_VECTOR_ELT(r_result, 1, adjmatrix); + SET_STRING_ELT(r_names, 0, Rf_mkChar("graph")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("adjmatrix")); + SET_NAMES(r_result, r_names); + UNPROTECT(3); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_sparse_weighted_adjacency / +/-------------------------------------------*/ +SEXP R_igraph_sparse_weighted_adjacency(SEXP adjmatrix, SEXP mode, SEXP loops) { + /* Declarations */ + igraph_t c_graph; + igraph_sparsemat_t c_adjmatrix; + igraph_adjacency_t c_mode; + igraph_vector_t c_weights; + igraph_loops_t c_loops; + SEXP graph; + SEXP weights; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_sparsemat(adjmatrix, &c_adjmatrix); + c_mode = (igraph_adjacency_t) Rf_asInteger(mode); + IGRAPH_R_CHECK(igraph_vector_init(&c_weights, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_weights); + weights=R_GlobalEnv; /* hack to have a non-NULL value */ + c_loops = (igraph_loops_t) Rf_asInteger(loops); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_sparse_weighted_adjacency(&c_graph, &c_adjmatrix, c_mode, &c_weights, c_loops)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(adjmatrix=Ry_igraph_sparsemat_to_SEXP(&c_adjmatrix)); + igraph_sparsemat_destroy(&c_adjmatrix); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(weights=Ry_igraph_0orvector_to_SEXP(&c_weights)); + igraph_vector_destroy(&c_weights); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, graph); + SET_VECTOR_ELT(r_result, 1, adjmatrix); + SET_VECTOR_ELT(r_result, 2, weights); + SET_STRING_ELT(r_names, 0, Rf_mkChar("graph")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("adjmatrix")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("weights")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); + + UNPROTECT(1); + return(r_result); +} + /*-------------------------------------------/ / igraph_weighted_adjacency / /-------------------------------------------*/ @@ -559,13 +852,13 @@ SEXP R_igraph_weighted_adjacency(SEXP adjmatrix, SEXP mode, SEXP loops) { } /*-------------------------------------------/ -/ igraph_wheel / +/ igraph_star / /-------------------------------------------*/ -SEXP R_igraph_wheel(SEXP n, SEXP mode, SEXP center) { +SEXP R_igraph_star(SEXP n, SEXP mode, SEXP center) { /* Declarations */ igraph_t c_graph; igraph_integer_t c_n; - igraph_wheel_mode_t c_mode; + igraph_star_mode_t c_mode; igraph_integer_t c_center; SEXP graph; @@ -573,11 +866,11 @@ SEXP R_igraph_wheel(SEXP n, SEXP mode, SEXP center) { /* Convert input */ IGRAPH_R_CHECK_INT(n); c_n = (igraph_integer_t) REAL(n)[0]; - c_mode = (igraph_wheel_mode_t) Rf_asInteger(mode); + c_mode = (igraph_star_mode_t) Rf_asInteger(mode); IGRAPH_R_CHECK_INT(center); c_center = (igraph_integer_t) REAL(center)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_wheel(&c_graph, c_n, c_mode, c_center)); + IGRAPH_R_CHECK(igraph_star(&c_graph, c_n, c_mode, c_center)); /* Convert output */ IGRAPH_FINALLY(igraph_destroy, &c_graph); @@ -591,21 +884,53 @@ SEXP R_igraph_wheel(SEXP n, SEXP mode, SEXP center) { } /*-------------------------------------------/ -/ igraph_hypercube / +/ igraph_wheel / /-------------------------------------------*/ -SEXP R_igraph_hypercube(SEXP n, SEXP directed) { +SEXP R_igraph_wheel(SEXP n, SEXP mode, SEXP center) { /* Declarations */ igraph_t c_graph; igraph_integer_t c_n; - igraph_bool_t c_directed; + igraph_wheel_mode_t c_mode; + igraph_integer_t c_center; 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]; + c_mode = (igraph_wheel_mode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK_INT(center); + c_center = (igraph_integer_t) REAL(center)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_wheel(&c_graph, c_n, c_mode, c_center)); + + /* Convert output */ + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_hypercube / +/-------------------------------------------*/ +SEXP R_igraph_hypercube(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_hypercube(&c_graph, c_n, c_directed)); @@ -697,6 +1022,42 @@ SEXP R_igraph_triangular_lattice(SEXP dimvector, SEXP directed, SEXP mutual) { return(r_result); } +/*-------------------------------------------/ +/ igraph_ring / +/-------------------------------------------*/ +SEXP R_igraph_ring(SEXP n, SEXP directed, SEXP mutual, SEXP circular) { + /* Declarations */ + igraph_t c_graph; + igraph_integer_t c_n; + igraph_bool_t c_directed; + igraph_bool_t c_mutual; + igraph_bool_t c_circular; + 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]; + IGRAPH_R_CHECK_BOOL(mutual); + c_mutual = LOGICAL(mutual)[0]; + IGRAPH_R_CHECK_BOOL(circular); + c_circular = LOGICAL(circular)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_ring(&c_graph, c_n, c_directed, c_mutual, c_circular)); + + /* Convert output */ + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; + + UNPROTECT(1); + return(r_result); +} + /*-------------------------------------------/ / igraph_path_graph / /-------------------------------------------*/ @@ -763,6 +1124,38 @@ SEXP R_igraph_cycle_graph(SEXP n, SEXP directed, SEXP mutual) { return(r_result); } +/*-------------------------------------------/ +/ igraph_kary_tree / +/-------------------------------------------*/ +SEXP R_igraph_kary_tree(SEXP n, SEXP children, SEXP type) { + /* Declarations */ + igraph_t c_graph; + igraph_integer_t c_n; + igraph_integer_t c_children; + igraph_tree_mode_t c_type; + SEXP graph; + + SEXP r_result; + /* Convert input */ + IGRAPH_R_CHECK_INT(n); + c_n = (igraph_integer_t) REAL(n)[0]; + IGRAPH_R_CHECK_INT(children); + c_children = (igraph_integer_t) REAL(children)[0]; + c_type = (igraph_tree_mode_t) Rf_asInteger(type); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_kary_tree(&c_graph, c_n, c_children, c_type)); + + /* Convert output */ + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; + + UNPROTECT(1); + return(r_result); +} + /*-------------------------------------------/ / igraph_symmetric_tree / /-------------------------------------------*/ @@ -826,6 +1219,39 @@ SEXP R_igraph_regular_tree(SEXP h, SEXP k, SEXP type) { return(r_result); } +/*-------------------------------------------/ +/ igraph_full / +/-------------------------------------------*/ +SEXP R_igraph_full(SEXP n, SEXP directed, SEXP loops) { + /* Declarations */ + igraph_t c_graph; + igraph_integer_t c_n; + igraph_bool_t c_directed; + igraph_bool_t c_loops; + 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]; + IGRAPH_R_CHECK_BOOL(loops); + c_loops = LOGICAL(loops)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_full(&c_graph, c_n, c_directed, c_loops)); + + /* Convert output */ + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; + + UNPROTECT(1); + return(r_result); +} + /*-------------------------------------------/ / igraph_full_citation / /-------------------------------------------*/ @@ -918,6 +1344,35 @@ SEXP R_igraph_extended_chordal_ring(SEXP nodes, SEXP W, SEXP directed) { return(r_result); } +/*-------------------------------------------/ +/ igraph_connect_neighborhood / +/-------------------------------------------*/ +SEXP R_igraph_connect_neighborhood(SEXP graph, SEXP order, SEXP mode) { + /* Declarations */ + igraph_t c_graph; + igraph_integer_t c_order; + igraph_neimode_t c_mode; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph_copy(graph, &c_graph); + IGRAPH_FINALLY(igraph_destroy, &c_graph); + IGRAPH_R_CHECK_INT(order); + c_order = (igraph_integer_t) REAL(order)[0]; + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_connect_neighborhood(&c_graph, c_order, c_mode)); + + /* Convert output */ + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; + + UNPROTECT(1); + return(r_result); +} + /*-------------------------------------------/ / igraph_graph_power / /-------------------------------------------*/ @@ -1443,6 +1898,98 @@ SEXP R_igraph_turan(SEXP n, SEXP r) { return(r_result); } +/*-------------------------------------------/ +/ igraph_weighted_sparsemat / +/-------------------------------------------*/ +SEXP R_igraph_weighted_sparsemat(SEXP A, SEXP directed, SEXP attr, SEXP loops) { + /* Declarations */ + igraph_t c_graph; + igraph_sparsemat_t c_A; + igraph_bool_t c_directed; + const char* c_attr; + igraph_bool_t c_loops; + SEXP graph; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_sparsemat(A, &c_A); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + c_attr = Rf_translateCharUTF8(STRING_ELT(attr, 0)); + IGRAPH_R_CHECK_BOOL(loops); + c_loops = LOGICAL(loops)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_weighted_sparsemat(&c_graph, &c_A, c_directed, c_attr, c_loops)); + + /* Convert output */ + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_barabasi_game / +/-------------------------------------------*/ +SEXP R_igraph_barabasi_game(SEXP n, SEXP power, SEXP m, SEXP outseq, SEXP outpref, SEXP A, SEXP directed, SEXP algo, SEXP start_from) { + /* Declarations */ + igraph_t c_graph; + igraph_integer_t c_n; + igraph_real_t c_power; + igraph_integer_t c_m; + igraph_vector_int_t c_outseq; + igraph_bool_t c_outpref; + igraph_real_t c_A; + igraph_bool_t c_directed; + igraph_barabasi_algorithm_t c_algo; + igraph_t c_start_from; + SEXP graph; + + SEXP r_result; + /* Convert input */ + IGRAPH_R_CHECK_INT(n); + c_n = (igraph_integer_t) REAL(n)[0]; + IGRAPH_R_CHECK_REAL(power); + c_power = REAL(power)[0]; + IGRAPH_R_CHECK_INT(m); + c_m = (igraph_integer_t) REAL(m)[0]; + if (!Rf_isNull(outseq)) { + IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(outseq, &c_outseq)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_outseq); + } else { + IGRAPH_R_CHECK(igraph_vector_int_init(&c_outseq, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_outseq); + } + IGRAPH_R_CHECK_BOOL(outpref); + c_outpref = LOGICAL(outpref)[0]; + IGRAPH_R_CHECK_REAL(A); + c_A = REAL(A)[0]; + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + c_algo = (igraph_barabasi_algorithm_t) Rf_asInteger(algo); + if (!Rf_isNull(start_from)) { + Rz_SEXP_to_igraph(start_from, &c_start_from); + } + /* Call igraph */ + IGRAPH_R_CHECK(igraph_barabasi_game(&c_graph, c_n, c_power, c_m, (Rf_isNull(outseq) ? 0 : &c_outseq), c_outpref, c_A, c_directed, c_algo, (Rf_isNull(start_from) ? 0 : &c_start_from))); + + /* Convert output */ + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_outseq); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; + + UNPROTECT(1); + return(r_result); +} + /*-------------------------------------------/ / igraph_erdos_renyi_game_gnp / /-------------------------------------------*/ @@ -1515,6 +2062,47 @@ SEXP R_igraph_erdos_renyi_game_gnm(SEXP n, SEXP m, SEXP directed, SEXP loops) { return(r_result); } +/*-------------------------------------------/ +/ igraph_degree_sequence_game / +/-------------------------------------------*/ +SEXP R_igraph_degree_sequence_game(SEXP out_deg, SEXP in_deg, SEXP method) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_int_t c_out_deg; + igraph_vector_int_t c_in_deg; + igraph_degseq_t c_method; + SEXP graph; + + SEXP r_result; + /* Convert input */ + IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(out_deg, &c_out_deg)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_out_deg); + if (!Rf_isNull(in_deg)) { + IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(in_deg, &c_in_deg)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_in_deg); + } else { + IGRAPH_R_CHECK(igraph_vector_int_init(&c_in_deg, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_in_deg); + } + c_method = (igraph_degseq_t) Rf_asInteger(method); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_degree_sequence_game(&c_graph, &c_out_deg, (Rf_isNull(in_deg) ? 0 : &c_in_deg), c_method)); + + /* Convert output */ + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_out_deg); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_in_deg); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; + + UNPROTECT(1); + return(r_result); +} + /*-------------------------------------------/ / igraph_growing_random_game / /-------------------------------------------*/ @@ -1552,31 +2140,378 @@ SEXP R_igraph_growing_random_game(SEXP n, SEXP m, SEXP directed, SEXP citation) } /*-------------------------------------------/ -/ igraph_preference_game / +/ igraph_barabasi_aging_game / /-------------------------------------------*/ -SEXP R_igraph_preference_game(SEXP nodes, SEXP types, SEXP type_dist, SEXP fixed_sizes, SEXP pref_matrix, SEXP directed, SEXP loops) { +SEXP R_igraph_barabasi_aging_game(SEXP nodes, SEXP m, SEXP outseq, SEXP outpref, SEXP pa_exp, SEXP aging_exp, SEXP aging_bin, SEXP zero_deg_appeal, SEXP zero_age_appeal, SEXP deg_coef, SEXP age_coef, SEXP directed) { /* Declarations */ igraph_t c_graph; igraph_integer_t c_nodes; - igraph_integer_t c_types; - igraph_vector_t c_type_dist; - igraph_bool_t c_fixed_sizes; - igraph_matrix_t c_pref_matrix; - igraph_vector_int_t c_node_type_vec; + igraph_integer_t c_m; + igraph_vector_int_t c_outseq; + igraph_bool_t c_outpref; + igraph_real_t c_pa_exp; + igraph_real_t c_aging_exp; + igraph_integer_t c_aging_bin; + igraph_real_t c_zero_deg_appeal; + igraph_real_t c_zero_age_appeal; + igraph_real_t c_deg_coef; + igraph_real_t c_age_coef; igraph_bool_t c_directed; - igraph_bool_t c_loops; SEXP graph; - SEXP node_type_vec; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ IGRAPH_R_CHECK_INT(nodes); c_nodes = (igraph_integer_t) REAL(nodes)[0]; - IGRAPH_R_CHECK_INT(types); - c_types = (igraph_integer_t) REAL(types)[0]; - Rz_SEXP_to_vector(type_dist, &c_type_dist); - IGRAPH_R_CHECK_BOOL(fixed_sizes); - c_fixed_sizes = LOGICAL(fixed_sizes)[0]; + IGRAPH_R_CHECK_INT(m); + c_m = (igraph_integer_t) REAL(m)[0]; + if (!Rf_isNull(outseq)) { + IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(outseq, &c_outseq)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_outseq); + } else { + IGRAPH_R_CHECK(igraph_vector_int_init(&c_outseq, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_outseq); + } + IGRAPH_R_CHECK_BOOL(outpref); + c_outpref = LOGICAL(outpref)[0]; + IGRAPH_R_CHECK_REAL(pa_exp); + c_pa_exp = REAL(pa_exp)[0]; + IGRAPH_R_CHECK_REAL(aging_exp); + c_aging_exp = REAL(aging_exp)[0]; + IGRAPH_R_CHECK_INT(aging_bin); + c_aging_bin = (igraph_integer_t) REAL(aging_bin)[0]; + IGRAPH_R_CHECK_REAL(zero_deg_appeal); + c_zero_deg_appeal = REAL(zero_deg_appeal)[0]; + IGRAPH_R_CHECK_REAL(zero_age_appeal); + c_zero_age_appeal = REAL(zero_age_appeal)[0]; + IGRAPH_R_CHECK_REAL(deg_coef); + c_deg_coef = REAL(deg_coef)[0]; + IGRAPH_R_CHECK_REAL(age_coef); + c_age_coef = REAL(age_coef)[0]; + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_barabasi_aging_game(&c_graph, c_nodes, c_m, (Rf_isNull(outseq) ? 0 : &c_outseq), c_outpref, c_pa_exp, c_aging_exp, c_aging_bin, c_zero_deg_appeal, c_zero_age_appeal, c_deg_coef, c_age_coef, c_directed)); + + /* Convert output */ + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_outseq); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_recent_degree_game / +/-------------------------------------------*/ +SEXP R_igraph_recent_degree_game(SEXP n, SEXP power, SEXP window, SEXP m, SEXP outseq, SEXP outpref, SEXP zero_appeal, SEXP directed) { + /* Declarations */ + igraph_t c_graph; + igraph_integer_t c_n; + igraph_real_t c_power; + igraph_integer_t c_window; + igraph_integer_t c_m; + igraph_vector_int_t c_outseq; + igraph_bool_t c_outpref; + igraph_real_t c_zero_appeal; + 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_REAL(power); + c_power = REAL(power)[0]; + IGRAPH_R_CHECK_INT(window); + c_window = (igraph_integer_t) REAL(window)[0]; + IGRAPH_R_CHECK_INT(m); + c_m = (igraph_integer_t) REAL(m)[0]; + if (!Rf_isNull(outseq)) { + IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(outseq, &c_outseq)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_outseq); + } else { + IGRAPH_R_CHECK(igraph_vector_int_init(&c_outseq, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_outseq); + } + IGRAPH_R_CHECK_BOOL(outpref); + c_outpref = LOGICAL(outpref)[0]; + IGRAPH_R_CHECK_REAL(zero_appeal); + c_zero_appeal = REAL(zero_appeal)[0]; + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_recent_degree_game(&c_graph, c_n, c_power, c_window, c_m, (Rf_isNull(outseq) ? 0 : &c_outseq), c_outpref, c_zero_appeal, c_directed)); + + /* Convert output */ + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_outseq); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_recent_degree_aging_game / +/-------------------------------------------*/ +SEXP R_igraph_recent_degree_aging_game(SEXP nodes, SEXP m, SEXP outseq, SEXP outpref, SEXP pa_exp, SEXP aging_exp, SEXP aging_bin, SEXP window, SEXP zero_appeal, SEXP directed) { + /* Declarations */ + igraph_t c_graph; + igraph_integer_t c_nodes; + igraph_integer_t c_m; + igraph_vector_int_t c_outseq; + igraph_bool_t c_outpref; + igraph_real_t c_pa_exp; + igraph_real_t c_aging_exp; + igraph_integer_t c_aging_bin; + igraph_integer_t c_window; + igraph_real_t c_zero_appeal; + igraph_bool_t c_directed; + SEXP graph; + + SEXP r_result; + /* Convert input */ + IGRAPH_R_CHECK_INT(nodes); + c_nodes = (igraph_integer_t) REAL(nodes)[0]; + IGRAPH_R_CHECK_INT(m); + c_m = (igraph_integer_t) REAL(m)[0]; + if (!Rf_isNull(outseq)) { + IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(outseq, &c_outseq)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_outseq); + } else { + IGRAPH_R_CHECK(igraph_vector_int_init(&c_outseq, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_outseq); + } + IGRAPH_R_CHECK_BOOL(outpref); + c_outpref = LOGICAL(outpref)[0]; + IGRAPH_R_CHECK_REAL(pa_exp); + c_pa_exp = REAL(pa_exp)[0]; + IGRAPH_R_CHECK_REAL(aging_exp); + c_aging_exp = REAL(aging_exp)[0]; + IGRAPH_R_CHECK_INT(aging_bin); + c_aging_bin = (igraph_integer_t) REAL(aging_bin)[0]; + IGRAPH_R_CHECK_INT(window); + c_window = (igraph_integer_t) REAL(window)[0]; + IGRAPH_R_CHECK_REAL(zero_appeal); + c_zero_appeal = REAL(zero_appeal)[0]; + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_recent_degree_aging_game(&c_graph, c_nodes, c_m, (Rf_isNull(outseq) ? 0 : &c_outseq), c_outpref, c_pa_exp, c_aging_exp, c_aging_bin, c_window, c_zero_appeal, c_directed)); + + /* Convert output */ + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_outseq); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_callaway_traits_game / +/-------------------------------------------*/ +SEXP R_igraph_callaway_traits_game(SEXP nodes, SEXP types, SEXP edges_per_step, SEXP type_dist, SEXP pref_matrix, SEXP directed) { + /* Declarations */ + igraph_t c_graph; + igraph_integer_t c_nodes; + igraph_integer_t c_types; + igraph_integer_t c_edges_per_step; + igraph_vector_t c_type_dist; + igraph_matrix_t c_pref_matrix; + igraph_bool_t c_directed; + igraph_vector_int_t c_node_type_vec; + SEXP graph; + SEXP node_type_vec; + + SEXP r_result, r_names; + /* Convert input */ + IGRAPH_R_CHECK_INT(nodes); + c_nodes = (igraph_integer_t) REAL(nodes)[0]; + IGRAPH_R_CHECK_INT(types); + c_types = (igraph_integer_t) REAL(types)[0]; + IGRAPH_R_CHECK_INT(edges_per_step); + c_edges_per_step = (igraph_integer_t) REAL(edges_per_step)[0]; + Rz_SEXP_to_vector(type_dist, &c_type_dist); + Rz_SEXP_to_matrix(pref_matrix, &c_pref_matrix); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + IGRAPH_R_CHECK(igraph_vector_int_init(&c_node_type_vec, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_node_type_vec); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_callaway_traits_game(&c_graph, c_nodes, c_types, c_edges_per_step, &c_type_dist, &c_pref_matrix, c_directed, &c_node_type_vec)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(node_type_vec=Ry_igraph_vector_int_to_SEXP(&c_node_type_vec)); + igraph_vector_int_destroy(&c_node_type_vec); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, graph); + SET_VECTOR_ELT(r_result, 1, node_type_vec); + SET_STRING_ELT(r_names, 0, Rf_mkChar("graph")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("node_type_vec")); + SET_NAMES(r_result, r_names); + UNPROTECT(3); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_establishment_game / +/-------------------------------------------*/ +SEXP R_igraph_establishment_game(SEXP nodes, SEXP types, SEXP k, SEXP type_dist, SEXP pref_matrix, SEXP directed) { + /* Declarations */ + igraph_t c_graph; + igraph_integer_t c_nodes; + igraph_integer_t c_types; + igraph_integer_t c_k; + igraph_vector_t c_type_dist; + igraph_matrix_t c_pref_matrix; + igraph_bool_t c_directed; + igraph_vector_int_t c_node_type_vec; + SEXP graph; + SEXP node_type_vec; + + SEXP r_result, r_names; + /* Convert input */ + IGRAPH_R_CHECK_INT(nodes); + c_nodes = (igraph_integer_t) REAL(nodes)[0]; + IGRAPH_R_CHECK_INT(types); + c_types = (igraph_integer_t) REAL(types)[0]; + IGRAPH_R_CHECK_INT(k); + c_k = (igraph_integer_t) REAL(k)[0]; + Rz_SEXP_to_vector(type_dist, &c_type_dist); + Rz_SEXP_to_matrix(pref_matrix, &c_pref_matrix); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + IGRAPH_R_CHECK(igraph_vector_int_init(&c_node_type_vec, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_node_type_vec); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_establishment_game(&c_graph, c_nodes, c_types, c_k, &c_type_dist, &c_pref_matrix, c_directed, &c_node_type_vec)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(node_type_vec=Ry_igraph_vector_int_to_SEXP(&c_node_type_vec)); + igraph_vector_int_destroy(&c_node_type_vec); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, graph); + SET_VECTOR_ELT(r_result, 1, node_type_vec); + SET_STRING_ELT(r_names, 0, Rf_mkChar("graph")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("node_type_vec")); + SET_NAMES(r_result, r_names); + UNPROTECT(3); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_grg_game / +/-------------------------------------------*/ +SEXP R_igraph_grg_game(SEXP nodes, SEXP radius, SEXP torus) { + /* Declarations */ + igraph_t c_graph; + igraph_integer_t c_nodes; + igraph_real_t c_radius; + igraph_bool_t c_torus; + igraph_vector_t c_x; + igraph_vector_t c_y; + SEXP graph; + SEXP x; + SEXP y; + + SEXP r_result, r_names; + /* Convert input */ + IGRAPH_R_CHECK_INT(nodes); + c_nodes = (igraph_integer_t) REAL(nodes)[0]; + IGRAPH_R_CHECK_REAL(radius); + c_radius = REAL(radius)[0]; + IGRAPH_R_CHECK_BOOL(torus); + c_torus = LOGICAL(torus)[0]; + IGRAPH_R_CHECK(igraph_vector_init(&c_x, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_x); + IGRAPH_R_CHECK(igraph_vector_init(&c_y, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_y); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_grg_game(&c_graph, c_nodes, c_radius, c_torus, &c_x, &c_y)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(x=Ry_igraph_vector_to_SEXP(&c_x)); + igraph_vector_destroy(&c_x); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(y=Ry_igraph_vector_to_SEXP(&c_y)); + igraph_vector_destroy(&c_y); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, graph); + SET_VECTOR_ELT(r_result, 1, x); + SET_VECTOR_ELT(r_result, 2, y); + SET_STRING_ELT(r_names, 0, Rf_mkChar("graph")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("x")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("y")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_preference_game / +/-------------------------------------------*/ +SEXP R_igraph_preference_game(SEXP nodes, SEXP types, SEXP type_dist, SEXP fixed_sizes, SEXP pref_matrix, SEXP directed, SEXP loops) { + /* Declarations */ + igraph_t c_graph; + igraph_integer_t c_nodes; + igraph_integer_t c_types; + igraph_vector_t c_type_dist; + igraph_bool_t c_fixed_sizes; + igraph_matrix_t c_pref_matrix; + igraph_vector_int_t c_node_type_vec; + igraph_bool_t c_directed; + igraph_bool_t c_loops; + SEXP graph; + SEXP node_type_vec; + + SEXP r_result, r_names; + /* Convert input */ + IGRAPH_R_CHECK_INT(nodes); + c_nodes = (igraph_integer_t) REAL(nodes)[0]; + IGRAPH_R_CHECK_INT(types); + c_types = (igraph_integer_t) REAL(types)[0]; + Rz_SEXP_to_vector(type_dist, &c_type_dist); + IGRAPH_R_CHECK_BOOL(fixed_sizes); + c_fixed_sizes = LOGICAL(fixed_sizes)[0]; Rz_SEXP_to_matrix(pref_matrix, &c_pref_matrix); IGRAPH_R_CHECK(igraph_vector_int_init(&c_node_type_vec, 0)); IGRAPH_FINALLY(igraph_vector_int_destroy, &c_node_type_vec); @@ -1737,20 +2672,180 @@ SEXP R_igraph_rewire_directed_edges(SEXP graph, SEXP prob, SEXP loops, SEXP mode } /*-------------------------------------------/ -/ igraph_forest_fire_game / +/ igraph_watts_strogatz_game / /-------------------------------------------*/ -SEXP R_igraph_forest_fire_game(SEXP nodes, SEXP fw_prob, SEXP bw_factor, SEXP ambs, SEXP directed) { +SEXP R_igraph_watts_strogatz_game(SEXP dim, SEXP size, SEXP nei, SEXP p, SEXP loops, SEXP multiple) { /* Declarations */ igraph_t c_graph; - igraph_integer_t c_nodes; - igraph_real_t c_fw_prob; - igraph_real_t c_bw_factor; - igraph_integer_t c_ambs; - igraph_bool_t c_directed; - SEXP graph; - - SEXP r_result; - /* Convert input */ + igraph_integer_t c_dim; + igraph_integer_t c_size; + igraph_integer_t c_nei; + igraph_real_t c_p; + igraph_bool_t c_loops; + igraph_bool_t c_multiple; + SEXP graph; + + SEXP r_result; + /* Convert input */ + IGRAPH_R_CHECK_INT(dim); + c_dim = (igraph_integer_t) REAL(dim)[0]; + IGRAPH_R_CHECK_INT(size); + c_size = (igraph_integer_t) REAL(size)[0]; + IGRAPH_R_CHECK_INT(nei); + c_nei = (igraph_integer_t) REAL(nei)[0]; + IGRAPH_R_CHECK_REAL(p); + c_p = REAL(p)[0]; + IGRAPH_R_CHECK_BOOL(loops); + c_loops = LOGICAL(loops)[0]; + IGRAPH_R_CHECK_BOOL(multiple); + c_multiple = LOGICAL(multiple)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_watts_strogatz_game(&c_graph, c_dim, c_size, c_nei, c_p, c_loops, c_multiple)); + + /* Convert output */ + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_lastcit_game / +/-------------------------------------------*/ +SEXP R_igraph_lastcit_game(SEXP nodes, SEXP edges_per_node, SEXP agebins, SEXP preference, SEXP directed) { + /* Declarations */ + igraph_t c_graph; + igraph_integer_t c_nodes; + igraph_integer_t c_edges_per_node; + igraph_integer_t c_agebins; + igraph_vector_t c_preference; + igraph_bool_t c_directed; + SEXP graph; + + SEXP r_result; + /* Convert input */ + IGRAPH_R_CHECK_INT(nodes); + c_nodes = (igraph_integer_t) REAL(nodes)[0]; + IGRAPH_R_CHECK_INT(edges_per_node); + c_edges_per_node = (igraph_integer_t) REAL(edges_per_node)[0]; + IGRAPH_R_CHECK_INT(agebins); + c_agebins = (igraph_integer_t) REAL(agebins)[0]; + Rz_SEXP_to_vector(preference, &c_preference); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_lastcit_game(&c_graph, c_nodes, c_edges_per_node, c_agebins, &c_preference, c_directed)); + + /* Convert output */ + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_cited_type_game / +/-------------------------------------------*/ +SEXP R_igraph_cited_type_game(SEXP nodes, SEXP types, SEXP pref, SEXP edges_per_step, SEXP directed) { + /* Declarations */ + igraph_t c_graph; + igraph_integer_t c_nodes; + igraph_vector_int_t c_types; + igraph_vector_t c_pref; + igraph_integer_t c_edges_per_step; + igraph_bool_t c_directed; + SEXP graph; + + SEXP r_result; + /* Convert input */ + IGRAPH_R_CHECK_INT(nodes); + c_nodes = (igraph_integer_t) REAL(nodes)[0]; + Rz_SEXP_to_vector_int_copy(types, &c_types); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_types); + Rz_SEXP_to_vector(pref, &c_pref); + IGRAPH_R_CHECK_INT(edges_per_step); + c_edges_per_step = (igraph_integer_t) REAL(edges_per_step)[0]; + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_cited_type_game(&c_graph, c_nodes, &c_types, &c_pref, c_edges_per_step, c_directed)); + + /* Convert output */ + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_types); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_citing_cited_type_game / +/-------------------------------------------*/ +SEXP R_igraph_citing_cited_type_game(SEXP nodes, SEXP types, SEXP pref, SEXP edges_per_step, SEXP directed) { + /* Declarations */ + igraph_t c_graph; + igraph_integer_t c_nodes; + igraph_vector_int_t c_types; + igraph_matrix_t c_pref; + igraph_integer_t c_edges_per_step; + igraph_bool_t c_directed; + SEXP graph; + + SEXP r_result; + /* Convert input */ + IGRAPH_R_CHECK_INT(nodes); + c_nodes = (igraph_integer_t) REAL(nodes)[0]; + Rz_SEXP_to_vector_int_copy(types, &c_types); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_types); + Rz_SEXP_to_matrix(pref, &c_pref); + IGRAPH_R_CHECK_INT(edges_per_step); + c_edges_per_step = (igraph_integer_t) REAL(edges_per_step)[0]; + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_citing_cited_type_game(&c_graph, c_nodes, &c_types, &c_pref, c_edges_per_step, c_directed)); + + /* Convert output */ + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_types); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_forest_fire_game / +/-------------------------------------------*/ +SEXP R_igraph_forest_fire_game(SEXP nodes, SEXP fw_prob, SEXP bw_factor, SEXP ambs, SEXP directed) { + /* Declarations */ + igraph_t c_graph; + igraph_integer_t c_nodes; + igraph_real_t c_fw_prob; + igraph_real_t c_bw_factor; + igraph_integer_t c_ambs; + igraph_bool_t c_directed; + SEXP graph; + + SEXP r_result; + /* Convert input */ IGRAPH_R_CHECK_INT(nodes); c_nodes = (igraph_integer_t) REAL(nodes)[0]; IGRAPH_R_CHECK_REAL(fw_prob); @@ -2345,448 +3440,417 @@ SEXP R_igraph_are_adjacent(SEXP graph, SEXP v1, SEXP v2) { } /*-------------------------------------------/ -/ igraph_closeness / +/ igraph_are_connected / /-------------------------------------------*/ -SEXP R_igraph_closeness(SEXP graph, SEXP vids, SEXP mode, SEXP weights, SEXP normalized) { +SEXP R_igraph_are_connected(SEXP graph, SEXP v1, SEXP v2) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_res; - igraph_vector_int_t c_reachable_count; - igraph_bool_t c_all_reachable; - igraph_vs_t c_vids; - igraph_neimode_t c_mode; - igraph_vector_t c_weights; - igraph_bool_t c_normalized; + igraph_integer_t c_v1; + igraph_integer_t c_v2; + igraph_bool_t c_res; SEXP res; - SEXP reachable_count; - SEXP all_reachable; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_res); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_reachable_count, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_reachable_count); - igraph_vector_int_t c_vids_data; - Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); - c_mode = (igraph_neimode_t) Rf_asInteger(mode); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } - IGRAPH_R_CHECK_BOOL(normalized); - c_normalized = LOGICAL(normalized)[0]; + c_v1 = (igraph_integer_t) REAL(v1)[0]; + c_v2 = (igraph_integer_t) REAL(v2)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_closeness(&c_graph, &c_res, &c_reachable_count, &c_all_reachable, c_vids, c_mode, (Rf_isNull(weights) ? 0 : &c_weights), c_normalized)); + IGRAPH_R_CHECK(igraph_are_connected(&c_graph, c_v1, c_v2, &c_res)); /* Convert output */ - PROTECT(r_result=NEW_LIST(3)); - PROTECT(r_names=NEW_CHARACTER(3)); - PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); - igraph_vector_destroy(&c_res); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(reachable_count=Ry_igraph_vector_int_to_SEXP(&c_reachable_count)); - igraph_vector_int_destroy(&c_reachable_count); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(all_reachable=NEW_LOGICAL(1)); - LOGICAL(all_reachable)[0]=c_all_reachable; - igraph_vector_int_destroy(&c_vids_data); - igraph_vs_destroy(&c_vids); - SET_VECTOR_ELT(r_result, 0, res); - SET_VECTOR_ELT(r_result, 1, reachable_count); - SET_VECTOR_ELT(r_result, 2, all_reachable); - SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("reachable_count")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("all_reachable")); - SET_NAMES(r_result, r_names); - UNPROTECT(4); + PROTECT(res=NEW_LOGICAL(1)); + LOGICAL(res)[0]=c_res; + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_closeness_cutoff / +/ igraph_diameter / /-------------------------------------------*/ -SEXP R_igraph_closeness_cutoff(SEXP graph, SEXP vids, SEXP mode, SEXP weights, SEXP normalized, SEXP cutoff) { +SEXP R_igraph_diameter(SEXP graph, SEXP directed, SEXP unconnected) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_res; - igraph_vector_int_t c_reachable_count; - igraph_bool_t c_all_reachable; - igraph_vs_t c_vids; - igraph_neimode_t c_mode; - igraph_vector_t c_weights; - igraph_bool_t c_normalized; - igraph_real_t c_cutoff; + igraph_real_t c_res; + igraph_integer_t c_from; + igraph_integer_t c_to; + igraph_vector_int_t c_vertex_path; + igraph_vector_int_t c_edge_path; + igraph_bool_t c_directed; + igraph_bool_t c_unconnected; SEXP res; - SEXP reachable_count; - SEXP all_reachable; + SEXP from; + SEXP to; + SEXP vertex_path; + SEXP edge_path; SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_res); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_reachable_count, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_reachable_count); - igraph_vector_int_t c_vids_data; - Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); - c_mode = (igraph_neimode_t) Rf_asInteger(mode); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } - IGRAPH_R_CHECK_BOOL(normalized); - c_normalized = LOGICAL(normalized)[0]; - IGRAPH_R_CHECK_REAL(cutoff); - c_cutoff = REAL(cutoff)[0]; + c_from=0; + c_to=0; + IGRAPH_R_CHECK(igraph_vector_int_init(&c_vertex_path, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vertex_path); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_edge_path, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edge_path); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + IGRAPH_R_CHECK_BOOL(unconnected); + c_unconnected = LOGICAL(unconnected)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_closeness_cutoff(&c_graph, &c_res, &c_reachable_count, &c_all_reachable, c_vids, c_mode, (Rf_isNull(weights) ? 0 : &c_weights), c_normalized, c_cutoff)); + IGRAPH_R_CHECK(igraph_diameter(&c_graph, &c_res, &c_from, &c_to, &c_vertex_path, &c_edge_path, c_directed, c_unconnected)); /* Convert output */ - PROTECT(r_result=NEW_LIST(3)); - PROTECT(r_names=NEW_CHARACTER(3)); - PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); - igraph_vector_destroy(&c_res); + PROTECT(r_result=NEW_LIST(5)); + PROTECT(r_names=NEW_CHARACTER(5)); + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=c_res; + PROTECT(from=NEW_NUMERIC(1)); + REAL(from)[0]=(double) c_from; + PROTECT(to=NEW_NUMERIC(1)); + REAL(to)[0]=(double) c_to; + PROTECT(vertex_path=Ry_igraph_vector_int_to_SEXP(&c_vertex_path)); + igraph_vector_int_destroy(&c_vertex_path); IGRAPH_FINALLY_CLEAN(1); - PROTECT(reachable_count=Ry_igraph_vector_int_to_SEXP(&c_reachable_count)); - igraph_vector_int_destroy(&c_reachable_count); + PROTECT(edge_path=Ry_igraph_vector_int_to_SEXP(&c_edge_path)); + igraph_vector_int_destroy(&c_edge_path); IGRAPH_FINALLY_CLEAN(1); - PROTECT(all_reachable=NEW_LOGICAL(1)); - LOGICAL(all_reachable)[0]=c_all_reachable; - igraph_vector_int_destroy(&c_vids_data); - igraph_vs_destroy(&c_vids); SET_VECTOR_ELT(r_result, 0, res); - SET_VECTOR_ELT(r_result, 1, reachable_count); - SET_VECTOR_ELT(r_result, 2, all_reachable); + SET_VECTOR_ELT(r_result, 1, from); + SET_VECTOR_ELT(r_result, 2, to); + SET_VECTOR_ELT(r_result, 3, vertex_path); + SET_VECTOR_ELT(r_result, 4, edge_path); SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("reachable_count")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("all_reachable")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("from")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("to")); + SET_STRING_ELT(r_names, 3, Rf_mkChar("vertex_path")); + SET_STRING_ELT(r_names, 4, Rf_mkChar("edge_path")); SET_NAMES(r_result, r_names); - UNPROTECT(4); + UNPROTECT(6); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_get_shortest_path / +/ igraph_diameter_dijkstra / /-------------------------------------------*/ -SEXP R_igraph_get_shortest_path(SEXP graph, SEXP from, SEXP to, SEXP mode) { +SEXP R_igraph_diameter_dijkstra(SEXP graph, SEXP weights, SEXP directed, SEXP unconnected) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_t c_vertices; - igraph_vector_int_t c_edges; + igraph_vector_t c_weights; + igraph_real_t c_res; igraph_integer_t c_from; igraph_integer_t c_to; - igraph_neimode_t c_mode; - SEXP vertices; - SEXP edges; + igraph_vector_int_t c_vertex_path; + igraph_vector_int_t c_edge_path; + igraph_bool_t c_directed; + igraph_bool_t c_unconnected; + SEXP res; + SEXP from; + SEXP to; + SEXP vertex_path; + SEXP edge_path; SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_vertices, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vertices); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_edges, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edges); - c_from = (igraph_integer_t) REAL(from)[0]; - c_to = (igraph_integer_t) REAL(to)[0]; - c_mode = (igraph_neimode_t) Rf_asInteger(mode); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + c_from=0; + c_to=0; + IGRAPH_R_CHECK(igraph_vector_int_init(&c_vertex_path, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vertex_path); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_edge_path, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edge_path); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + IGRAPH_R_CHECK_BOOL(unconnected); + c_unconnected = LOGICAL(unconnected)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_get_shortest_path(&c_graph, &c_vertices, &c_edges, c_from, c_to, c_mode)); + IGRAPH_R_CHECK(igraph_diameter_dijkstra(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_res, &c_from, &c_to, &c_vertex_path, &c_edge_path, c_directed, c_unconnected)); /* Convert output */ - PROTECT(r_result=NEW_LIST(2)); - PROTECT(r_names=NEW_CHARACTER(2)); - PROTECT(vertices=Ry_igraph_vector_int_to_SEXPp1(&c_vertices)); - igraph_vector_int_destroy(&c_vertices); + PROTECT(r_result=NEW_LIST(5)); + PROTECT(r_names=NEW_CHARACTER(5)); + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=c_res; + PROTECT(from=NEW_NUMERIC(1)); + REAL(from)[0]=(double) c_from; + PROTECT(to=NEW_NUMERIC(1)); + REAL(to)[0]=(double) c_to; + PROTECT(vertex_path=Ry_igraph_vector_int_to_SEXP(&c_vertex_path)); + igraph_vector_int_destroy(&c_vertex_path); IGRAPH_FINALLY_CLEAN(1); - PROTECT(edges=Ry_igraph_vector_int_to_SEXPp1(&c_edges)); - igraph_vector_int_destroy(&c_edges); + PROTECT(edge_path=Ry_igraph_vector_int_to_SEXP(&c_edge_path)); + igraph_vector_int_destroy(&c_edge_path); IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, vertices); - SET_VECTOR_ELT(r_result, 1, edges); - SET_STRING_ELT(r_names, 0, Rf_mkChar("vertices")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("edges")); + SET_VECTOR_ELT(r_result, 0, res); + SET_VECTOR_ELT(r_result, 1, from); + SET_VECTOR_ELT(r_result, 2, to); + SET_VECTOR_ELT(r_result, 3, vertex_path); + SET_VECTOR_ELT(r_result, 4, edge_path); + SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("from")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("to")); + SET_STRING_ELT(r_names, 3, Rf_mkChar("vertex_path")); + SET_STRING_ELT(r_names, 4, Rf_mkChar("edge_path")); SET_NAMES(r_result, r_names); - UNPROTECT(3); + UNPROTECT(6); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_get_shortest_path_bellman_ford / +/ igraph_closeness / /-------------------------------------------*/ -SEXP R_igraph_get_shortest_path_bellman_ford(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP mode) { +SEXP R_igraph_closeness(SEXP graph, SEXP vids, SEXP mode, SEXP weights, SEXP normalized) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_t c_vertices; - igraph_vector_int_t c_edges; - igraph_integer_t c_from; - igraph_integer_t c_to; - igraph_vector_t c_weights; + igraph_vector_t c_res; + igraph_vector_int_t c_reachable_count; + igraph_bool_t c_all_reachable; + igraph_vs_t c_vids; igraph_neimode_t c_mode; - SEXP vertices; - SEXP edges; + igraph_vector_t c_weights; + igraph_bool_t c_normalized; + SEXP res; + SEXP reachable_count; + SEXP all_reachable; SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_vertices, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vertices); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_edges, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edges); - c_from = (igraph_integer_t) REAL(from)[0]; - c_to = (igraph_integer_t) REAL(to)[0]; + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_reachable_count, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_reachable_count); + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); if (!Rf_isNull(weights)) { Rz_SEXP_to_vector(weights, &c_weights); } - c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK_BOOL(normalized); + c_normalized = LOGICAL(normalized)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_get_shortest_path_bellman_ford(&c_graph, &c_vertices, &c_edges, c_from, c_to, (Rf_isNull(weights) ? 0 : &c_weights), c_mode)); + IGRAPH_R_CHECK(igraph_closeness(&c_graph, &c_res, &c_reachable_count, &c_all_reachable, c_vids, c_mode, (Rf_isNull(weights) ? 0 : &c_weights), c_normalized)); /* Convert output */ - PROTECT(r_result=NEW_LIST(2)); - PROTECT(r_names=NEW_CHARACTER(2)); - PROTECT(vertices=Ry_igraph_vector_int_to_SEXPp1(&c_vertices)); - igraph_vector_int_destroy(&c_vertices); + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); - PROTECT(edges=Ry_igraph_vector_int_to_SEXPp1(&c_edges)); - igraph_vector_int_destroy(&c_edges); + PROTECT(reachable_count=Ry_igraph_vector_int_to_SEXP(&c_reachable_count)); + igraph_vector_int_destroy(&c_reachable_count); IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, vertices); - SET_VECTOR_ELT(r_result, 1, edges); - SET_STRING_ELT(r_names, 0, Rf_mkChar("vertices")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("edges")); + PROTECT(all_reachable=NEW_LOGICAL(1)); + LOGICAL(all_reachable)[0]=c_all_reachable; + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); + SET_VECTOR_ELT(r_result, 0, res); + SET_VECTOR_ELT(r_result, 1, reachable_count); + SET_VECTOR_ELT(r_result, 2, all_reachable); + SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("reachable_count")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("all_reachable")); SET_NAMES(r_result, r_names); - UNPROTECT(3); + UNPROTECT(4); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_get_shortest_path_dijkstra / +/ igraph_closeness_cutoff / /-------------------------------------------*/ -SEXP R_igraph_get_shortest_path_dijkstra(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP mode) { +SEXP R_igraph_closeness_cutoff(SEXP graph, SEXP vids, SEXP mode, SEXP weights, SEXP normalized, SEXP cutoff) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_t c_vertices; - igraph_vector_int_t c_edges; - igraph_integer_t c_from; - igraph_integer_t c_to; - igraph_vector_t c_weights; + igraph_vector_t c_res; + igraph_vector_int_t c_reachable_count; + igraph_bool_t c_all_reachable; + igraph_vs_t c_vids; igraph_neimode_t c_mode; - SEXP vertices; - SEXP edges; + igraph_vector_t c_weights; + igraph_bool_t c_normalized; + igraph_real_t c_cutoff; + SEXP res; + SEXP reachable_count; + SEXP all_reachable; SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_vertices, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vertices); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_edges, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edges); - c_from = (igraph_integer_t) REAL(from)[0]; - c_to = (igraph_integer_t) REAL(to)[0]; + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_reachable_count, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_reachable_count); + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); if (!Rf_isNull(weights)) { Rz_SEXP_to_vector(weights, &c_weights); } - c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK_BOOL(normalized); + c_normalized = LOGICAL(normalized)[0]; + IGRAPH_R_CHECK_REAL(cutoff); + c_cutoff = REAL(cutoff)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_get_shortest_path_dijkstra(&c_graph, &c_vertices, &c_edges, c_from, c_to, (Rf_isNull(weights) ? 0 : &c_weights), c_mode)); + IGRAPH_R_CHECK(igraph_closeness_cutoff(&c_graph, &c_res, &c_reachable_count, &c_all_reachable, c_vids, c_mode, (Rf_isNull(weights) ? 0 : &c_weights), c_normalized, c_cutoff)); /* Convert output */ - PROTECT(r_result=NEW_LIST(2)); - PROTECT(r_names=NEW_CHARACTER(2)); - PROTECT(vertices=Ry_igraph_vector_int_to_SEXPp1(&c_vertices)); - igraph_vector_int_destroy(&c_vertices); + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); - PROTECT(edges=Ry_igraph_vector_int_to_SEXPp1(&c_edges)); - igraph_vector_int_destroy(&c_edges); + PROTECT(reachable_count=Ry_igraph_vector_int_to_SEXP(&c_reachable_count)); + igraph_vector_int_destroy(&c_reachable_count); IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, vertices); - SET_VECTOR_ELT(r_result, 1, edges); - SET_STRING_ELT(r_names, 0, Rf_mkChar("vertices")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("edges")); + PROTECT(all_reachable=NEW_LOGICAL(1)); + LOGICAL(all_reachable)[0]=c_all_reachable; + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); + SET_VECTOR_ELT(r_result, 0, res); + SET_VECTOR_ELT(r_result, 1, reachable_count); + SET_VECTOR_ELT(r_result, 2, all_reachable); + SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("reachable_count")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("all_reachable")); SET_NAMES(r_result, r_names); - UNPROTECT(3); + UNPROTECT(4); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_get_all_shortest_paths / +/ igraph_distances / /-------------------------------------------*/ -SEXP R_igraph_get_all_shortest_paths(SEXP graph, SEXP from, SEXP to, SEXP mode) { +SEXP R_igraph_distances(SEXP graph, SEXP from, SEXP to, SEXP mode) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_list_t c_vertices; - igraph_vector_int_list_t c_edges; - igraph_vector_int_t c_nrgeo; - igraph_integer_t c_from; + igraph_matrix_t c_res; + igraph_vs_t c_from; igraph_vs_t c_to; igraph_neimode_t c_mode; - SEXP vertices; - SEXP edges; - SEXP nrgeo; + SEXP res; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_vertices, 0)); - IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_vertices); - IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_edges, 0)); - IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_edges); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_nrgeo, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_nrgeo); - c_from = (igraph_integer_t) REAL(from)[0]; + IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); + igraph_vector_int_t c_from_data; + Rz_SEXP_to_igraph_vs(from, &c_graph, &c_from, &c_from_data); igraph_vector_int_t c_to_data; Rz_SEXP_to_igraph_vs(to, &c_graph, &c_to, &c_to_data); c_mode = (igraph_neimode_t) Rf_asInteger(mode); /* Call igraph */ - IGRAPH_R_CHECK(igraph_get_all_shortest_paths(&c_graph, &c_vertices, &c_edges, &c_nrgeo, c_from, c_to, c_mode)); + IGRAPH_R_CHECK(igraph_distances(&c_graph, &c_res, c_from, c_to, c_mode)); /* Convert output */ - PROTECT(r_result=NEW_LIST(3)); - PROTECT(r_names=NEW_CHARACTER(3)); - PROTECT(vertices=Ry_igraph_vector_int_list_to_SEXPp1(&c_vertices)); - igraph_vector_int_list_destroy(&c_vertices); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(edges=Ry_igraph_vector_int_list_to_SEXPp1(&c_edges)); - igraph_vector_int_list_destroy(&c_edges); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(nrgeo=Ry_igraph_vector_int_to_SEXP(&c_nrgeo)); - igraph_vector_int_destroy(&c_nrgeo); + PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); + igraph_matrix_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_from_data); + igraph_vs_destroy(&c_from); igraph_vector_int_destroy(&c_to_data); igraph_vs_destroy(&c_to); - SET_VECTOR_ELT(r_result, 0, vertices); - SET_VECTOR_ELT(r_result, 1, edges); - SET_VECTOR_ELT(r_result, 2, nrgeo); - SET_STRING_ELT(r_names, 0, Rf_mkChar("vpaths")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("epaths")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("nrgeo")); - SET_NAMES(r_result, r_names); - UNPROTECT(4); + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_get_all_shortest_paths_dijkstra / +/ igraph_distances_cutoff / /-------------------------------------------*/ -SEXP R_igraph_get_all_shortest_paths_dijkstra(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP mode) { +SEXP R_igraph_distances_cutoff(SEXP graph, SEXP from, SEXP to, SEXP mode, SEXP cutoff) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_list_t c_vertices; - igraph_vector_int_list_t c_edges; - igraph_vector_int_t c_nrgeo; - igraph_integer_t c_from; + igraph_matrix_t c_res; + igraph_vs_t c_from; igraph_vs_t c_to; - igraph_vector_t c_weights; igraph_neimode_t c_mode; - SEXP vertices; - SEXP edges; - SEXP nrgeo; + igraph_real_t c_cutoff; + SEXP res; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_vertices, 0)); - IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_vertices); - IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_edges, 0)); - IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_edges); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_nrgeo, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_nrgeo); - c_from = (igraph_integer_t) REAL(from)[0]; + IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); + igraph_vector_int_t c_from_data; + Rz_SEXP_to_igraph_vs(from, &c_graph, &c_from, &c_from_data); igraph_vector_int_t c_to_data; Rz_SEXP_to_igraph_vs(to, &c_graph, &c_to, &c_to_data); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK_REAL(cutoff); + c_cutoff = REAL(cutoff)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_get_all_shortest_paths_dijkstra(&c_graph, &c_vertices, &c_edges, &c_nrgeo, c_from, c_to, (Rf_isNull(weights) ? 0 : &c_weights), c_mode)); + IGRAPH_R_CHECK(igraph_distances_cutoff(&c_graph, &c_res, c_from, c_to, c_mode, c_cutoff)); /* Convert output */ - PROTECT(r_result=NEW_LIST(3)); - PROTECT(r_names=NEW_CHARACTER(3)); - PROTECT(vertices=Ry_igraph_vector_int_list_to_SEXPp1(&c_vertices)); - igraph_vector_int_list_destroy(&c_vertices); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(edges=Ry_igraph_vector_int_list_to_SEXPp1(&c_edges)); - igraph_vector_int_list_destroy(&c_edges); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(nrgeo=Ry_igraph_vector_int_to_SEXP(&c_nrgeo)); - igraph_vector_int_destroy(&c_nrgeo); + PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); + igraph_matrix_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_from_data); + igraph_vs_destroy(&c_from); igraph_vector_int_destroy(&c_to_data); igraph_vs_destroy(&c_to); - SET_VECTOR_ELT(r_result, 0, vertices); - SET_VECTOR_ELT(r_result, 1, edges); - SET_VECTOR_ELT(r_result, 2, nrgeo); - SET_STRING_ELT(r_names, 0, Rf_mkChar("vpaths")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("epaths")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("nrgeo")); - SET_NAMES(r_result, r_names); - UNPROTECT(4); + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_voronoi / +/ igraph_get_shortest_path / /-------------------------------------------*/ -SEXP R_igraph_voronoi(SEXP graph, SEXP generators, SEXP weights, SEXP mode, SEXP tiebreaker) { +SEXP R_igraph_get_shortest_path(SEXP graph, SEXP from, SEXP to, SEXP mode) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_t c_membership; - igraph_vector_t c_distances; - igraph_vector_int_t c_generators; - igraph_vector_t c_weights; + igraph_vector_int_t c_vertices; + igraph_vector_int_t c_edges; + igraph_integer_t c_from; + igraph_integer_t c_to; igraph_neimode_t c_mode; - igraph_voronoi_tiebreaker_t c_tiebreaker; - SEXP membership; - SEXP distances; + SEXP vertices; + SEXP edges; SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_membership, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_membership); - IGRAPH_R_CHECK(igraph_vector_init(&c_distances, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_distances); - Rz_SEXP_to_vector_int_copy(generators, &c_generators); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_generators); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } + IGRAPH_R_CHECK(igraph_vector_int_init(&c_vertices, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vertices); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_edges, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edges); + c_from = (igraph_integer_t) REAL(from)[0]; + c_to = (igraph_integer_t) REAL(to)[0]; c_mode = (igraph_neimode_t) Rf_asInteger(mode); - c_tiebreaker = (igraph_voronoi_tiebreaker_t) Rf_asInteger(tiebreaker); /* Call igraph */ - IGRAPH_R_CHECK(igraph_voronoi(&c_graph, &c_membership, &c_distances, &c_generators, (Rf_isNull(weights) ? 0 : &c_weights), c_mode, c_tiebreaker)); + IGRAPH_R_CHECK(igraph_get_shortest_path(&c_graph, &c_vertices, &c_edges, c_from, c_to, c_mode)); /* Convert output */ PROTECT(r_result=NEW_LIST(2)); PROTECT(r_names=NEW_CHARACTER(2)); - PROTECT(membership=Ry_igraph_vector_int_to_SEXP(&c_membership)); - igraph_vector_int_destroy(&c_membership); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(distances=Ry_igraph_vector_to_SEXP(&c_distances)); - igraph_vector_destroy(&c_distances); + PROTECT(vertices=Ry_igraph_vector_int_to_SEXPp1(&c_vertices)); + igraph_vector_int_destroy(&c_vertices); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_generators); + PROTECT(edges=Ry_igraph_vector_int_to_SEXPp1(&c_edges)); + igraph_vector_int_destroy(&c_edges); IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, membership); - SET_VECTOR_ELT(r_result, 1, distances); - SET_STRING_ELT(r_names, 0, Rf_mkChar("membership")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("distances")); + SET_VECTOR_ELT(r_result, 0, vertices); + SET_VECTOR_ELT(r_result, 1, edges); + SET_STRING_ELT(r_names, 0, Rf_mkChar("vertices")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("edges")); SET_NAMES(r_result, r_names); UNPROTECT(3); @@ -2795,91 +3859,100 @@ SEXP R_igraph_voronoi(SEXP graph, SEXP generators, SEXP weights, SEXP mode, SEXP } /*-------------------------------------------/ -/ igraph_get_all_simple_paths / +/ igraph_get_shortest_path_bellman_ford / /-------------------------------------------*/ -SEXP R_igraph_get_all_simple_paths(SEXP graph, SEXP from, SEXP to, SEXP cutoff, SEXP mode) { +SEXP R_igraph_get_shortest_path_bellman_ford(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP mode) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_t c_res; + igraph_vector_int_t c_vertices; + igraph_vector_int_t c_edges; igraph_integer_t c_from; - igraph_vs_t c_to; - igraph_integer_t c_cutoff; + igraph_integer_t c_to; + igraph_vector_t c_weights; igraph_neimode_t c_mode; - SEXP res; + SEXP vertices; + SEXP edges; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_res); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_vertices, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vertices); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_edges, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edges); c_from = (igraph_integer_t) REAL(from)[0]; - igraph_vector_int_t c_to_data; - Rz_SEXP_to_igraph_vs(to, &c_graph, &c_to, &c_to_data); - IGRAPH_R_CHECK_INT(cutoff); - c_cutoff = (igraph_integer_t) REAL(cutoff)[0]; + c_to = (igraph_integer_t) REAL(to)[0]; + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } c_mode = (igraph_neimode_t) Rf_asInteger(mode); /* Call igraph */ - IGRAPH_R_CHECK(igraph_get_all_simple_paths(&c_graph, &c_res, c_from, c_to, c_cutoff, c_mode)); + IGRAPH_R_CHECK(igraph_get_shortest_path_bellman_ford(&c_graph, &c_vertices, &c_edges, c_from, c_to, (Rf_isNull(weights) ? 0 : &c_weights), c_mode)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_int_to_SEXPp1(&c_res)); - igraph_vector_int_destroy(&c_res); + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + PROTECT(vertices=Ry_igraph_vector_int_to_SEXPp1(&c_vertices)); + igraph_vector_int_destroy(&c_vertices); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_to_data); - igraph_vs_destroy(&c_to); - r_result = res; + PROTECT(edges=Ry_igraph_vector_int_to_SEXPp1(&c_edges)); + igraph_vector_int_destroy(&c_edges); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, vertices); + SET_VECTOR_ELT(r_result, 1, edges); + SET_STRING_ELT(r_names, 0, Rf_mkChar("vertices")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("edges")); + SET_NAMES(r_result, r_names); + UNPROTECT(3); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_get_k_shortest_paths / +/ igraph_get_shortest_path_dijkstra / /-------------------------------------------*/ -SEXP R_igraph_get_k_shortest_paths(SEXP graph, SEXP weights, SEXP k, SEXP from, SEXP to, SEXP mode) { +SEXP R_igraph_get_shortest_path_dijkstra(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP mode) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_weights; - igraph_vector_int_list_t c_vertex_paths; - igraph_vector_int_list_t c_edge_paths; - igraph_integer_t c_k; + igraph_vector_int_t c_vertices; + igraph_vector_int_t c_edges; igraph_integer_t c_from; igraph_integer_t c_to; + igraph_vector_t c_weights; igraph_neimode_t c_mode; - SEXP vertex_paths; - SEXP edge_paths; + SEXP vertices; + SEXP edges; SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_vertices, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vertices); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_edges, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edges); + c_from = (igraph_integer_t) REAL(from)[0]; + c_to = (igraph_integer_t) REAL(to)[0]; if (!Rf_isNull(weights)) { Rz_SEXP_to_vector(weights, &c_weights); } - IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_vertex_paths, 0)); - IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_vertex_paths); - IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_edge_paths, 0)); - IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_edge_paths); - IGRAPH_R_CHECK_INT(k); - c_k = (igraph_integer_t) REAL(k)[0]; - c_from = (igraph_integer_t) REAL(from)[0]; - c_to = (igraph_integer_t) REAL(to)[0]; c_mode = (igraph_neimode_t) Rf_asInteger(mode); /* Call igraph */ - IGRAPH_R_CHECK(igraph_get_k_shortest_paths(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_vertex_paths, &c_edge_paths, c_k, c_from, c_to, c_mode)); + IGRAPH_R_CHECK(igraph_get_shortest_path_dijkstra(&c_graph, &c_vertices, &c_edges, c_from, c_to, (Rf_isNull(weights) ? 0 : &c_weights), c_mode)); /* Convert output */ PROTECT(r_result=NEW_LIST(2)); PROTECT(r_names=NEW_CHARACTER(2)); - PROTECT(vertex_paths=Ry_igraph_vector_int_list_to_SEXPp1(&c_vertex_paths)); - igraph_vector_int_list_destroy(&c_vertex_paths); + PROTECT(vertices=Ry_igraph_vector_int_to_SEXPp1(&c_vertices)); + igraph_vector_int_destroy(&c_vertices); IGRAPH_FINALLY_CLEAN(1); - PROTECT(edge_paths=Ry_igraph_vector_int_list_to_SEXPp1(&c_edge_paths)); - igraph_vector_int_list_destroy(&c_edge_paths); + PROTECT(edges=Ry_igraph_vector_int_to_SEXPp1(&c_edges)); + igraph_vector_int_destroy(&c_edges); IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, vertex_paths); - SET_VECTOR_ELT(r_result, 1, edge_paths); - SET_STRING_ELT(r_names, 0, Rf_mkChar("vpaths")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("epaths")); + SET_VECTOR_ELT(r_result, 0, vertices); + SET_VECTOR_ELT(r_result, 1, edges); + SET_STRING_ELT(r_names, 0, Rf_mkChar("vertices")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("edges")); SET_NAMES(r_result, r_names); UNPROTECT(3); @@ -2888,9 +3961,9 @@ SEXP R_igraph_get_k_shortest_paths(SEXP graph, SEXP weights, SEXP k, SEXP from, } /*-------------------------------------------/ -/ igraph_get_widest_path / +/ igraph_get_shortest_path_astar / /-------------------------------------------*/ -SEXP R_igraph_get_widest_path(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP mode) { +SEXP R_igraph_get_shortest_path_astar(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP mode) { /* Declarations */ igraph_t c_graph; igraph_vector_int_t c_vertices; @@ -2899,6 +3972,8 @@ SEXP R_igraph_get_widest_path(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP igraph_integer_t c_to; igraph_vector_t c_weights; igraph_neimode_t c_mode; + + SEXP vertices; SEXP edges; @@ -2911,10 +3986,12 @@ SEXP R_igraph_get_widest_path(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edges); c_from = (igraph_integer_t) REAL(from)[0]; c_to = (igraph_integer_t) REAL(to)[0]; - Rz_SEXP_to_vector(weights, &c_weights); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } c_mode = (igraph_neimode_t) Rf_asInteger(mode); /* Call igraph */ - IGRAPH_R_CHECK(igraph_get_widest_path(&c_graph, &c_vertices, &c_edges, c_from, c_to, &c_weights, c_mode)); + IGRAPH_R_CHECK(igraph_get_shortest_path_astar(&c_graph, &c_vertices, &c_edges, c_from, c_to, (Rf_isNull(weights) ? 0 : &c_weights), c_mode, 0, 0)); /* Convert output */ PROTECT(r_result=NEW_LIST(2)); @@ -2937,16 +4014,15 @@ SEXP R_igraph_get_widest_path(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP } /*-------------------------------------------/ -/ igraph_get_widest_paths / +/ igraph_get_shortest_paths / /-------------------------------------------*/ -SEXP R_igraph_get_widest_paths(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP mode) { +SEXP R_igraph_get_shortest_paths(SEXP graph, SEXP from, SEXP to, SEXP mode) { /* Declarations */ igraph_t c_graph; igraph_vector_int_list_t c_vertices; igraph_vector_int_list_t c_edges; igraph_integer_t c_from; igraph_vs_t c_to; - igraph_vector_t c_weights; igraph_neimode_t c_mode; igraph_vector_int_t c_parents; igraph_vector_int_t c_inbound_edges; @@ -2965,14 +4041,13 @@ SEXP R_igraph_get_widest_paths(SEXP graph, SEXP from, SEXP to, SEXP weights, SEX c_from = (igraph_integer_t) REAL(from)[0]; igraph_vector_int_t c_to_data; Rz_SEXP_to_igraph_vs(to, &c_graph, &c_to, &c_to_data); - Rz_SEXP_to_vector(weights, &c_weights); c_mode = (igraph_neimode_t) Rf_asInteger(mode); IGRAPH_R_CHECK(igraph_vector_int_init(&c_parents, 0)); IGRAPH_FINALLY(igraph_vector_int_destroy, &c_parents); IGRAPH_R_CHECK(igraph_vector_int_init(&c_inbound_edges, 0)); IGRAPH_FINALLY(igraph_vector_int_destroy, &c_inbound_edges); /* Call igraph */ - IGRAPH_R_CHECK(igraph_get_widest_paths(&c_graph, &c_vertices, &c_edges, c_from, c_to, &c_weights, c_mode, &c_parents, &c_inbound_edges)); + IGRAPH_R_CHECK(igraph_get_shortest_paths(&c_graph, &c_vertices, &c_edges, c_from, c_to, c_mode, &c_parents, &c_inbound_edges)); /* Convert output */ PROTECT(r_result=NEW_LIST(4)); @@ -3007,50 +4082,68 @@ SEXP R_igraph_get_widest_paths(SEXP graph, SEXP from, SEXP to, SEXP weights, SEX } /*-------------------------------------------/ -/ igraph_widest_path_widths_dijkstra / +/ igraph_get_all_shortest_paths / /-------------------------------------------*/ -SEXP R_igraph_widest_path_widths_dijkstra(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP mode) { +SEXP R_igraph_get_all_shortest_paths(SEXP graph, SEXP from, SEXP to, SEXP mode) { /* Declarations */ igraph_t c_graph; - igraph_matrix_t c_res; - igraph_vs_t c_from; + igraph_vector_int_list_t c_vertices; + igraph_vector_int_list_t c_edges; + igraph_vector_int_t c_nrgeo; + igraph_integer_t c_from; igraph_vs_t c_to; - igraph_vector_t c_weights; igraph_neimode_t c_mode; - SEXP res; + SEXP vertices; + SEXP edges; + SEXP nrgeo; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); - IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); - igraph_vector_int_t c_from_data; - Rz_SEXP_to_igraph_vs(from, &c_graph, &c_from, &c_from_data); + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_vertices, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_vertices); + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_edges, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_edges); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_nrgeo, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_nrgeo); + c_from = (igraph_integer_t) REAL(from)[0]; igraph_vector_int_t c_to_data; Rz_SEXP_to_igraph_vs(to, &c_graph, &c_to, &c_to_data); - Rz_SEXP_to_vector(weights, &c_weights); c_mode = (igraph_neimode_t) Rf_asInteger(mode); /* Call igraph */ - IGRAPH_R_CHECK(igraph_widest_path_widths_dijkstra(&c_graph, &c_res, c_from, c_to, &c_weights, c_mode)); + IGRAPH_R_CHECK(igraph_get_all_shortest_paths(&c_graph, &c_vertices, &c_edges, &c_nrgeo, c_from, c_to, c_mode)); /* Convert output */ - PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); - igraph_matrix_destroy(&c_res); + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(vertices=Ry_igraph_vector_int_list_to_SEXPp1(&c_vertices)); + igraph_vector_int_list_destroy(&c_vertices); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(edges=Ry_igraph_vector_int_list_to_SEXPp1(&c_edges)); + igraph_vector_int_list_destroy(&c_edges); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(nrgeo=Ry_igraph_vector_int_to_SEXP(&c_nrgeo)); + igraph_vector_int_destroy(&c_nrgeo); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_from_data); - igraph_vs_destroy(&c_from); igraph_vector_int_destroy(&c_to_data); igraph_vs_destroy(&c_to); - r_result = res; + SET_VECTOR_ELT(r_result, 0, vertices); + SET_VECTOR_ELT(r_result, 1, edges); + SET_VECTOR_ELT(r_result, 2, nrgeo); + SET_STRING_ELT(r_names, 0, Rf_mkChar("vpaths")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("epaths")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("nrgeo")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_widest_path_widths_floyd_warshall / +/ igraph_distances_dijkstra / /-------------------------------------------*/ -SEXP R_igraph_widest_path_widths_floyd_warshall(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP mode) { +SEXP R_igraph_distances_dijkstra(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP mode) { /* Declarations */ igraph_t c_graph; igraph_matrix_t c_res; @@ -3069,10 +4162,12 @@ SEXP R_igraph_widest_path_widths_floyd_warshall(SEXP graph, SEXP from, SEXP to, Rz_SEXP_to_igraph_vs(from, &c_graph, &c_from, &c_from_data); igraph_vector_int_t c_to_data; Rz_SEXP_to_igraph_vs(to, &c_graph, &c_to, &c_to_data); - Rz_SEXP_to_vector(weights, &c_weights); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } c_mode = (igraph_neimode_t) Rf_asInteger(mode); /* Call igraph */ - IGRAPH_R_CHECK(igraph_widest_path_widths_floyd_warshall(&c_graph, &c_res, c_from, c_to, &c_weights, c_mode)); + IGRAPH_R_CHECK(igraph_distances_dijkstra(&c_graph, &c_res, c_from, c_to, (Rf_isNull(weights) ? 0 : &c_weights), c_mode)); /* Convert output */ PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); @@ -3089,195 +4184,295 @@ SEXP R_igraph_widest_path_widths_floyd_warshall(SEXP graph, SEXP from, SEXP to, } /*-------------------------------------------/ -/ igraph_spanner / +/ igraph_distances_dijkstra_cutoff / /-------------------------------------------*/ -SEXP R_igraph_spanner(SEXP graph, SEXP stretch, SEXP weights) { +SEXP R_igraph_distances_dijkstra_cutoff(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP mode, SEXP cutoff) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_t c_spanner; - igraph_real_t c_stretch; + igraph_matrix_t c_res; + igraph_vs_t c_from; + igraph_vs_t c_to; igraph_vector_t c_weights; - SEXP spanner; + igraph_neimode_t c_mode; + igraph_real_t c_cutoff; + SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_spanner, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_spanner); - IGRAPH_R_CHECK_REAL(stretch); - c_stretch = REAL(stretch)[0]; + IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); + igraph_vector_int_t c_from_data; + Rz_SEXP_to_igraph_vs(from, &c_graph, &c_from, &c_from_data); + igraph_vector_int_t c_to_data; + Rz_SEXP_to_igraph_vs(to, &c_graph, &c_to, &c_to_data); if (!Rf_isNull(weights)) { Rz_SEXP_to_vector(weights, &c_weights); } + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK_REAL(cutoff); + c_cutoff = REAL(cutoff)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_spanner(&c_graph, &c_spanner, c_stretch, (Rf_isNull(weights) ? 0 : &c_weights))); + IGRAPH_R_CHECK(igraph_distances_dijkstra_cutoff(&c_graph, &c_res, c_from, c_to, (Rf_isNull(weights) ? 0 : &c_weights), c_mode, c_cutoff)); /* Convert output */ - PROTECT(spanner=Ry_igraph_vector_int_to_SEXPp1(&c_spanner)); - igraph_vector_int_destroy(&c_spanner); + PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); + igraph_matrix_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); - r_result = spanner; + igraph_vector_int_destroy(&c_from_data); + igraph_vs_destroy(&c_from); + igraph_vector_int_destroy(&c_to_data); + igraph_vs_destroy(&c_to); + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_betweenness_cutoff / +/ igraph_get_shortest_paths_dijkstra / /-------------------------------------------*/ -SEXP R_igraph_betweenness_cutoff(SEXP graph, SEXP vids, SEXP directed, SEXP weights, SEXP cutoff) { +SEXP R_igraph_get_shortest_paths_dijkstra(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP mode) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_res; - igraph_vs_t c_vids; - igraph_bool_t c_directed; + igraph_vector_int_list_t c_vertices; + igraph_vector_int_list_t c_edges; + igraph_integer_t c_from; + igraph_vs_t c_to; igraph_vector_t c_weights; - igraph_real_t c_cutoff; - SEXP res; + igraph_neimode_t c_mode; + igraph_vector_int_t c_parents; + igraph_vector_int_t c_inbound_edges; + SEXP vertices; + SEXP edges; + SEXP parents; + SEXP inbound_edges; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_res); - igraph_vector_int_t c_vids_data; - Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_vertices, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_vertices); + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_edges, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_edges); + c_from = (igraph_integer_t) REAL(from)[0]; + igraph_vector_int_t c_to_data; + Rz_SEXP_to_igraph_vs(to, &c_graph, &c_to, &c_to_data); if (!Rf_isNull(weights)) { Rz_SEXP_to_vector(weights, &c_weights); } - IGRAPH_R_CHECK_REAL(cutoff); - c_cutoff = REAL(cutoff)[0]; + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_parents, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_parents); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_inbound_edges, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_inbound_edges); /* Call igraph */ - IGRAPH_R_CHECK(igraph_betweenness_cutoff(&c_graph, &c_res, c_vids, c_directed, (Rf_isNull(weights) ? 0 : &c_weights), c_cutoff)); + IGRAPH_R_CHECK(igraph_get_shortest_paths_dijkstra(&c_graph, &c_vertices, &c_edges, c_from, c_to, (Rf_isNull(weights) ? 0 : &c_weights), c_mode, &c_parents, &c_inbound_edges)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); - igraph_vector_destroy(&c_res); + PROTECT(r_result=NEW_LIST(4)); + PROTECT(r_names=NEW_CHARACTER(4)); + PROTECT(vertices=Ry_igraph_vector_int_list_to_SEXPp1(&c_vertices)); + igraph_vector_int_list_destroy(&c_vertices); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_vids_data); - igraph_vs_destroy(&c_vids); - r_result = res; + PROTECT(edges=Ry_igraph_vector_int_list_to_SEXPp1(&c_edges)); + igraph_vector_int_list_destroy(&c_edges); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_to_data); + igraph_vs_destroy(&c_to); + PROTECT(parents=Ry_igraph_vector_int_to_SEXP(&c_parents)); + igraph_vector_int_destroy(&c_parents); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(inbound_edges=Ry_igraph_vector_int_to_SEXP(&c_inbound_edges)); + igraph_vector_int_destroy(&c_inbound_edges); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, vertices); + SET_VECTOR_ELT(r_result, 1, edges); + SET_VECTOR_ELT(r_result, 2, parents); + SET_VECTOR_ELT(r_result, 3, inbound_edges); + SET_STRING_ELT(r_names, 0, Rf_mkChar("vertices")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("edges")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("parents")); + SET_STRING_ELT(r_names, 3, Rf_mkChar("inbound_edges")); + SET_NAMES(r_result, r_names); + UNPROTECT(5); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_betweenness_subset / +/ igraph_get_shortest_paths_bellman_ford / /-------------------------------------------*/ -SEXP R_igraph_betweenness_subset(SEXP graph, SEXP vids, SEXP directed, SEXP sources, SEXP targets, SEXP weights) { +SEXP R_igraph_get_shortest_paths_bellman_ford(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP mode) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_res; - igraph_vs_t c_vids; - igraph_bool_t c_directed; - igraph_vs_t c_sources; - igraph_vs_t c_targets; + igraph_vector_int_list_t c_vertices; + igraph_vector_int_list_t c_edges; + igraph_integer_t c_from; + igraph_vs_t c_to; igraph_vector_t c_weights; - SEXP res; + igraph_neimode_t c_mode; + igraph_vector_int_t c_parents; + igraph_vector_int_t c_inbound_edges; + SEXP vertices; + SEXP edges; + SEXP parents; + SEXP inbound_edges; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_res); - igraph_vector_int_t c_vids_data; - Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; - igraph_vector_int_t c_sources_data; - Rz_SEXP_to_igraph_vs(sources, &c_graph, &c_sources, &c_sources_data); - igraph_vector_int_t c_targets_data; - Rz_SEXP_to_igraph_vs(targets, &c_graph, &c_targets, &c_targets_data); + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_vertices, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_vertices); + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_edges, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_edges); + c_from = (igraph_integer_t) REAL(from)[0]; + igraph_vector_int_t c_to_data; + Rz_SEXP_to_igraph_vs(to, &c_graph, &c_to, &c_to_data); if (!Rf_isNull(weights)) { Rz_SEXP_to_vector(weights, &c_weights); } + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_parents, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_parents); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_inbound_edges, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_inbound_edges); /* Call igraph */ - IGRAPH_R_CHECK(igraph_betweenness_subset(&c_graph, &c_res, c_vids, c_directed, c_sources, c_targets, (Rf_isNull(weights) ? 0 : &c_weights))); + IGRAPH_R_CHECK(igraph_get_shortest_paths_bellman_ford(&c_graph, &c_vertices, &c_edges, c_from, c_to, (Rf_isNull(weights) ? 0 : &c_weights), c_mode, &c_parents, &c_inbound_edges)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); - igraph_vector_destroy(&c_res); + PROTECT(r_result=NEW_LIST(4)); + PROTECT(r_names=NEW_CHARACTER(4)); + PROTECT(vertices=Ry_igraph_vector_int_list_to_SEXPp1(&c_vertices)); + igraph_vector_int_list_destroy(&c_vertices); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_vids_data); - igraph_vs_destroy(&c_vids); - igraph_vector_int_destroy(&c_sources_data); - igraph_vs_destroy(&c_sources); - igraph_vector_int_destroy(&c_targets_data); - igraph_vs_destroy(&c_targets); - r_result = res; + PROTECT(edges=Ry_igraph_vector_int_list_to_SEXPp1(&c_edges)); + igraph_vector_int_list_destroy(&c_edges); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_to_data); + igraph_vs_destroy(&c_to); + PROTECT(parents=Ry_igraph_vector_int_to_SEXP(&c_parents)); + igraph_vector_int_destroy(&c_parents); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(inbound_edges=Ry_igraph_vector_int_to_SEXP(&c_inbound_edges)); + igraph_vector_int_destroy(&c_inbound_edges); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, vertices); + SET_VECTOR_ELT(r_result, 1, edges); + SET_VECTOR_ELT(r_result, 2, parents); + SET_VECTOR_ELT(r_result, 3, inbound_edges); + SET_STRING_ELT(r_names, 0, Rf_mkChar("vertices")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("edges")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("parents")); + SET_STRING_ELT(r_names, 3, Rf_mkChar("inbound_edges")); + SET_NAMES(r_result, r_names); + UNPROTECT(5); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_edge_betweenness / +/ igraph_get_all_shortest_paths_dijkstra / /-------------------------------------------*/ -SEXP R_igraph_edge_betweenness(SEXP graph, SEXP directed, SEXP weights) { +SEXP R_igraph_get_all_shortest_paths_dijkstra(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP mode) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_res; - igraph_bool_t c_directed; + igraph_vector_int_list_t c_vertices; + igraph_vector_int_list_t c_edges; + igraph_vector_int_t c_nrgeo; + igraph_integer_t c_from; + igraph_vs_t c_to; igraph_vector_t c_weights; - SEXP res; + igraph_neimode_t c_mode; + SEXP vertices; + SEXP edges; + SEXP nrgeo; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_res); - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_vertices, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_vertices); + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_edges, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_edges); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_nrgeo, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_nrgeo); + c_from = (igraph_integer_t) REAL(from)[0]; + igraph_vector_int_t c_to_data; + Rz_SEXP_to_igraph_vs(to, &c_graph, &c_to, &c_to_data); if (!Rf_isNull(weights)) { Rz_SEXP_to_vector(weights, &c_weights); } + c_mode = (igraph_neimode_t) Rf_asInteger(mode); /* Call igraph */ - IGRAPH_R_CHECK(igraph_edge_betweenness(&c_graph, &c_res, c_directed, (Rf_isNull(weights) ? 0 : &c_weights))); + IGRAPH_R_CHECK(igraph_get_all_shortest_paths_dijkstra(&c_graph, &c_vertices, &c_edges, &c_nrgeo, c_from, c_to, (Rf_isNull(weights) ? 0 : &c_weights), c_mode)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); - igraph_vector_destroy(&c_res); - IGRAPH_FINALLY_CLEAN(1); - r_result = res; - + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(vertices=Ry_igraph_vector_int_list_to_SEXPp1(&c_vertices)); + igraph_vector_int_list_destroy(&c_vertices); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(edges=Ry_igraph_vector_int_list_to_SEXPp1(&c_edges)); + igraph_vector_int_list_destroy(&c_edges); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(nrgeo=Ry_igraph_vector_int_to_SEXP(&c_nrgeo)); + igraph_vector_int_destroy(&c_nrgeo); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_to_data); + igraph_vs_destroy(&c_to); + SET_VECTOR_ELT(r_result, 0, vertices); + SET_VECTOR_ELT(r_result, 1, edges); + SET_VECTOR_ELT(r_result, 2, nrgeo); + SET_STRING_ELT(r_names, 0, Rf_mkChar("vpaths")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("epaths")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("nrgeo")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); + UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_edge_betweenness_cutoff / +/ igraph_distances_bellman_ford / /-------------------------------------------*/ -SEXP R_igraph_edge_betweenness_cutoff(SEXP graph, SEXP directed, SEXP weights, SEXP cutoff) { +SEXP R_igraph_distances_bellman_ford(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP mode) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_res; - igraph_bool_t c_directed; + igraph_matrix_t c_res; + igraph_vs_t c_from; + igraph_vs_t c_to; igraph_vector_t c_weights; - igraph_real_t c_cutoff; + igraph_neimode_t c_mode; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_res); - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; + IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); + igraph_vector_int_t c_from_data; + Rz_SEXP_to_igraph_vs(from, &c_graph, &c_from, &c_from_data); + igraph_vector_int_t c_to_data; + Rz_SEXP_to_igraph_vs(to, &c_graph, &c_to, &c_to_data); if (!Rf_isNull(weights)) { Rz_SEXP_to_vector(weights, &c_weights); } - IGRAPH_R_CHECK_REAL(cutoff); - c_cutoff = REAL(cutoff)[0]; + c_mode = (igraph_neimode_t) Rf_asInteger(mode); /* Call igraph */ - IGRAPH_R_CHECK(igraph_edge_betweenness_cutoff(&c_graph, &c_res, c_directed, (Rf_isNull(weights) ? 0 : &c_weights), c_cutoff)); + IGRAPH_R_CHECK(igraph_distances_bellman_ford(&c_graph, &c_res, c_from, c_to, (Rf_isNull(weights) ? 0 : &c_weights), c_mode)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); - igraph_vector_destroy(&c_res); + PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); + igraph_matrix_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_from_data); + igraph_vs_destroy(&c_from); + igraph_vector_int_destroy(&c_to_data); + igraph_vs_destroy(&c_to); r_result = res; UNPROTECT(1); @@ -3285,48 +4480,40 @@ SEXP R_igraph_edge_betweenness_cutoff(SEXP graph, SEXP directed, SEXP weights, S } /*-------------------------------------------/ -/ igraph_edge_betweenness_subset / +/ igraph_distances_johnson / /-------------------------------------------*/ -SEXP R_igraph_edge_betweenness_subset(SEXP graph, SEXP eids, SEXP directed, SEXP sources, SEXP targets, SEXP weights) { +SEXP R_igraph_distances_johnson(SEXP graph, SEXP from, SEXP to, SEXP weights) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_res; - igraph_es_t c_eids; - igraph_bool_t c_directed; - igraph_vs_t c_sources; - igraph_vs_t c_targets; + igraph_matrix_t c_res; + igraph_vs_t c_from; + igraph_vs_t c_to; igraph_vector_t c_weights; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_res); - igraph_vector_int_t c_eids_data; - IGRAPH_R_CHECK(Rz_SEXP_to_igraph_es(eids, &c_graph, &c_eids, &c_eids_data)); - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; - igraph_vector_int_t c_sources_data; - Rz_SEXP_to_igraph_vs(sources, &c_graph, &c_sources, &c_sources_data); - igraph_vector_int_t c_targets_data; - Rz_SEXP_to_igraph_vs(targets, &c_graph, &c_targets, &c_targets_data); + IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); + igraph_vector_int_t c_from_data; + Rz_SEXP_to_igraph_vs(from, &c_graph, &c_from, &c_from_data); + igraph_vector_int_t c_to_data; + Rz_SEXP_to_igraph_vs(to, &c_graph, &c_to, &c_to_data); if (!Rf_isNull(weights)) { Rz_SEXP_to_vector(weights, &c_weights); } /* Call igraph */ - IGRAPH_R_CHECK(igraph_edge_betweenness_subset(&c_graph, &c_res, c_eids, c_directed, c_sources, c_targets, (Rf_isNull(weights) ? 0 : &c_weights))); + IGRAPH_R_CHECK(igraph_distances_johnson(&c_graph, &c_res, c_from, c_to, (Rf_isNull(weights) ? 0 : &c_weights))); /* Convert output */ - PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); - igraph_vector_destroy(&c_res); + PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); + igraph_matrix_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_eids_data); - igraph_es_destroy(&c_eids); - igraph_vector_int_destroy(&c_sources_data); - igraph_vs_destroy(&c_sources); - igraph_vector_int_destroy(&c_targets_data); - igraph_vs_destroy(&c_targets); + igraph_vector_int_destroy(&c_from_data); + igraph_vs_destroy(&c_from); + igraph_vector_int_destroy(&c_to_data); + igraph_vs_destroy(&c_to); r_result = res; UNPROTECT(1); @@ -3334,43 +4521,44 @@ SEXP R_igraph_edge_betweenness_subset(SEXP graph, SEXP eids, SEXP directed, SEXP } /*-------------------------------------------/ -/ igraph_harmonic_centrality_cutoff / +/ igraph_distances_floyd_warshall / /-------------------------------------------*/ -SEXP R_igraph_harmonic_centrality_cutoff(SEXP graph, SEXP vids, SEXP mode, SEXP weights, SEXP normalized, SEXP cutoff) { +SEXP R_igraph_distances_floyd_warshall(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP mode, SEXP method) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_res; - igraph_vs_t c_vids; - igraph_neimode_t c_mode; + igraph_matrix_t c_res; + igraph_vs_t c_from; + igraph_vs_t c_to; igraph_vector_t c_weights; - igraph_bool_t c_normalized; - igraph_real_t c_cutoff; + igraph_neimode_t c_mode; + igraph_floyd_warshall_algorithm_t c_method; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_res); - igraph_vector_int_t c_vids_data; - Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); - c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); + igraph_vector_int_t c_from_data; + Rz_SEXP_to_igraph_vs(from, &c_graph, &c_from, &c_from_data); + igraph_vector_int_t c_to_data; + Rz_SEXP_to_igraph_vs(to, &c_graph, &c_to, &c_to_data); if (!Rf_isNull(weights)) { Rz_SEXP_to_vector(weights, &c_weights); } - IGRAPH_R_CHECK_BOOL(normalized); - c_normalized = LOGICAL(normalized)[0]; - IGRAPH_R_CHECK_REAL(cutoff); - c_cutoff = REAL(cutoff)[0]; + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + c_method = (igraph_floyd_warshall_algorithm_t) Rf_asInteger(method); /* Call igraph */ - IGRAPH_R_CHECK(igraph_harmonic_centrality_cutoff(&c_graph, &c_res, c_vids, c_mode, (Rf_isNull(weights) ? 0 : &c_weights), c_normalized, c_cutoff)); + IGRAPH_R_CHECK(igraph_distances_floyd_warshall(&c_graph, &c_res, c_from, c_to, (Rf_isNull(weights) ? 0 : &c_weights), c_mode, c_method)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); - igraph_vector_destroy(&c_res); + PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); + igraph_matrix_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_vids_data); - igraph_vs_destroy(&c_vids); + igraph_vector_int_destroy(&c_from_data); + igraph_vs_destroy(&c_from); + igraph_vector_int_destroy(&c_to_data); + igraph_vs_destroy(&c_to); r_result = res; UNPROTECT(1); @@ -3378,117 +4566,937 @@ SEXP R_igraph_harmonic_centrality_cutoff(SEXP graph, SEXP vids, SEXP mode, SEXP } /*-------------------------------------------/ -/ igraph_personalized_pagerank / +/ igraph_voronoi / /-------------------------------------------*/ -SEXP R_igraph_personalized_pagerank(SEXP graph, SEXP algo, SEXP vids, SEXP directed, SEXP damping, SEXP personalized, SEXP weights, SEXP options) { +SEXP R_igraph_voronoi(SEXP graph, SEXP generators, SEXP weights, SEXP mode, SEXP tiebreaker) { /* Declarations */ igraph_t c_graph; - igraph_pagerank_algo_t c_algo; - igraph_vector_t c_vector; - igraph_real_t c_value; - igraph_vs_t c_vids; - igraph_bool_t c_directed; - igraph_real_t c_damping; - igraph_vector_t c_personalized; + igraph_vector_int_t c_membership; + igraph_vector_t c_distances; + igraph_vector_int_t c_generators; igraph_vector_t c_weights; - igraph_arpack_options_t c_options1; - void* c_options; - SEXP vector; - SEXP value; + igraph_neimode_t c_mode; + igraph_voronoi_tiebreaker_t c_tiebreaker; + SEXP membership; + SEXP distances; SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - c_algo = (igraph_pagerank_algo_t) Rf_asInteger(algo); - IGRAPH_R_CHECK(igraph_vector_init(&c_vector, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_vector); - igraph_vector_int_t c_vids_data; - Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; - IGRAPH_R_CHECK_REAL(damping); - c_damping = REAL(damping)[0]; - if (!Rf_isNull(personalized)) { - Rz_SEXP_to_vector(personalized, &c_personalized); - } + IGRAPH_R_CHECK(igraph_vector_int_init(&c_membership, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_membership); + IGRAPH_R_CHECK(igraph_vector_init(&c_distances, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_distances); + Rz_SEXP_to_vector_int_copy(generators, &c_generators); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_generators); if (!Rf_isNull(weights)) { Rz_SEXP_to_vector(weights, &c_weights); } - if (!Rf_isNull(options)) { - if (c_algo == IGRAPH_PAGERANK_ALGO_ARPACK) { - Rz_SEXP_to_igraph_arpack_options(options, &c_options1); - c_options = &c_options1; - } else { - c_options = NULL; - } - } + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + c_tiebreaker = (igraph_voronoi_tiebreaker_t) Rf_asInteger(tiebreaker); /* Call igraph */ - IGRAPH_R_CHECK(igraph_personalized_pagerank(&c_graph, c_algo, &c_vector, &c_value, c_vids, c_directed, c_damping, (Rf_isNull(personalized) ? 0 : &c_personalized), (Rf_isNull(weights) ? 0 : &c_weights), c_options)); + IGRAPH_R_CHECK(igraph_voronoi(&c_graph, &c_membership, &c_distances, &c_generators, (Rf_isNull(weights) ? 0 : &c_weights), c_mode, c_tiebreaker)); /* Convert output */ - PROTECT(r_result=NEW_LIST(3)); - PROTECT(r_names=NEW_CHARACTER(3)); - PROTECT(vector=Ry_igraph_vector_to_SEXP(&c_vector)); - igraph_vector_destroy(&c_vector); + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + PROTECT(membership=Ry_igraph_vector_int_to_SEXP(&c_membership)); + igraph_vector_int_destroy(&c_membership); IGRAPH_FINALLY_CLEAN(1); - PROTECT(value=NEW_NUMERIC(1)); - REAL(value)[0]=c_value; - igraph_vector_int_destroy(&c_vids_data); - igraph_vs_destroy(&c_vids); - if (c_algo == IGRAPH_PAGERANK_ALGO_ARPACK) { - PROTECT(options = Ry_igraph_arpack_options_to_SEXP(&c_options1)); - } else { - PROTECT(options); - } - SET_VECTOR_ELT(r_result, 0, vector); - SET_VECTOR_ELT(r_result, 1, value); - SET_VECTOR_ELT(r_result, 2, options); - SET_STRING_ELT(r_names, 0, Rf_mkChar("vector")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("value")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("options")); + PROTECT(distances=Ry_igraph_vector_to_SEXP(&c_distances)); + igraph_vector_destroy(&c_distances); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_generators); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, membership); + SET_VECTOR_ELT(r_result, 1, distances); + SET_STRING_ELT(r_names, 0, Rf_mkChar("membership")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("distances")); SET_NAMES(r_result, r_names); - UNPROTECT(4); + UNPROTECT(3); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_personalized_pagerank_vs / +/ igraph_get_all_simple_paths / /-------------------------------------------*/ -SEXP R_igraph_personalized_pagerank_vs(SEXP graph, SEXP algo, SEXP vids, SEXP directed, SEXP damping, SEXP reset_vids, SEXP weights, SEXP options) { +SEXP R_igraph_get_all_simple_paths(SEXP graph, SEXP from, SEXP to, SEXP cutoff, SEXP mode) { /* Declarations */ igraph_t c_graph; - igraph_pagerank_algo_t c_algo; - igraph_vector_t c_vector; - igraph_real_t c_value; - igraph_vs_t c_vids; - igraph_bool_t c_directed; - igraph_real_t c_damping; - igraph_vs_t c_reset_vids; - igraph_vector_t c_weights; - igraph_arpack_options_t c_options1; - void* c_options; - SEXP vector; - SEXP value; + igraph_vector_int_t c_res; + igraph_integer_t c_from; + igraph_vs_t c_to; + igraph_integer_t c_cutoff; + igraph_neimode_t c_mode; + SEXP res; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - c_algo = (igraph_pagerank_algo_t) Rf_asInteger(algo); - IGRAPH_R_CHECK(igraph_vector_init(&c_vector, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_vector); - igraph_vector_int_t c_vids_data; - Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; - IGRAPH_R_CHECK_REAL(damping); - c_damping = REAL(damping)[0]; - igraph_vector_int_t c_reset_vids_data; - Rz_SEXP_to_igraph_vs(reset_vids, &c_graph, &c_reset_vids, &c_reset_vids_data); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } + IGRAPH_R_CHECK(igraph_vector_int_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_res); + c_from = (igraph_integer_t) REAL(from)[0]; + igraph_vector_int_t c_to_data; + Rz_SEXP_to_igraph_vs(to, &c_graph, &c_to, &c_to_data); + IGRAPH_R_CHECK_INT(cutoff); + c_cutoff = (igraph_integer_t) REAL(cutoff)[0]; + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_get_all_simple_paths(&c_graph, &c_res, c_from, c_to, c_cutoff, c_mode)); + + /* Convert output */ + PROTECT(res=Ry_igraph_vector_int_to_SEXPp1(&c_res)); + igraph_vector_int_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_to_data); + igraph_vs_destroy(&c_to); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_get_k_shortest_paths / +/-------------------------------------------*/ +SEXP R_igraph_get_k_shortest_paths(SEXP graph, SEXP weights, SEXP k, SEXP from, SEXP to, SEXP mode) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_weights; + igraph_vector_int_list_t c_vertex_paths; + igraph_vector_int_list_t c_edge_paths; + igraph_integer_t c_k; + igraph_integer_t c_from; + igraph_integer_t c_to; + igraph_neimode_t c_mode; + SEXP vertex_paths; + SEXP edge_paths; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_vertex_paths, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_vertex_paths); + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_edge_paths, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_edge_paths); + IGRAPH_R_CHECK_INT(k); + c_k = (igraph_integer_t) REAL(k)[0]; + c_from = (igraph_integer_t) REAL(from)[0]; + c_to = (igraph_integer_t) REAL(to)[0]; + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_get_k_shortest_paths(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_vertex_paths, &c_edge_paths, c_k, c_from, c_to, c_mode)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + PROTECT(vertex_paths=Ry_igraph_vector_int_list_to_SEXPp1(&c_vertex_paths)); + igraph_vector_int_list_destroy(&c_vertex_paths); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(edge_paths=Ry_igraph_vector_int_list_to_SEXPp1(&c_edge_paths)); + igraph_vector_int_list_destroy(&c_edge_paths); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, vertex_paths); + SET_VECTOR_ELT(r_result, 1, edge_paths); + SET_STRING_ELT(r_names, 0, Rf_mkChar("vpaths")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("epaths")); + SET_NAMES(r_result, r_names); + UNPROTECT(3); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_get_widest_path / +/-------------------------------------------*/ +SEXP R_igraph_get_widest_path(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP mode) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_int_t c_vertices; + igraph_vector_int_t c_edges; + igraph_integer_t c_from; + igraph_integer_t c_to; + igraph_vector_t c_weights; + igraph_neimode_t c_mode; + SEXP vertices; + SEXP edges; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_vertices, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vertices); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_edges, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edges); + c_from = (igraph_integer_t) REAL(from)[0]; + c_to = (igraph_integer_t) REAL(to)[0]; + Rz_SEXP_to_vector(weights, &c_weights); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_get_widest_path(&c_graph, &c_vertices, &c_edges, c_from, c_to, &c_weights, c_mode)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + PROTECT(vertices=Ry_igraph_vector_int_to_SEXPp1(&c_vertices)); + igraph_vector_int_destroy(&c_vertices); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(edges=Ry_igraph_vector_int_to_SEXPp1(&c_edges)); + igraph_vector_int_destroy(&c_edges); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, vertices); + SET_VECTOR_ELT(r_result, 1, edges); + SET_STRING_ELT(r_names, 0, Rf_mkChar("vertices")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("edges")); + SET_NAMES(r_result, r_names); + UNPROTECT(3); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_get_widest_paths / +/-------------------------------------------*/ +SEXP R_igraph_get_widest_paths(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP mode) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_int_list_t c_vertices; + igraph_vector_int_list_t c_edges; + igraph_integer_t c_from; + igraph_vs_t c_to; + igraph_vector_t c_weights; + igraph_neimode_t c_mode; + igraph_vector_int_t c_parents; + igraph_vector_int_t c_inbound_edges; + SEXP vertices; + SEXP edges; + SEXP parents; + SEXP inbound_edges; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_vertices, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_vertices); + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_edges, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_edges); + c_from = (igraph_integer_t) REAL(from)[0]; + igraph_vector_int_t c_to_data; + Rz_SEXP_to_igraph_vs(to, &c_graph, &c_to, &c_to_data); + Rz_SEXP_to_vector(weights, &c_weights); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_parents, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_parents); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_inbound_edges, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_inbound_edges); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_get_widest_paths(&c_graph, &c_vertices, &c_edges, c_from, c_to, &c_weights, c_mode, &c_parents, &c_inbound_edges)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(4)); + PROTECT(r_names=NEW_CHARACTER(4)); + PROTECT(vertices=Ry_igraph_vector_int_list_to_SEXPp1(&c_vertices)); + igraph_vector_int_list_destroy(&c_vertices); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(edges=Ry_igraph_vector_int_list_to_SEXPp1(&c_edges)); + igraph_vector_int_list_destroy(&c_edges); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_to_data); + igraph_vs_destroy(&c_to); + PROTECT(parents=Ry_igraph_vector_int_to_SEXP(&c_parents)); + igraph_vector_int_destroy(&c_parents); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(inbound_edges=Ry_igraph_vector_int_to_SEXP(&c_inbound_edges)); + igraph_vector_int_destroy(&c_inbound_edges); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, vertices); + SET_VECTOR_ELT(r_result, 1, edges); + SET_VECTOR_ELT(r_result, 2, parents); + SET_VECTOR_ELT(r_result, 3, inbound_edges); + SET_STRING_ELT(r_names, 0, Rf_mkChar("vertices")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("edges")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("parents")); + SET_STRING_ELT(r_names, 3, Rf_mkChar("inbound_edges")); + SET_NAMES(r_result, r_names); + UNPROTECT(5); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_widest_path_widths_dijkstra / +/-------------------------------------------*/ +SEXP R_igraph_widest_path_widths_dijkstra(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP mode) { + /* Declarations */ + igraph_t c_graph; + igraph_matrix_t c_res; + igraph_vs_t c_from; + igraph_vs_t c_to; + igraph_vector_t c_weights; + igraph_neimode_t c_mode; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); + igraph_vector_int_t c_from_data; + Rz_SEXP_to_igraph_vs(from, &c_graph, &c_from, &c_from_data); + igraph_vector_int_t c_to_data; + Rz_SEXP_to_igraph_vs(to, &c_graph, &c_to, &c_to_data); + Rz_SEXP_to_vector(weights, &c_weights); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_widest_path_widths_dijkstra(&c_graph, &c_res, c_from, c_to, &c_weights, c_mode)); + + /* Convert output */ + PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); + igraph_matrix_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_from_data); + igraph_vs_destroy(&c_from); + igraph_vector_int_destroy(&c_to_data); + igraph_vs_destroy(&c_to); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_widest_path_widths_floyd_warshall / +/-------------------------------------------*/ +SEXP R_igraph_widest_path_widths_floyd_warshall(SEXP graph, SEXP from, SEXP to, SEXP weights, SEXP mode) { + /* Declarations */ + igraph_t c_graph; + igraph_matrix_t c_res; + igraph_vs_t c_from; + igraph_vs_t c_to; + igraph_vector_t c_weights; + igraph_neimode_t c_mode; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); + igraph_vector_int_t c_from_data; + Rz_SEXP_to_igraph_vs(from, &c_graph, &c_from, &c_from_data); + igraph_vector_int_t c_to_data; + Rz_SEXP_to_igraph_vs(to, &c_graph, &c_to, &c_to_data); + Rz_SEXP_to_vector(weights, &c_weights); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_widest_path_widths_floyd_warshall(&c_graph, &c_res, c_from, c_to, &c_weights, c_mode)); + + /* Convert output */ + PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); + igraph_matrix_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_from_data); + igraph_vs_destroy(&c_from); + igraph_vector_int_destroy(&c_to_data); + igraph_vs_destroy(&c_to); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_spanner / +/-------------------------------------------*/ +SEXP R_igraph_spanner(SEXP graph, SEXP stretch, SEXP weights) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_int_t c_spanner; + igraph_real_t c_stretch; + igraph_vector_t c_weights; + SEXP spanner; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_spanner, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_spanner); + IGRAPH_R_CHECK_REAL(stretch); + c_stretch = REAL(stretch)[0]; + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + /* Call igraph */ + IGRAPH_R_CHECK(igraph_spanner(&c_graph, &c_spanner, c_stretch, (Rf_isNull(weights) ? 0 : &c_weights))); + + /* Convert output */ + PROTECT(spanner=Ry_igraph_vector_int_to_SEXPp1(&c_spanner)); + igraph_vector_int_destroy(&c_spanner); + IGRAPH_FINALLY_CLEAN(1); + r_result = spanner; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_subcomponent / +/-------------------------------------------*/ +SEXP R_igraph_subcomponent(SEXP graph, SEXP vid, SEXP mode) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_int_t c_res; + igraph_integer_t c_vid; + igraph_neimode_t c_mode; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_res); + c_vid = (igraph_integer_t) REAL(vid)[0]; + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_subcomponent(&c_graph, &c_res, c_vid, c_mode)); + + /* Convert output */ + PROTECT(res=Ry_igraph_vector_int_to_SEXPp1(&c_res)); + igraph_vector_int_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_betweenness / +/-------------------------------------------*/ +SEXP R_igraph_betweenness(SEXP graph, SEXP vids, SEXP directed, SEXP weights) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_res; + igraph_vs_t c_vids; + igraph_bool_t c_directed; + igraph_vector_t c_weights; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + /* Call igraph */ + IGRAPH_R_CHECK(igraph_betweenness(&c_graph, &c_res, c_vids, c_directed, (Rf_isNull(weights) ? 0 : &c_weights))); + + /* Convert output */ + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_betweenness_cutoff / +/-------------------------------------------*/ +SEXP R_igraph_betweenness_cutoff(SEXP graph, SEXP vids, SEXP directed, SEXP weights, SEXP cutoff) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_res; + igraph_vs_t c_vids; + igraph_bool_t c_directed; + igraph_vector_t c_weights; + igraph_real_t c_cutoff; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + IGRAPH_R_CHECK_REAL(cutoff); + c_cutoff = REAL(cutoff)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_betweenness_cutoff(&c_graph, &c_res, c_vids, c_directed, (Rf_isNull(weights) ? 0 : &c_weights), c_cutoff)); + + /* Convert output */ + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_betweenness_subset / +/-------------------------------------------*/ +SEXP R_igraph_betweenness_subset(SEXP graph, SEXP vids, SEXP directed, SEXP sources, SEXP targets, SEXP weights) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_res; + igraph_vs_t c_vids; + igraph_bool_t c_directed; + igraph_vs_t c_sources; + igraph_vs_t c_targets; + igraph_vector_t c_weights; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + igraph_vector_int_t c_sources_data; + Rz_SEXP_to_igraph_vs(sources, &c_graph, &c_sources, &c_sources_data); + igraph_vector_int_t c_targets_data; + Rz_SEXP_to_igraph_vs(targets, &c_graph, &c_targets, &c_targets_data); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + /* Call igraph */ + IGRAPH_R_CHECK(igraph_betweenness_subset(&c_graph, &c_res, c_vids, c_directed, c_sources, c_targets, (Rf_isNull(weights) ? 0 : &c_weights))); + + /* Convert output */ + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); + igraph_vector_int_destroy(&c_sources_data); + igraph_vs_destroy(&c_sources); + igraph_vector_int_destroy(&c_targets_data); + igraph_vs_destroy(&c_targets); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_edge_betweenness / +/-------------------------------------------*/ +SEXP R_igraph_edge_betweenness(SEXP graph, SEXP directed, SEXP weights) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_res; + igraph_bool_t c_directed; + igraph_vector_t c_weights; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + /* Call igraph */ + IGRAPH_R_CHECK(igraph_edge_betweenness(&c_graph, &c_res, c_directed, (Rf_isNull(weights) ? 0 : &c_weights))); + + /* Convert output */ + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_edge_betweenness_cutoff / +/-------------------------------------------*/ +SEXP R_igraph_edge_betweenness_cutoff(SEXP graph, SEXP directed, SEXP weights, SEXP cutoff) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_res; + igraph_bool_t c_directed; + igraph_vector_t c_weights; + igraph_real_t c_cutoff; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + IGRAPH_R_CHECK_REAL(cutoff); + c_cutoff = REAL(cutoff)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_edge_betweenness_cutoff(&c_graph, &c_res, c_directed, (Rf_isNull(weights) ? 0 : &c_weights), c_cutoff)); + + /* Convert output */ + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_edge_betweenness_subset / +/-------------------------------------------*/ +SEXP R_igraph_edge_betweenness_subset(SEXP graph, SEXP eids, SEXP directed, SEXP sources, SEXP targets, SEXP weights) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_res; + igraph_es_t c_eids; + igraph_bool_t c_directed; + igraph_vs_t c_sources; + igraph_vs_t c_targets; + igraph_vector_t c_weights; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + igraph_vector_int_t c_eids_data; + IGRAPH_R_CHECK(Rz_SEXP_to_igraph_es(eids, &c_graph, &c_eids, &c_eids_data)); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + igraph_vector_int_t c_sources_data; + Rz_SEXP_to_igraph_vs(sources, &c_graph, &c_sources, &c_sources_data); + igraph_vector_int_t c_targets_data; + Rz_SEXP_to_igraph_vs(targets, &c_graph, &c_targets, &c_targets_data); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + /* Call igraph */ + IGRAPH_R_CHECK(igraph_edge_betweenness_subset(&c_graph, &c_res, c_eids, c_directed, c_sources, c_targets, (Rf_isNull(weights) ? 0 : &c_weights))); + + /* Convert output */ + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_eids_data); + igraph_es_destroy(&c_eids); + igraph_vector_int_destroy(&c_sources_data); + igraph_vs_destroy(&c_sources); + igraph_vector_int_destroy(&c_targets_data); + igraph_vs_destroy(&c_targets); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_harmonic_centrality / +/-------------------------------------------*/ +SEXP R_igraph_harmonic_centrality(SEXP graph, SEXP vids, SEXP mode, SEXP weights, SEXP normalized) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_res; + igraph_vs_t c_vids; + igraph_neimode_t c_mode; + igraph_vector_t c_weights; + igraph_bool_t c_normalized; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + IGRAPH_R_CHECK_BOOL(normalized); + c_normalized = LOGICAL(normalized)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_harmonic_centrality(&c_graph, &c_res, c_vids, c_mode, (Rf_isNull(weights) ? 0 : &c_weights), c_normalized)); + + /* Convert output */ + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_harmonic_centrality_cutoff / +/-------------------------------------------*/ +SEXP R_igraph_harmonic_centrality_cutoff(SEXP graph, SEXP vids, SEXP mode, SEXP weights, SEXP normalized, SEXP cutoff) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_res; + igraph_vs_t c_vids; + igraph_neimode_t c_mode; + igraph_vector_t c_weights; + igraph_bool_t c_normalized; + igraph_real_t c_cutoff; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + IGRAPH_R_CHECK_BOOL(normalized); + c_normalized = LOGICAL(normalized)[0]; + IGRAPH_R_CHECK_REAL(cutoff); + c_cutoff = REAL(cutoff)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_harmonic_centrality_cutoff(&c_graph, &c_res, c_vids, c_mode, (Rf_isNull(weights) ? 0 : &c_weights), c_normalized, c_cutoff)); + + /* Convert output */ + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_pagerank / +/-------------------------------------------*/ +SEXP R_igraph_pagerank(SEXP graph, SEXP algo, SEXP vids, SEXP directed, SEXP damping, SEXP weights, SEXP options) { + /* Declarations */ + igraph_t c_graph; + igraph_pagerank_algo_t c_algo; + igraph_vector_t c_vector; + igraph_real_t c_value; + igraph_vs_t c_vids; + igraph_bool_t c_directed; + igraph_real_t c_damping; + igraph_vector_t c_weights; + igraph_arpack_options_t c_options1; + void* c_options; + SEXP vector; + SEXP value; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + c_algo = (igraph_pagerank_algo_t) Rf_asInteger(algo); + IGRAPH_R_CHECK(igraph_vector_init(&c_vector, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_vector); + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + IGRAPH_R_CHECK_REAL(damping); + c_damping = REAL(damping)[0]; + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + if (!Rf_isNull(options)) { + if (c_algo == IGRAPH_PAGERANK_ALGO_ARPACK) { + Rz_SEXP_to_igraph_arpack_options(options, &c_options1); + c_options = &c_options1; + } else { + c_options = NULL; + } + } + /* Call igraph */ + IGRAPH_R_CHECK(igraph_pagerank(&c_graph, c_algo, &c_vector, &c_value, c_vids, c_directed, c_damping, (Rf_isNull(weights) ? 0 : &c_weights), c_options)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(vector=Ry_igraph_vector_to_SEXP(&c_vector)); + igraph_vector_destroy(&c_vector); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(value=NEW_NUMERIC(1)); + REAL(value)[0]=c_value; + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); + if (c_algo == IGRAPH_PAGERANK_ALGO_ARPACK) { + PROTECT(options = Ry_igraph_arpack_options_to_SEXP(&c_options1)); + } else { + PROTECT(options); + } + SET_VECTOR_ELT(r_result, 0, vector); + SET_VECTOR_ELT(r_result, 1, value); + SET_VECTOR_ELT(r_result, 2, options); + SET_STRING_ELT(r_names, 0, Rf_mkChar("vector")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("value")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("options")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_personalized_pagerank / +/-------------------------------------------*/ +SEXP R_igraph_personalized_pagerank(SEXP graph, SEXP algo, SEXP vids, SEXP directed, SEXP damping, SEXP personalized, SEXP weights, SEXP options) { + /* Declarations */ + igraph_t c_graph; + igraph_pagerank_algo_t c_algo; + igraph_vector_t c_vector; + igraph_real_t c_value; + igraph_vs_t c_vids; + igraph_bool_t c_directed; + igraph_real_t c_damping; + igraph_vector_t c_personalized; + igraph_vector_t c_weights; + igraph_arpack_options_t c_options1; + void* c_options; + SEXP vector; + SEXP value; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + c_algo = (igraph_pagerank_algo_t) Rf_asInteger(algo); + IGRAPH_R_CHECK(igraph_vector_init(&c_vector, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_vector); + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + IGRAPH_R_CHECK_REAL(damping); + c_damping = REAL(damping)[0]; + if (!Rf_isNull(personalized)) { + Rz_SEXP_to_vector(personalized, &c_personalized); + } + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + if (!Rf_isNull(options)) { + if (c_algo == IGRAPH_PAGERANK_ALGO_ARPACK) { + Rz_SEXP_to_igraph_arpack_options(options, &c_options1); + c_options = &c_options1; + } else { + c_options = NULL; + } + } + /* Call igraph */ + IGRAPH_R_CHECK(igraph_personalized_pagerank(&c_graph, c_algo, &c_vector, &c_value, c_vids, c_directed, c_damping, (Rf_isNull(personalized) ? 0 : &c_personalized), (Rf_isNull(weights) ? 0 : &c_weights), c_options)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(vector=Ry_igraph_vector_to_SEXP(&c_vector)); + igraph_vector_destroy(&c_vector); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(value=NEW_NUMERIC(1)); + REAL(value)[0]=c_value; + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); + if (c_algo == IGRAPH_PAGERANK_ALGO_ARPACK) { + PROTECT(options = Ry_igraph_arpack_options_to_SEXP(&c_options1)); + } else { + PROTECT(options); + } + SET_VECTOR_ELT(r_result, 0, vector); + SET_VECTOR_ELT(r_result, 1, value); + SET_VECTOR_ELT(r_result, 2, options); + SET_STRING_ELT(r_names, 0, Rf_mkChar("vector")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("value")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("options")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_personalized_pagerank_vs / +/-------------------------------------------*/ +SEXP R_igraph_personalized_pagerank_vs(SEXP graph, SEXP algo, SEXP vids, SEXP directed, SEXP damping, SEXP reset_vids, SEXP weights, SEXP options) { + /* Declarations */ + igraph_t c_graph; + igraph_pagerank_algo_t c_algo; + igraph_vector_t c_vector; + igraph_real_t c_value; + igraph_vs_t c_vids; + igraph_bool_t c_directed; + igraph_real_t c_damping; + igraph_vs_t c_reset_vids; + igraph_vector_t c_weights; + igraph_arpack_options_t c_options1; + void* c_options; + SEXP vector; + SEXP value; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + c_algo = (igraph_pagerank_algo_t) Rf_asInteger(algo); + IGRAPH_R_CHECK(igraph_vector_init(&c_vector, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_vector); + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + IGRAPH_R_CHECK_REAL(damping); + c_damping = REAL(damping)[0]; + igraph_vector_int_t c_reset_vids_data; + Rz_SEXP_to_igraph_vs(reset_vids, &c_graph, &c_reset_vids, &c_reset_vids_data); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } if (!Rf_isNull(options)) { if (c_algo == IGRAPH_PAGERANK_ALGO_ARPACK) { Rz_SEXP_to_igraph_arpack_options(options, &c_options1); @@ -3498,91 +5506,755 @@ SEXP R_igraph_personalized_pagerank_vs(SEXP graph, SEXP algo, SEXP vids, SEXP di } } /* Call igraph */ - IGRAPH_R_CHECK(igraph_personalized_pagerank_vs(&c_graph, c_algo, &c_vector, &c_value, c_vids, c_directed, c_damping, c_reset_vids, (Rf_isNull(weights) ? 0 : &c_weights), c_options)); + IGRAPH_R_CHECK(igraph_personalized_pagerank_vs(&c_graph, c_algo, &c_vector, &c_value, c_vids, c_directed, c_damping, c_reset_vids, (Rf_isNull(weights) ? 0 : &c_weights), c_options)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(vector=Ry_igraph_vector_to_SEXP(&c_vector)); + igraph_vector_destroy(&c_vector); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(value=NEW_NUMERIC(1)); + REAL(value)[0]=c_value; + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); + igraph_vector_int_destroy(&c_reset_vids_data); + igraph_vs_destroy(&c_reset_vids); + if (c_algo == IGRAPH_PAGERANK_ALGO_ARPACK) { + PROTECT(options = Ry_igraph_arpack_options_to_SEXP(&c_options1)); + } else { + PROTECT(options); + } + SET_VECTOR_ELT(r_result, 0, vector); + SET_VECTOR_ELT(r_result, 1, value); + SET_VECTOR_ELT(r_result, 2, options); + SET_STRING_ELT(r_names, 0, Rf_mkChar("vector")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("value")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("options")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_rewire / +/-------------------------------------------*/ +SEXP R_igraph_rewire(SEXP rewire, SEXP n, SEXP mode) { + /* Declarations */ + igraph_t c_rewire; + igraph_integer_t c_n; + igraph_rewiring_t c_mode; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph_copy(rewire, &c_rewire); + IGRAPH_FINALLY(igraph_destroy, &c_rewire); + IGRAPH_R_CHECK_INT(n); + c_n = (igraph_integer_t) REAL(n)[0]; + c_mode = (igraph_rewiring_t) Rf_asInteger(mode); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_rewire(&c_rewire, c_n, c_mode)); + + /* Convert output */ + PROTECT(rewire=Ry_igraph_to_SEXP(&c_rewire)); + IGRAPH_I_DESTROY(&c_rewire); + IGRAPH_FINALLY_CLEAN(1); + r_result = rewire; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_induced_subgraph / +/-------------------------------------------*/ +SEXP R_igraph_induced_subgraph(SEXP graph, SEXP vids, SEXP impl) { + /* Declarations */ + igraph_t c_graph; + igraph_t c_res; + igraph_vs_t c_vids; + igraph_subgraph_implementation_t c_impl; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + c_impl = (igraph_subgraph_implementation_t) Rf_asInteger(impl); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_induced_subgraph(&c_graph, &c_res, c_vids, c_impl)); + + /* Convert output */ + IGRAPH_FINALLY(igraph_destroy, &c_res); + PROTECT(res=Ry_igraph_to_SEXP(&c_res)); + IGRAPH_I_DESTROY(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_subgraph_from_edges / +/-------------------------------------------*/ +SEXP R_igraph_subgraph_from_edges(SEXP graph, SEXP eids, SEXP delete_vertices) { + /* Declarations */ + igraph_t c_graph; + igraph_t c_res; + igraph_es_t c_eids; + igraph_bool_t c_delete_vertices; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + igraph_vector_int_t c_eids_data; + IGRAPH_R_CHECK(Rz_SEXP_to_igraph_es(eids, &c_graph, &c_eids, &c_eids_data)); + IGRAPH_R_CHECK_BOOL(delete_vertices); + c_delete_vertices = LOGICAL(delete_vertices)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_subgraph_from_edges(&c_graph, &c_res, c_eids, c_delete_vertices)); + + /* Convert output */ + IGRAPH_FINALLY(igraph_destroy, &c_res); + PROTECT(res=Ry_igraph_to_SEXP(&c_res)); + IGRAPH_I_DESTROY(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_eids_data); + igraph_es_destroy(&c_eids); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_reverse_edges / +/-------------------------------------------*/ +SEXP R_igraph_reverse_edges(SEXP graph, SEXP eids) { + /* Declarations */ + igraph_t c_graph; + igraph_es_t c_eids; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph_copy(graph, &c_graph); + IGRAPH_FINALLY(igraph_destroy, &c_graph); + igraph_vector_int_t c_eids_data; + IGRAPH_R_CHECK(Rz_SEXP_to_igraph_es(eids, &c_graph, &c_eids, &c_eids_data)); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_reverse_edges(&c_graph, c_eids)); + + /* Convert output */ + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_eids_data); + igraph_es_destroy(&c_eids); + r_result = graph; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_average_path_length / +/-------------------------------------------*/ +SEXP R_igraph_average_path_length(SEXP graph, SEXP directed, SEXP unconn) { + /* Declarations */ + igraph_t c_graph; + igraph_real_t c_res; + igraph_real_t c_unconn_pairs; + igraph_bool_t c_directed; + igraph_bool_t c_unconn; + SEXP res; + SEXP unconn_pairs; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + IGRAPH_R_CHECK_BOOL(unconn); + c_unconn = LOGICAL(unconn)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_average_path_length(&c_graph, &c_res, &c_unconn_pairs, c_directed, c_unconn)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=c_res; + PROTECT(unconn_pairs=NEW_NUMERIC(1)); + REAL(unconn_pairs)[0]=c_unconn_pairs; + SET_VECTOR_ELT(r_result, 0, res); + SET_VECTOR_ELT(r_result, 1, unconn_pairs); + SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("unconn_pairs")); + SET_NAMES(r_result, r_names); + UNPROTECT(3); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_average_path_length_dijkstra / +/-------------------------------------------*/ +SEXP R_igraph_average_path_length_dijkstra(SEXP graph, SEXP weights, SEXP directed, SEXP unconn) { + /* Declarations */ + igraph_t c_graph; + igraph_real_t c_res; + igraph_real_t c_unconn_pairs; + igraph_vector_t c_weights; + igraph_bool_t c_directed; + igraph_bool_t c_unconn; + SEXP res; + SEXP unconn_pairs; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + IGRAPH_R_CHECK_BOOL(unconn); + c_unconn = LOGICAL(unconn)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_average_path_length_dijkstra(&c_graph, &c_res, &c_unconn_pairs, (Rf_isNull(weights) ? 0 : &c_weights), c_directed, c_unconn)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=c_res; + PROTECT(unconn_pairs=NEW_NUMERIC(1)); + REAL(unconn_pairs)[0]=c_unconn_pairs; + SET_VECTOR_ELT(r_result, 0, res); + SET_VECTOR_ELT(r_result, 1, unconn_pairs); + SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("unconnected")); + SET_NAMES(r_result, r_names); + UNPROTECT(3); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_path_length_hist / +/-------------------------------------------*/ +SEXP R_igraph_path_length_hist(SEXP graph, SEXP directed) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_res; + igraph_real_t c_unconnected; + igraph_bool_t c_directed; + SEXP res; + SEXP unconnected; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_path_length_hist(&c_graph, &c_res, &c_unconnected, c_directed)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(unconnected=NEW_NUMERIC(1)); + REAL(unconnected)[0]=c_unconnected; + SET_VECTOR_ELT(r_result, 0, res); + SET_VECTOR_ELT(r_result, 1, unconnected); + SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("unconnected")); + SET_NAMES(r_result, r_names); + UNPROTECT(3); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_simplify / +/-------------------------------------------*/ +SEXP R_igraph_simplify(SEXP graph, SEXP remove_multiple, SEXP remove_loops, SEXP edge_attr_comb) { + /* Declarations */ + igraph_t c_graph; + igraph_bool_t c_remove_multiple; + igraph_bool_t c_remove_loops; + igraph_attribute_combination_t c_edge_attr_comb; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph_copy(graph, &c_graph); + IGRAPH_FINALLY(igraph_destroy, &c_graph); + IGRAPH_R_CHECK_BOOL(remove_multiple); + c_remove_multiple = LOGICAL(remove_multiple)[0]; + IGRAPH_R_CHECK_BOOL(remove_loops); + c_remove_loops = LOGICAL(remove_loops)[0]; + Rz_SEXP_to_attr_comb(edge_attr_comb, &c_edge_attr_comb); + IGRAPH_FINALLY(igraph_attribute_combination_destroy, &c_edge_attr_comb); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_simplify(&c_graph, c_remove_multiple, c_remove_loops, &c_edge_attr_comb)); + + /* Convert output */ + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + igraph_attribute_combination_destroy(&c_edge_attr_comb); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_transitivity_undirected / +/-------------------------------------------*/ +SEXP R_igraph_transitivity_undirected(SEXP graph, SEXP mode) { + /* Declarations */ + igraph_t c_graph; + igraph_real_t c_res; + igraph_transitivity_mode_t c_mode; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + c_mode = (igraph_transitivity_mode_t) Rf_asInteger(mode); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_transitivity_undirected(&c_graph, &c_res, c_mode)); + + /* Convert output */ + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=c_res; + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_transitivity_local_undirected / +/-------------------------------------------*/ +SEXP R_igraph_transitivity_local_undirected(SEXP graph, SEXP vids, SEXP mode) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_res; + igraph_vs_t c_vids; + igraph_transitivity_mode_t c_mode; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + c_mode = (igraph_transitivity_mode_t) Rf_asInteger(mode); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_transitivity_local_undirected(&c_graph, &c_res, c_vids, c_mode)); + + /* Convert output */ + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_transitivity_avglocal_undirected / +/-------------------------------------------*/ +SEXP R_igraph_transitivity_avglocal_undirected(SEXP graph, SEXP mode) { + /* Declarations */ + igraph_t c_graph; + igraph_real_t c_res; + igraph_transitivity_mode_t c_mode; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + c_mode = (igraph_transitivity_mode_t) Rf_asInteger(mode); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_transitivity_avglocal_undirected(&c_graph, &c_res, c_mode)); + + /* Convert output */ + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=c_res; + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_transitivity_barrat / +/-------------------------------------------*/ +SEXP R_igraph_transitivity_barrat(SEXP graph, SEXP vids, SEXP weights, SEXP mode) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_res; + igraph_vs_t c_vids; + igraph_vector_t c_weights; + igraph_transitivity_mode_t c_mode; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + c_mode = (igraph_transitivity_mode_t) Rf_asInteger(mode); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_transitivity_barrat(&c_graph, &c_res, c_vids, (Rf_isNull(weights) ? 0 : &c_weights), c_mode)); /* Convert output */ - PROTECT(r_result=NEW_LIST(3)); - PROTECT(r_names=NEW_CHARACTER(3)); - PROTECT(vector=Ry_igraph_vector_to_SEXP(&c_vector)); - igraph_vector_destroy(&c_vector); + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_ecc / +/-------------------------------------------*/ +SEXP R_igraph_ecc(SEXP graph, SEXP eids, SEXP k, SEXP offset, SEXP normalize) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_res; + igraph_es_t c_eids; + igraph_integer_t c_k; + igraph_bool_t c_offset; + igraph_bool_t c_normalize; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + igraph_vector_int_t c_eids_data; + IGRAPH_R_CHECK(Rz_SEXP_to_igraph_es(eids, &c_graph, &c_eids, &c_eids_data)); + IGRAPH_R_CHECK_INT(k); + c_k = (igraph_integer_t) REAL(k)[0]; + IGRAPH_R_CHECK_BOOL(offset); + c_offset = LOGICAL(offset)[0]; + IGRAPH_R_CHECK_BOOL(normalize); + c_normalize = LOGICAL(normalize)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_ecc(&c_graph, &c_res, c_eids, c_k, c_offset, c_normalize)); + + /* Convert output */ + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_eids_data); + igraph_es_destroy(&c_eids); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_reciprocity / +/-------------------------------------------*/ +SEXP R_igraph_reciprocity(SEXP graph, SEXP ignore_loops, SEXP mode) { + /* Declarations */ + igraph_t c_graph; + igraph_real_t c_res; + igraph_bool_t c_ignore_loops; + igraph_reciprocity_t c_mode; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK_BOOL(ignore_loops); + c_ignore_loops = LOGICAL(ignore_loops)[0]; + c_mode = (igraph_reciprocity_t) Rf_asInteger(mode); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_reciprocity(&c_graph, &c_res, c_ignore_loops, c_mode)); + + /* Convert output */ + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=c_res; + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_constraint / +/-------------------------------------------*/ +SEXP R_igraph_constraint(SEXP graph, SEXP vids, SEXP weights) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_res; + igraph_vs_t c_vids; + igraph_vector_t c_weights; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + /* Call igraph */ + IGRAPH_R_CHECK(igraph_constraint(&c_graph, &c_res, c_vids, (Rf_isNull(weights) ? 0 : &c_weights))); + + /* Convert output */ + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_maxdegree / +/-------------------------------------------*/ +SEXP R_igraph_maxdegree(SEXP graph, SEXP vids, SEXP mode, SEXP loops) { + /* Declarations */ + igraph_t c_graph; + igraph_integer_t c_res; + igraph_vs_t c_vids; + igraph_neimode_t c_mode; + igraph_bool_t c_loops; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + c_res=0; + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK_BOOL(loops); + c_loops = LOGICAL(loops)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_maxdegree(&c_graph, &c_res, c_vids, c_mode, c_loops)); + + /* Convert output */ + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=(double) c_res; + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_density / +/-------------------------------------------*/ +SEXP R_igraph_density(SEXP graph, SEXP loops) { + /* Declarations */ + igraph_t c_graph; + igraph_real_t c_res; + igraph_bool_t c_loops; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK_BOOL(loops); + c_loops = LOGICAL(loops)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_density(&c_graph, &c_res, c_loops)); + + /* Convert output */ + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=c_res; + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_mean_degree / +/-------------------------------------------*/ +SEXP R_igraph_mean_degree(SEXP graph, SEXP loops) { + /* Declarations */ + igraph_t c_graph; + igraph_real_t c_res; + igraph_bool_t c_loops; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK_BOOL(loops); + c_loops = LOGICAL(loops)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_mean_degree(&c_graph, &c_res, c_loops)); + + /* Convert output */ + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=c_res; + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_neighborhood_size / +/-------------------------------------------*/ +SEXP R_igraph_neighborhood_size(SEXP graph, SEXP vids, SEXP order, SEXP mode, SEXP mindist) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_int_t c_res; + igraph_vs_t c_vids; + igraph_integer_t c_order; + igraph_neimode_t c_mode; + igraph_integer_t c_mindist; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_res); + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + IGRAPH_R_CHECK_INT(order); + c_order = (igraph_integer_t) REAL(order)[0]; + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK_INT(mindist); + c_mindist = (igraph_integer_t) REAL(mindist)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_neighborhood_size(&c_graph, &c_res, c_vids, c_order, c_mode, c_mindist)); + + /* Convert output */ + PROTECT(res=Ry_igraph_vector_int_to_SEXP(&c_res)); + igraph_vector_int_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); - PROTECT(value=NEW_NUMERIC(1)); - REAL(value)[0]=c_value; igraph_vector_int_destroy(&c_vids_data); igraph_vs_destroy(&c_vids); - igraph_vector_int_destroy(&c_reset_vids_data); - igraph_vs_destroy(&c_reset_vids); - if (c_algo == IGRAPH_PAGERANK_ALGO_ARPACK) { - PROTECT(options = Ry_igraph_arpack_options_to_SEXP(&c_options1)); - } else { - PROTECT(options); - } - SET_VECTOR_ELT(r_result, 0, vector); - SET_VECTOR_ELT(r_result, 1, value); - SET_VECTOR_ELT(r_result, 2, options); - SET_STRING_ELT(r_names, 0, Rf_mkChar("vector")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("value")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("options")); - SET_NAMES(r_result, r_names); - UNPROTECT(4); + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_rewire / +/ igraph_neighborhood / /-------------------------------------------*/ -SEXP R_igraph_rewire(SEXP rewire, SEXP n, SEXP mode) { +SEXP R_igraph_neighborhood(SEXP graph, SEXP vids, SEXP order, SEXP mode, SEXP mindist) { /* Declarations */ - igraph_t c_rewire; - igraph_integer_t c_n; - igraph_rewiring_t c_mode; + igraph_t c_graph; + igraph_vector_int_list_t c_res; + igraph_vs_t c_vids; + igraph_integer_t c_order; + igraph_neimode_t c_mode; + igraph_integer_t c_mindist; + SEXP res; SEXP r_result; /* Convert input */ - Rz_SEXP_to_igraph_copy(rewire, &c_rewire); - IGRAPH_FINALLY(igraph_destroy, &c_rewire); - IGRAPH_R_CHECK_INT(n); - c_n = (igraph_integer_t) REAL(n)[0]; - c_mode = (igraph_rewiring_t) Rf_asInteger(mode); + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_res); + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + IGRAPH_R_CHECK_INT(order); + c_order = (igraph_integer_t) REAL(order)[0]; + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK_INT(mindist); + c_mindist = (igraph_integer_t) REAL(mindist)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_rewire(&c_rewire, c_n, c_mode)); + IGRAPH_R_CHECK(igraph_neighborhood(&c_graph, &c_res, c_vids, c_order, c_mode, c_mindist)); /* Convert output */ - PROTECT(rewire=Ry_igraph_to_SEXP(&c_rewire)); - IGRAPH_I_DESTROY(&c_rewire); + PROTECT(res=Ry_igraph_vector_int_list_to_SEXPp1(&c_res)); + igraph_vector_int_list_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); - r_result = rewire; + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_induced_subgraph / +/ igraph_neighborhood_graphs / /-------------------------------------------*/ -SEXP R_igraph_induced_subgraph(SEXP graph, SEXP vids, SEXP impl) { +SEXP R_igraph_neighborhood_graphs(SEXP graph, SEXP vids, SEXP order, SEXP mode, SEXP mindist) { /* Declarations */ igraph_t c_graph; - igraph_t c_res; + igraph_graph_list_t c_res; igraph_vs_t c_vids; - igraph_subgraph_implementation_t c_impl; + igraph_integer_t c_order; + igraph_neimode_t c_mode; + igraph_integer_t c_mindist; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_graph_list_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_graph_list_destroy, &c_res); igraph_vector_int_t c_vids_data; Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); - c_impl = (igraph_subgraph_implementation_t) Rf_asInteger(impl); + IGRAPH_R_CHECK_INT(order); + c_order = (igraph_integer_t) REAL(order)[0]; + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK_INT(mindist); + c_mindist = (igraph_integer_t) REAL(mindist)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_induced_subgraph(&c_graph, &c_res, c_vids, c_impl)); + IGRAPH_R_CHECK(igraph_neighborhood_graphs(&c_graph, &c_res, c_vids, c_order, c_mode, c_mindist)); /* Convert output */ - IGRAPH_FINALLY(igraph_destroy, &c_res); - PROTECT(res=Ry_igraph_to_SEXP(&c_res)); - IGRAPH_I_DESTROY(&c_res); + PROTECT(res=Ry_igraph_graphlist_to_SEXP(&c_res)); + IGRAPH_FREE(c_res.stor_begin); IGRAPH_FINALLY_CLEAN(1); igraph_vector_int_destroy(&c_vids_data); igraph_vs_destroy(&c_vids); @@ -3593,33 +6265,198 @@ SEXP R_igraph_induced_subgraph(SEXP graph, SEXP vids, SEXP impl) { } /*-------------------------------------------/ -/ igraph_subgraph_from_edges / +/ igraph_topological_sorting / /-------------------------------------------*/ -SEXP R_igraph_subgraph_from_edges(SEXP graph, SEXP eids, SEXP delete_vertices) { +SEXP R_igraph_topological_sorting(SEXP graph, SEXP mode) { /* Declarations */ igraph_t c_graph; - igraph_t c_res; - igraph_es_t c_eids; - igraph_bool_t c_delete_vertices; + igraph_vector_int_t c_res; + igraph_neimode_t c_mode; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - igraph_vector_int_t c_eids_data; - IGRAPH_R_CHECK(Rz_SEXP_to_igraph_es(eids, &c_graph, &c_eids, &c_eids_data)); - IGRAPH_R_CHECK_BOOL(delete_vertices); - c_delete_vertices = LOGICAL(delete_vertices)[0]; + IGRAPH_R_CHECK(igraph_vector_int_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_res); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); /* Call igraph */ - IGRAPH_R_CHECK(igraph_subgraph_from_edges(&c_graph, &c_res, c_eids, c_delete_vertices)); + IGRAPH_R_CHECK(igraph_topological_sorting(&c_graph, &c_res, c_mode)); + + /* Convert output */ + PROTECT(res=Ry_igraph_vector_int_to_SEXPp1(&c_res)); + igraph_vector_int_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_feedback_arc_set / +/-------------------------------------------*/ +SEXP R_igraph_feedback_arc_set(SEXP graph, SEXP weights, SEXP algo) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_int_t c_result; + igraph_vector_t c_weights; + igraph_fas_algorithm_t c_algo; + SEXP result; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_result, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_result); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + c_algo = (igraph_fas_algorithm_t) Rf_asInteger(algo); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_feedback_arc_set(&c_graph, &c_result, (Rf_isNull(weights) ? 0 : &c_weights), c_algo)); + + /* Convert output */ + PROTECT(result=Ry_igraph_vector_int_to_SEXPp1(&c_result)); + igraph_vector_int_destroy(&c_result); + IGRAPH_FINALLY_CLEAN(1); + r_result = result; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_feedback_vertex_set / +/-------------------------------------------*/ +SEXP R_igraph_feedback_vertex_set(SEXP graph, SEXP weights, SEXP algo) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_int_t c_result; + igraph_vector_t c_weights; + igraph_fvs_algorithm_t c_algo; + SEXP result; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_result, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_result); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + c_algo = (igraph_fvs_algorithm_t) Rf_asInteger(algo); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_feedback_vertex_set(&c_graph, &c_result, (Rf_isNull(weights) ? 0 : &c_weights), c_algo)); + + /* Convert output */ + PROTECT(result=Ry_igraph_vector_int_to_SEXPp1(&c_result)); + igraph_vector_int_destroy(&c_result); + IGRAPH_FINALLY_CLEAN(1); + r_result = result; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_is_loop / +/-------------------------------------------*/ +SEXP R_igraph_is_loop(SEXP graph, SEXP es) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_bool_t c_res; + igraph_es_t c_es; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_bool_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_bool_destroy, &c_res); + igraph_vector_int_t c_es_data; + IGRAPH_R_CHECK(Rz_SEXP_to_igraph_es(es, &c_graph, &c_es, &c_es_data)); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_is_loop(&c_graph, &c_res, c_es)); + + /* Convert output */ + PROTECT(res=Ry_igraph_vector_bool_to_SEXP(&c_res)); + igraph_vector_bool_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_es_data); + igraph_es_destroy(&c_es); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_is_dag / +/-------------------------------------------*/ +SEXP R_igraph_is_dag(SEXP graph) { + /* Declarations */ + igraph_t c_graph; + igraph_bool_t c_res; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_is_dag(&c_graph, &c_res)); + + /* Convert output */ + PROTECT(res=NEW_LOGICAL(1)); + LOGICAL(res)[0]=c_res; + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_is_acyclic / +/-------------------------------------------*/ +SEXP R_igraph_is_acyclic(SEXP graph) { + /* Declarations */ + igraph_t c_graph; + igraph_bool_t c_res; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_is_acyclic(&c_graph, &c_res)); + + /* Convert output */ + PROTECT(res=NEW_LOGICAL(1)); + LOGICAL(res)[0]=c_res; + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_is_simple / +/-------------------------------------------*/ +SEXP R_igraph_is_simple(SEXP graph) { + /* Declarations */ + igraph_t c_graph; + igraph_bool_t c_res; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_is_simple(&c_graph, &c_res)); /* Convert output */ - IGRAPH_FINALLY(igraph_destroy, &c_res); - PROTECT(res=Ry_igraph_to_SEXP(&c_res)); - IGRAPH_I_DESTROY(&c_res); - IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_eids_data); - igraph_es_destroy(&c_eids); + PROTECT(res=NEW_LOGICAL(1)); + LOGICAL(res)[0]=c_res; r_result = res; UNPROTECT(1); @@ -3627,175 +6464,136 @@ SEXP R_igraph_subgraph_from_edges(SEXP graph, SEXP eids, SEXP delete_vertices) { } /*-------------------------------------------/ -/ igraph_reverse_edges / +/ igraph_is_multiple / /-------------------------------------------*/ -SEXP R_igraph_reverse_edges(SEXP graph, SEXP eids) { +SEXP R_igraph_is_multiple(SEXP graph, SEXP es) { /* Declarations */ igraph_t c_graph; - igraph_es_t c_eids; + igraph_vector_bool_t c_res; + igraph_es_t c_es; + SEXP res; SEXP r_result; /* Convert input */ - Rz_SEXP_to_igraph_copy(graph, &c_graph); - IGRAPH_FINALLY(igraph_destroy, &c_graph); - igraph_vector_int_t c_eids_data; - IGRAPH_R_CHECK(Rz_SEXP_to_igraph_es(eids, &c_graph, &c_eids, &c_eids_data)); + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_bool_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_bool_destroy, &c_res); + igraph_vector_int_t c_es_data; + IGRAPH_R_CHECK(Rz_SEXP_to_igraph_es(es, &c_graph, &c_es, &c_es_data)); /* Call igraph */ - IGRAPH_R_CHECK(igraph_reverse_edges(&c_graph, c_eids)); + IGRAPH_R_CHECK(igraph_is_multiple(&c_graph, &c_res, c_es)); /* Convert output */ - PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); - IGRAPH_I_DESTROY(&c_graph); + PROTECT(res=Ry_igraph_vector_bool_to_SEXP(&c_res)); + igraph_vector_bool_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_eids_data); - igraph_es_destroy(&c_eids); - r_result = graph; + igraph_vector_int_destroy(&c_es_data); + igraph_es_destroy(&c_es); + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_average_path_length_dijkstra / +/ igraph_has_loop / /-------------------------------------------*/ -SEXP R_igraph_average_path_length_dijkstra(SEXP graph, SEXP weights, SEXP directed, SEXP unconn) { +SEXP R_igraph_has_loop(SEXP graph) { /* Declarations */ igraph_t c_graph; - igraph_real_t c_res; - igraph_real_t c_unconn_pairs; - igraph_vector_t c_weights; - igraph_bool_t c_directed; - igraph_bool_t c_unconn; + igraph_bool_t c_res; SEXP res; - SEXP unconn_pairs; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; - IGRAPH_R_CHECK_BOOL(unconn); - c_unconn = LOGICAL(unconn)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_average_path_length_dijkstra(&c_graph, &c_res, &c_unconn_pairs, (Rf_isNull(weights) ? 0 : &c_weights), c_directed, c_unconn)); + IGRAPH_R_CHECK(igraph_has_loop(&c_graph, &c_res)); /* Convert output */ - PROTECT(r_result=NEW_LIST(2)); - PROTECT(r_names=NEW_CHARACTER(2)); - PROTECT(res=NEW_NUMERIC(1)); - REAL(res)[0]=c_res; - PROTECT(unconn_pairs=NEW_NUMERIC(1)); - REAL(unconn_pairs)[0]=c_unconn_pairs; - SET_VECTOR_ELT(r_result, 0, res); - SET_VECTOR_ELT(r_result, 1, unconn_pairs); - SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("unconnected")); - SET_NAMES(r_result, r_names); - UNPROTECT(3); + PROTECT(res=NEW_LOGICAL(1)); + LOGICAL(res)[0]=c_res; + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_path_length_hist / +/ igraph_has_multiple / /-------------------------------------------*/ -SEXP R_igraph_path_length_hist(SEXP graph, SEXP directed) { +SEXP R_igraph_has_multiple(SEXP graph) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_res; - igraph_real_t c_unconnected; - igraph_bool_t c_directed; + igraph_bool_t c_res; SEXP res; - SEXP unconnected; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_res); - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_path_length_hist(&c_graph, &c_res, &c_unconnected, c_directed)); + IGRAPH_R_CHECK(igraph_has_multiple(&c_graph, &c_res)); /* Convert output */ - PROTECT(r_result=NEW_LIST(2)); - PROTECT(r_names=NEW_CHARACTER(2)); - PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); - igraph_vector_destroy(&c_res); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(unconnected=NEW_NUMERIC(1)); - REAL(unconnected)[0]=c_unconnected; - SET_VECTOR_ELT(r_result, 0, res); - SET_VECTOR_ELT(r_result, 1, unconnected); - SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("unconnected")); - SET_NAMES(r_result, r_names); - UNPROTECT(3); + PROTECT(res=NEW_LOGICAL(1)); + LOGICAL(res)[0]=c_res; + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_simplify / +/ igraph_count_loops / /-------------------------------------------*/ -SEXP R_igraph_simplify(SEXP graph, SEXP remove_multiple, SEXP remove_loops, SEXP edge_attr_comb) { +SEXP R_igraph_count_loops(SEXP graph) { /* Declarations */ igraph_t c_graph; - igraph_bool_t c_remove_multiple; - igraph_bool_t c_remove_loops; - igraph_attribute_combination_t c_edge_attr_comb; + igraph_integer_t c_loop_count; + SEXP loop_count; SEXP r_result; /* Convert input */ - Rz_SEXP_to_igraph_copy(graph, &c_graph); - IGRAPH_FINALLY(igraph_destroy, &c_graph); - IGRAPH_R_CHECK_BOOL(remove_multiple); - c_remove_multiple = LOGICAL(remove_multiple)[0]; - IGRAPH_R_CHECK_BOOL(remove_loops); - c_remove_loops = LOGICAL(remove_loops)[0]; - Rz_SEXP_to_attr_comb(edge_attr_comb, &c_edge_attr_comb); - IGRAPH_FINALLY(igraph_attribute_combination_destroy, &c_edge_attr_comb); + Rz_SEXP_to_igraph(graph, &c_graph); + c_loop_count=0; /* Call igraph */ - IGRAPH_R_CHECK(igraph_simplify(&c_graph, c_remove_multiple, c_remove_loops, &c_edge_attr_comb)); + IGRAPH_R_CHECK(igraph_count_loops(&c_graph, &c_loop_count)); /* Convert output */ - PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); - IGRAPH_I_DESTROY(&c_graph); - IGRAPH_FINALLY_CLEAN(1); - igraph_attribute_combination_destroy(&c_edge_attr_comb); - IGRAPH_FINALLY_CLEAN(1); - r_result = graph; + PROTECT(loop_count=NEW_NUMERIC(1)); + REAL(loop_count)[0]=(double) c_loop_count; + r_result = loop_count; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_transitivity_undirected / +/ igraph_count_multiple / /-------------------------------------------*/ -SEXP R_igraph_transitivity_undirected(SEXP graph, SEXP mode) { +SEXP R_igraph_count_multiple(SEXP graph, SEXP es) { /* Declarations */ igraph_t c_graph; - igraph_real_t c_res; - igraph_transitivity_mode_t c_mode; + igraph_vector_int_t c_res; + igraph_es_t c_es; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - c_mode = (igraph_transitivity_mode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_res); + igraph_vector_int_t c_es_data; + IGRAPH_R_CHECK(Rz_SEXP_to_igraph_es(es, &c_graph, &c_es, &c_es_data)); /* Call igraph */ - IGRAPH_R_CHECK(igraph_transitivity_undirected(&c_graph, &c_res, c_mode)); + IGRAPH_R_CHECK(igraph_count_multiple(&c_graph, &c_res, c_es)); /* Convert output */ - PROTECT(res=NEW_NUMERIC(1)); - REAL(res)[0]=c_res; + PROTECT(res=Ry_igraph_vector_int_to_SEXP(&c_res)); + igraph_vector_int_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_es_data); + igraph_es_destroy(&c_es); r_result = res; UNPROTECT(1); @@ -3803,59 +6601,61 @@ SEXP R_igraph_transitivity_undirected(SEXP graph, SEXP mode) { } /*-------------------------------------------/ -/ igraph_transitivity_local_undirected / +/ igraph_girth / /-------------------------------------------*/ -SEXP R_igraph_transitivity_local_undirected(SEXP graph, SEXP vids, SEXP mode) { +SEXP R_igraph_girth(SEXP graph) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_res; - igraph_vs_t c_vids; - igraph_transitivity_mode_t c_mode; - SEXP res; + igraph_real_t c_girth; + igraph_vector_int_t c_circle; + SEXP girth; + SEXP circle; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_res); - igraph_vector_int_t c_vids_data; - Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); - c_mode = (igraph_transitivity_mode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_circle, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_circle); /* Call igraph */ - IGRAPH_R_CHECK(igraph_transitivity_local_undirected(&c_graph, &c_res, c_vids, c_mode)); + IGRAPH_R_CHECK(igraph_girth(&c_graph, &c_girth, &c_circle)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); - igraph_vector_destroy(&c_res); + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + PROTECT(girth=NEW_NUMERIC(1)); + REAL(girth)[0]=c_girth; + PROTECT(circle=Ry_igraph_vector_int_to_SEXPp1(&c_circle)); + igraph_vector_int_destroy(&c_circle); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_vids_data); - igraph_vs_destroy(&c_vids); - r_result = res; + SET_VECTOR_ELT(r_result, 0, girth); + SET_VECTOR_ELT(r_result, 1, circle); + SET_STRING_ELT(r_names, 0, Rf_mkChar("girth")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("circle")); + SET_NAMES(r_result, r_names); + UNPROTECT(3); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_transitivity_avglocal_undirected / +/ igraph_is_perfect / /-------------------------------------------*/ -SEXP R_igraph_transitivity_avglocal_undirected(SEXP graph, SEXP mode) { +SEXP R_igraph_is_perfect(SEXP graph) { /* Declarations */ igraph_t c_graph; - igraph_real_t c_res; - igraph_transitivity_mode_t c_mode; + igraph_bool_t c_res; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - c_mode = (igraph_transitivity_mode_t) Rf_asInteger(mode); /* Call igraph */ - IGRAPH_R_CHECK(igraph_transitivity_avglocal_undirected(&c_graph, &c_res, c_mode)); + IGRAPH_R_CHECK(igraph_is_perfect(&c_graph, &c_res)); /* Convert output */ - PROTECT(res=NEW_NUMERIC(1)); - REAL(res)[0]=c_res; + PROTECT(res=NEW_LOGICAL(1)); + LOGICAL(res)[0]=c_res; r_result = res; UNPROTECT(1); @@ -3863,232 +6663,323 @@ SEXP R_igraph_transitivity_avglocal_undirected(SEXP graph, SEXP mode) { } /*-------------------------------------------/ -/ igraph_transitivity_barrat / +/ igraph_add_edge / /-------------------------------------------*/ -SEXP R_igraph_transitivity_barrat(SEXP graph, SEXP vids, SEXP weights, SEXP mode) { +SEXP R_igraph_add_edge(SEXP graph, SEXP from, SEXP to) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_res; - igraph_vs_t c_vids; - igraph_vector_t c_weights; - igraph_transitivity_mode_t c_mode; - SEXP res; + igraph_integer_t c_from; + igraph_integer_t c_to; SEXP r_result; /* Convert input */ - Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_res); - igraph_vector_int_t c_vids_data; - Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } - c_mode = (igraph_transitivity_mode_t) Rf_asInteger(mode); + Rz_SEXP_to_igraph_copy(graph, &c_graph); + IGRAPH_FINALLY(igraph_destroy, &c_graph); + IGRAPH_R_CHECK_INT(from); + c_from = (igraph_integer_t) REAL(from)[0]; + IGRAPH_R_CHECK_INT(to); + c_to = (igraph_integer_t) REAL(to)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_transitivity_barrat(&c_graph, &c_res, c_vids, (Rf_isNull(weights) ? 0 : &c_weights), c_mode)); + IGRAPH_R_CHECK(igraph_add_edge(&c_graph, c_from, c_to)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); - igraph_vector_destroy(&c_res); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_vids_data); - igraph_vs_destroy(&c_vids); - r_result = res; + r_result = graph; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_ecc / -/-------------------------------------------*/ -SEXP R_igraph_ecc(SEXP graph, SEXP eids, SEXP k, SEXP offset, SEXP normalize) { - /* Declarations */ - igraph_t c_graph; - igraph_vector_t c_res; - igraph_es_t c_eids; - igraph_integer_t c_k; - igraph_bool_t c_offset; - igraph_bool_t c_normalize; - SEXP res; +/ igraph_eigenvector_centrality / +/-------------------------------------------*/ +SEXP R_igraph_eigenvector_centrality(SEXP graph, SEXP directed, SEXP scale, SEXP weights, SEXP options) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_vector; + igraph_real_t c_value; + igraph_bool_t c_directed; + igraph_bool_t c_scale; + igraph_vector_t c_weights; + igraph_arpack_options_t c_options; + SEXP vector; + SEXP value; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_res); - igraph_vector_int_t c_eids_data; - IGRAPH_R_CHECK(Rz_SEXP_to_igraph_es(eids, &c_graph, &c_eids, &c_eids_data)); - IGRAPH_R_CHECK_INT(k); - c_k = (igraph_integer_t) REAL(k)[0]; - IGRAPH_R_CHECK_BOOL(offset); - c_offset = LOGICAL(offset)[0]; - IGRAPH_R_CHECK_BOOL(normalize); - c_normalize = LOGICAL(normalize)[0]; + IGRAPH_R_CHECK(igraph_vector_init(&c_vector, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_vector); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + IGRAPH_R_CHECK_BOOL(scale); + c_scale = LOGICAL(scale)[0]; + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + Rz_SEXP_to_igraph_arpack_options(options, &c_options); /* Call igraph */ - IGRAPH_R_CHECK(igraph_ecc(&c_graph, &c_res, c_eids, c_k, c_offset, c_normalize)); + IGRAPH_R_CHECK(igraph_eigenvector_centrality(&c_graph, &c_vector, &c_value, c_directed, c_scale, (Rf_isNull(weights) ? 0 : &c_weights), &c_options)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); - igraph_vector_destroy(&c_res); + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(vector=Ry_igraph_vector_to_SEXP(&c_vector)); + igraph_vector_destroy(&c_vector); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_eids_data); - igraph_es_destroy(&c_eids); - r_result = res; + PROTECT(value=NEW_NUMERIC(1)); + REAL(value)[0]=c_value; + PROTECT(options=Ry_igraph_arpack_options_to_SEXP(&c_options)); + SET_VECTOR_ELT(r_result, 0, vector); + SET_VECTOR_ELT(r_result, 1, value); + SET_VECTOR_ELT(r_result, 2, options); + SET_STRING_ELT(r_names, 0, Rf_mkChar("vector")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("value")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("options")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_reciprocity / +/ igraph_hub_score / /-------------------------------------------*/ -SEXP R_igraph_reciprocity(SEXP graph, SEXP ignore_loops, SEXP mode) { +SEXP R_igraph_hub_score(SEXP graph, SEXP scale, SEXP weights, SEXP options) { /* Declarations */ igraph_t c_graph; - igraph_real_t c_res; - igraph_bool_t c_ignore_loops; - igraph_reciprocity_t c_mode; - SEXP res; + igraph_vector_t c_vector; + igraph_real_t c_value; + igraph_bool_t c_scale; + igraph_vector_t c_weights; + igraph_arpack_options_t c_options; + SEXP vector; + SEXP value; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK_BOOL(ignore_loops); - c_ignore_loops = LOGICAL(ignore_loops)[0]; - c_mode = (igraph_reciprocity_t) Rf_asInteger(mode); + IGRAPH_R_CHECK(igraph_vector_init(&c_vector, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_vector); + IGRAPH_R_CHECK_BOOL(scale); + c_scale = LOGICAL(scale)[0]; + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + Rz_SEXP_to_igraph_arpack_options(options, &c_options); /* Call igraph */ - IGRAPH_R_CHECK(igraph_reciprocity(&c_graph, &c_res, c_ignore_loops, c_mode)); + IGRAPH_R_CHECK(igraph_hub_score(&c_graph, &c_vector, &c_value, c_scale, (Rf_isNull(weights) ? 0 : &c_weights), &c_options)); /* Convert output */ - PROTECT(res=NEW_NUMERIC(1)); - REAL(res)[0]=c_res; - r_result = res; + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(vector=Ry_igraph_vector_to_SEXP(&c_vector)); + igraph_vector_destroy(&c_vector); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(value=NEW_NUMERIC(1)); + REAL(value)[0]=c_value; + PROTECT(options=Ry_igraph_arpack_options_to_SEXP(&c_options)); + SET_VECTOR_ELT(r_result, 0, vector); + SET_VECTOR_ELT(r_result, 1, value); + SET_VECTOR_ELT(r_result, 2, options); + SET_STRING_ELT(r_names, 0, Rf_mkChar("vector")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("value")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("options")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_constraint / +/ igraph_authority_score / /-------------------------------------------*/ -SEXP R_igraph_constraint(SEXP graph, SEXP vids, SEXP weights) { +SEXP R_igraph_authority_score(SEXP graph, SEXP scale, SEXP weights, SEXP options) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_res; - igraph_vs_t c_vids; + igraph_vector_t c_vector; + igraph_real_t c_value; + igraph_bool_t c_scale; igraph_vector_t c_weights; - SEXP res; + igraph_arpack_options_t c_options; + SEXP vector; + SEXP value; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_res); - igraph_vector_int_t c_vids_data; - Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + IGRAPH_R_CHECK(igraph_vector_init(&c_vector, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_vector); + IGRAPH_R_CHECK_BOOL(scale); + c_scale = LOGICAL(scale)[0]; if (!Rf_isNull(weights)) { Rz_SEXP_to_vector(weights, &c_weights); } + Rz_SEXP_to_igraph_arpack_options(options, &c_options); /* Call igraph */ - IGRAPH_R_CHECK(igraph_constraint(&c_graph, &c_res, c_vids, (Rf_isNull(weights) ? 0 : &c_weights))); + IGRAPH_R_CHECK(igraph_authority_score(&c_graph, &c_vector, &c_value, c_scale, (Rf_isNull(weights) ? 0 : &c_weights), &c_options)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); - igraph_vector_destroy(&c_res); + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(vector=Ry_igraph_vector_to_SEXP(&c_vector)); + igraph_vector_destroy(&c_vector); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_vids_data); - igraph_vs_destroy(&c_vids); - r_result = res; + PROTECT(value=NEW_NUMERIC(1)); + REAL(value)[0]=c_value; + PROTECT(options=Ry_igraph_arpack_options_to_SEXP(&c_options)); + SET_VECTOR_ELT(r_result, 0, vector); + SET_VECTOR_ELT(r_result, 1, value); + SET_VECTOR_ELT(r_result, 2, options); + SET_STRING_ELT(r_names, 0, Rf_mkChar("vector")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("value")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("options")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_maxdegree / +/ igraph_hub_and_authority_scores / /-------------------------------------------*/ -SEXP R_igraph_maxdegree(SEXP graph, SEXP vids, SEXP mode, SEXP loops) { +SEXP R_igraph_hub_and_authority_scores(SEXP graph, SEXP scale, SEXP weights, SEXP options) { /* Declarations */ igraph_t c_graph; - igraph_integer_t c_res; - igraph_vs_t c_vids; - igraph_neimode_t c_mode; - igraph_bool_t c_loops; - SEXP res; + igraph_vector_t c_hub; + igraph_vector_t c_authority; + igraph_real_t c_value; + igraph_bool_t c_scale; + igraph_vector_t c_weights; + igraph_arpack_options_t c_options; + SEXP hub; + SEXP authority; + SEXP value; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - c_res=0; - igraph_vector_int_t c_vids_data; - Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); - c_mode = (igraph_neimode_t) Rf_asInteger(mode); - IGRAPH_R_CHECK_BOOL(loops); - c_loops = LOGICAL(loops)[0]; + IGRAPH_R_CHECK(igraph_vector_init(&c_hub, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_hub); + IGRAPH_R_CHECK(igraph_vector_init(&c_authority, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_authority); + IGRAPH_R_CHECK_BOOL(scale); + c_scale = LOGICAL(scale)[0]; + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + Rz_SEXP_to_igraph_arpack_options(options, &c_options); /* Call igraph */ - IGRAPH_R_CHECK(igraph_maxdegree(&c_graph, &c_res, c_vids, c_mode, c_loops)); + IGRAPH_R_CHECK(igraph_hub_and_authority_scores(&c_graph, &c_hub, &c_authority, &c_value, c_scale, (Rf_isNull(weights) ? 0 : &c_weights), &c_options)); /* Convert output */ - PROTECT(res=NEW_NUMERIC(1)); - REAL(res)[0]=(double) c_res; - igraph_vector_int_destroy(&c_vids_data); - igraph_vs_destroy(&c_vids); - r_result = res; + PROTECT(r_result=NEW_LIST(4)); + PROTECT(r_names=NEW_CHARACTER(4)); + PROTECT(hub=Ry_igraph_vector_to_SEXP(&c_hub)); + igraph_vector_destroy(&c_hub); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(authority=Ry_igraph_vector_to_SEXP(&c_authority)); + igraph_vector_destroy(&c_authority); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(value=NEW_NUMERIC(1)); + REAL(value)[0]=c_value; + PROTECT(options=Ry_igraph_arpack_options_to_SEXP(&c_options)); + SET_VECTOR_ELT(r_result, 0, hub); + SET_VECTOR_ELT(r_result, 1, authority); + SET_VECTOR_ELT(r_result, 2, value); + SET_VECTOR_ELT(r_result, 3, options); + SET_STRING_ELT(r_names, 0, Rf_mkChar("hub")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("authority")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("value")); + SET_STRING_ELT(r_names, 3, Rf_mkChar("options")); + SET_NAMES(r_result, r_names); + UNPROTECT(5); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_density / +/ igraph_unfold_tree / /-------------------------------------------*/ -SEXP R_igraph_density(SEXP graph, SEXP loops) { +SEXP R_igraph_unfold_tree(SEXP graph, SEXP mode, SEXP roots) { /* Declarations */ igraph_t c_graph; - igraph_real_t c_res; - igraph_bool_t c_loops; - SEXP res; + igraph_t c_tree; + igraph_neimode_t c_mode; + igraph_vector_int_t c_roots; + igraph_vector_int_t c_vertex_index; + SEXP tree; + SEXP vertex_index; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK_BOOL(loops); - c_loops = LOGICAL(loops)[0]; + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(roots, &c_roots)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_roots); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_vertex_index, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vertex_index); /* Call igraph */ - IGRAPH_R_CHECK(igraph_density(&c_graph, &c_res, c_loops)); + IGRAPH_R_CHECK(igraph_unfold_tree(&c_graph, &c_tree, c_mode, &c_roots, &c_vertex_index)); /* Convert output */ - PROTECT(res=NEW_NUMERIC(1)); - REAL(res)[0]=c_res; - r_result = res; + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + IGRAPH_FINALLY(igraph_destroy, &c_tree); + PROTECT(tree=Ry_igraph_to_SEXP(&c_tree)); + IGRAPH_I_DESTROY(&c_tree); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_roots); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(vertex_index=Ry_igraph_vector_int_to_SEXPp1(&c_vertex_index)); + igraph_vector_int_destroy(&c_vertex_index); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, tree); + SET_VECTOR_ELT(r_result, 1, vertex_index); + SET_STRING_ELT(r_names, 0, Rf_mkChar("tree")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("vertex_index")); + SET_NAMES(r_result, r_names); + UNPROTECT(3); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_mean_degree / +/ igraph_is_mutual / /-------------------------------------------*/ -SEXP R_igraph_mean_degree(SEXP graph, SEXP loops) { +SEXP R_igraph_is_mutual(SEXP graph, SEXP es, SEXP loops) { /* Declarations */ igraph_t c_graph; - igraph_real_t c_res; + igraph_vector_bool_t c_res; + igraph_es_t c_es; igraph_bool_t c_loops; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_bool_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_bool_destroy, &c_res); + igraph_vector_int_t c_es_data; + IGRAPH_R_CHECK(Rz_SEXP_to_igraph_es(es, &c_graph, &c_es, &c_es_data)); IGRAPH_R_CHECK_BOOL(loops); c_loops = LOGICAL(loops)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_mean_degree(&c_graph, &c_res, c_loops)); + IGRAPH_R_CHECK(igraph_is_mutual(&c_graph, &c_res, c_es, c_loops)); /* Convert output */ - PROTECT(res=NEW_NUMERIC(1)); - REAL(res)[0]=c_res; + PROTECT(res=Ry_igraph_vector_bool_to_SEXP(&c_res)); + igraph_vector_bool_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_es_data); + igraph_es_destroy(&c_es); r_result = res; UNPROTECT(1); @@ -4096,28 +6987,26 @@ SEXP R_igraph_mean_degree(SEXP graph, SEXP loops) { } /*-------------------------------------------/ -/ igraph_topological_sorting / +/ igraph_has_mutual / /-------------------------------------------*/ -SEXP R_igraph_topological_sorting(SEXP graph, SEXP mode) { +SEXP R_igraph_has_mutual(SEXP graph, SEXP loops) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_t c_res; - igraph_neimode_t c_mode; + igraph_bool_t c_res; + igraph_bool_t c_loops; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_res); - c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK_BOOL(loops); + c_loops = LOGICAL(loops)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_topological_sorting(&c_graph, &c_res, c_mode)); + IGRAPH_R_CHECK(igraph_has_mutual(&c_graph, &c_res, c_loops)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_int_to_SEXPp1(&c_res)); - igraph_vector_int_destroy(&c_res); - IGRAPH_FINALLY_CLEAN(1); + PROTECT(res=NEW_LOGICAL(1)); + LOGICAL(res)[0]=c_res; r_result = res; UNPROTECT(1); @@ -4125,145 +7014,243 @@ SEXP R_igraph_topological_sorting(SEXP graph, SEXP mode) { } /*-------------------------------------------/ -/ igraph_feedback_arc_set / +/ igraph_maximum_cardinality_search / /-------------------------------------------*/ -SEXP R_igraph_feedback_arc_set(SEXP graph, SEXP weights, SEXP algo) { +SEXP R_igraph_maximum_cardinality_search(SEXP graph) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_t c_result; - igraph_vector_t c_weights; - igraph_fas_algorithm_t c_algo; - SEXP result; + igraph_vector_int_t c_alpha; + igraph_vector_int_t c_alpham1; + SEXP alpha; + SEXP alpham1; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_result, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_result); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } - c_algo = (igraph_fas_algorithm_t) Rf_asInteger(algo); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_alpha, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_alpha); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_alpham1, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_alpham1); /* Call igraph */ - IGRAPH_R_CHECK(igraph_feedback_arc_set(&c_graph, &c_result, (Rf_isNull(weights) ? 0 : &c_weights), c_algo)); + IGRAPH_R_CHECK(igraph_maximum_cardinality_search(&c_graph, &c_alpha, &c_alpham1)); /* Convert output */ - PROTECT(result=Ry_igraph_vector_int_to_SEXPp1(&c_result)); - igraph_vector_int_destroy(&c_result); + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + PROTECT(alpha=Ry_igraph_vector_int_to_SEXPp1(&c_alpha)); + igraph_vector_int_destroy(&c_alpha); IGRAPH_FINALLY_CLEAN(1); - r_result = result; + PROTECT(alpham1=Ry_igraph_vector_int_to_SEXPp1(&c_alpham1)); + igraph_vector_int_destroy(&c_alpham1); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, alpha); + SET_VECTOR_ELT(r_result, 1, alpham1); + SET_STRING_ELT(r_names, 0, Rf_mkChar("alpha")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("alpham1")); + SET_NAMES(r_result, r_names); + UNPROTECT(3); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_feedback_vertex_set / +/ igraph_is_chordal / /-------------------------------------------*/ -SEXP R_igraph_feedback_vertex_set(SEXP graph, SEXP weights, SEXP algo) { +SEXP R_igraph_is_chordal(SEXP graph, SEXP alpha, SEXP alpham1) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_t c_result; - igraph_vector_t c_weights; - igraph_fvs_algorithm_t c_algo; - SEXP result; + igraph_vector_int_t c_alpha; + igraph_vector_int_t c_alpham1; + igraph_bool_t c_chordal; + igraph_vector_int_t c_fillin; + igraph_t c_newgraph; + SEXP chordal; + SEXP fillin; + SEXP newgraph; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_result, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_result); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); + if (!Rf_isNull(alpha)) { + Rz_SEXP_to_vector_int_copy(alpha, &c_alpha); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_alpha); + } else { + IGRAPH_R_CHECK(igraph_vector_int_init(&c_alpha, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_alpha); } - c_algo = (igraph_fvs_algorithm_t) Rf_asInteger(algo); + if (!Rf_isNull(alpham1)) { + Rz_SEXP_to_vector_int_copy(alpham1, &c_alpham1); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_alpham1); + } else { + IGRAPH_R_CHECK(igraph_vector_int_init(&c_alpham1, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_alpham1); + } + IGRAPH_R_CHECK(igraph_vector_int_init(&c_fillin, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_fillin); /* Call igraph */ - IGRAPH_R_CHECK(igraph_feedback_vertex_set(&c_graph, &c_result, (Rf_isNull(weights) ? 0 : &c_weights), c_algo)); + IGRAPH_R_CHECK(igraph_is_chordal(&c_graph, (Rf_isNull(alpha) ? 0 : &c_alpha), (Rf_isNull(alpham1) ? 0 : &c_alpham1), &c_chordal, &c_fillin, &c_newgraph)); /* Convert output */ - PROTECT(result=Ry_igraph_vector_int_to_SEXPp1(&c_result)); - igraph_vector_int_destroy(&c_result); + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + igraph_vector_int_destroy(&c_alpha); IGRAPH_FINALLY_CLEAN(1); - r_result = result; + igraph_vector_int_destroy(&c_alpham1); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(chordal=NEW_LOGICAL(1)); + LOGICAL(chordal)[0]=c_chordal; + PROTECT(fillin=Ry_igraph_vector_int_to_SEXP(&c_fillin)); + igraph_vector_int_destroy(&c_fillin); + IGRAPH_FINALLY_CLEAN(1); + IGRAPH_FINALLY(igraph_destroy, &c_newgraph); + PROTECT(newgraph=Ry_igraph_to_SEXP(&c_newgraph)); + IGRAPH_I_DESTROY(&c_newgraph); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, chordal); + SET_VECTOR_ELT(r_result, 1, fillin); + SET_VECTOR_ELT(r_result, 2, newgraph); + SET_STRING_ELT(r_names, 0, Rf_mkChar("chordal")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("fillin")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("newgraph")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_is_loop / +/ igraph_avg_nearest_neighbor_degree / /-------------------------------------------*/ -SEXP R_igraph_is_loop(SEXP graph, SEXP es) { +SEXP R_igraph_avg_nearest_neighbor_degree(SEXP graph, SEXP vids, SEXP mode, SEXP neighbor_degree_mode, SEXP weights) { /* Declarations */ igraph_t c_graph; - igraph_vector_bool_t c_res; - igraph_es_t c_es; - SEXP res; + igraph_vs_t c_vids; + igraph_neimode_t c_mode; + igraph_neimode_t c_neighbor_degree_mode; + igraph_vector_t c_knn; + igraph_vector_t c_knnk; + igraph_vector_t c_weights; + SEXP knn; + SEXP knnk; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_bool_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_bool_destroy, &c_res); - igraph_vector_int_t c_es_data; - IGRAPH_R_CHECK(Rz_SEXP_to_igraph_es(es, &c_graph, &c_es, &c_es_data)); + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + c_neighbor_degree_mode = (igraph_neimode_t) Rf_asInteger(neighbor_degree_mode); + IGRAPH_R_CHECK(igraph_vector_init(&c_knn, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_knn); + IGRAPH_R_CHECK(igraph_vector_init(&c_knnk, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_knnk); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } /* Call igraph */ - IGRAPH_R_CHECK(igraph_is_loop(&c_graph, &c_res, c_es)); + IGRAPH_R_CHECK(igraph_avg_nearest_neighbor_degree(&c_graph, c_vids, c_mode, c_neighbor_degree_mode, &c_knn, &c_knnk, (Rf_isNull(weights) ? 0 : &c_weights))); /* Convert output */ - PROTECT(res=Ry_igraph_vector_bool_to_SEXP(&c_res)); - igraph_vector_bool_destroy(&c_res); + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); + PROTECT(knn=Ry_igraph_vector_to_SEXP(&c_knn)); + igraph_vector_destroy(&c_knn); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_es_data); - igraph_es_destroy(&c_es); - r_result = res; + PROTECT(knnk=Ry_igraph_vector_to_SEXP(&c_knnk)); + igraph_vector_destroy(&c_knnk); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, knn); + SET_VECTOR_ELT(r_result, 1, knnk); + SET_STRING_ELT(r_names, 0, Rf_mkChar("knn")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("knnk")); + SET_NAMES(r_result, r_names); + UNPROTECT(3); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_is_dag / +/ igraph_degree_correlation_vector / /-------------------------------------------*/ -SEXP R_igraph_is_dag(SEXP graph) { +SEXP R_igraph_degree_correlation_vector(SEXP graph, SEXP weights, SEXP from_mode, SEXP to_mode, SEXP directed_neighbors) { /* Declarations */ igraph_t c_graph; - igraph_bool_t c_res; - SEXP res; + igraph_vector_t c_weights; + igraph_vector_t c_knnk; + igraph_neimode_t c_from_mode; + igraph_neimode_t c_to_mode; + igraph_bool_t c_directed_neighbors; + SEXP knnk; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + IGRAPH_R_CHECK(igraph_vector_init(&c_knnk, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_knnk); + c_from_mode = (igraph_neimode_t) Rf_asInteger(from_mode); + c_to_mode = (igraph_neimode_t) Rf_asInteger(to_mode); + IGRAPH_R_CHECK_BOOL(directed_neighbors); + c_directed_neighbors = LOGICAL(directed_neighbors)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_is_dag(&c_graph, &c_res)); + IGRAPH_R_CHECK(igraph_degree_correlation_vector(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_knnk, c_from_mode, c_to_mode, c_directed_neighbors)); /* Convert output */ - PROTECT(res=NEW_LOGICAL(1)); - LOGICAL(res)[0]=c_res; - r_result = res; + PROTECT(knnk=Ry_igraph_vector_to_SEXP(&c_knnk)); + igraph_vector_destroy(&c_knnk); + IGRAPH_FINALLY_CLEAN(1); + r_result = knnk; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_is_acyclic / +/ igraph_rich_club_sequence / /-------------------------------------------*/ -SEXP R_igraph_is_acyclic(SEXP graph) { +SEXP R_igraph_rich_club_sequence(SEXP graph, SEXP weights, SEXP vertex_order, SEXP normalized, SEXP loops, SEXP directed) { /* Declarations */ igraph_t c_graph; - igraph_bool_t c_res; + igraph_vector_t c_weights; + igraph_vector_t c_res; + igraph_vector_int_t c_vertex_order; + igraph_bool_t c_normalized; + igraph_bool_t c_loops; + igraph_bool_t c_directed; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + Rz_SEXP_to_vector_int_copy(vertex_order, &c_vertex_order); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vertex_order); + IGRAPH_R_CHECK_BOOL(normalized); + c_normalized = LOGICAL(normalized)[0]; + IGRAPH_R_CHECK_BOOL(loops); + c_loops = LOGICAL(loops)[0]; + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_is_acyclic(&c_graph, &c_res)); + IGRAPH_R_CHECK(igraph_rich_club_sequence(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_res, &c_vertex_order, c_normalized, c_loops, c_directed)); /* Convert output */ - PROTECT(res=NEW_LOGICAL(1)); - LOGICAL(res)[0]=c_res; + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_vertex_order); + IGRAPH_FINALLY_CLEAN(1); r_result = res; UNPROTECT(1); @@ -4271,23 +7258,40 @@ SEXP R_igraph_is_acyclic(SEXP graph) { } /*-------------------------------------------/ -/ igraph_is_simple / +/ igraph_strength / /-------------------------------------------*/ -SEXP R_igraph_is_simple(SEXP graph) { +SEXP R_igraph_strength(SEXP graph, SEXP vids, SEXP mode, SEXP loops, SEXP weights) { /* Declarations */ igraph_t c_graph; - igraph_bool_t c_res; + igraph_vector_t c_res; + igraph_vs_t c_vids; + igraph_neimode_t c_mode; + igraph_bool_t c_loops; + igraph_vector_t c_weights; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK_BOOL(loops); + c_loops = LOGICAL(loops)[0]; + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } /* Call igraph */ - IGRAPH_R_CHECK(igraph_is_simple(&c_graph, &c_res)); + IGRAPH_R_CHECK(igraph_strength(&c_graph, &c_res, c_vids, c_mode, c_loops, (Rf_isNull(weights) ? 0 : &c_weights))); /* Convert output */ - PROTECT(res=NEW_LOGICAL(1)); - LOGICAL(res)[0]=c_res; + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); r_result = res; UNPROTECT(1); @@ -4295,79 +7299,113 @@ SEXP R_igraph_is_simple(SEXP graph) { } /*-------------------------------------------/ -/ igraph_is_multiple / +/ igraph_centralization / /-------------------------------------------*/ -SEXP R_igraph_is_multiple(SEXP graph, SEXP es) { +SEXP R_igraph_centralization(SEXP scores, SEXP theoretical_max, SEXP normalized) { /* Declarations */ - igraph_t c_graph; - igraph_vector_bool_t c_res; - igraph_es_t c_es; - SEXP res; - + igraph_vector_t c_scores; + igraph_real_t c_theoretical_max; + igraph_bool_t c_normalized; + igraph_real_t c_result; SEXP r_result; /* Convert input */ - Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_bool_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_bool_destroy, &c_res); - igraph_vector_int_t c_es_data; - IGRAPH_R_CHECK(Rz_SEXP_to_igraph_es(es, &c_graph, &c_es, &c_es_data)); + Rz_SEXP_to_vector(scores, &c_scores); + IGRAPH_R_CHECK_REAL(theoretical_max); + c_theoretical_max = REAL(theoretical_max)[0]; + IGRAPH_R_CHECK_BOOL(normalized); + c_normalized = LOGICAL(normalized)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_is_multiple(&c_graph, &c_res, c_es)); + c_result=igraph_centralization(&c_scores, c_theoretical_max, c_normalized); /* Convert output */ - PROTECT(res=Ry_igraph_vector_bool_to_SEXP(&c_res)); - igraph_vector_bool_destroy(&c_res); - IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_es_data); - igraph_es_destroy(&c_es); - r_result = res; + + PROTECT(r_result=NEW_NUMERIC(1)); + REAL(r_result)[0]=c_result; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_has_loop / +/ igraph_centralization_degree / /-------------------------------------------*/ -SEXP R_igraph_has_loop(SEXP graph) { +SEXP R_igraph_centralization_degree(SEXP graph, SEXP mode, SEXP loops, SEXP normalized) { /* Declarations */ igraph_t c_graph; - igraph_bool_t c_res; + igraph_vector_t c_res; + igraph_neimode_t c_mode; + igraph_bool_t c_loops; + igraph_real_t c_centralization; + igraph_real_t c_theoretical_max; + igraph_bool_t c_normalized; SEXP res; + SEXP centralization; + SEXP theoretical_max; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK_BOOL(loops); + c_loops = LOGICAL(loops)[0]; + IGRAPH_R_CHECK_BOOL(normalized); + c_normalized = LOGICAL(normalized)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_has_loop(&c_graph, &c_res)); + IGRAPH_R_CHECK(igraph_centralization_degree(&c_graph, &c_res, c_mode, c_loops, &c_centralization, &c_theoretical_max, c_normalized)); /* Convert output */ - PROTECT(res=NEW_LOGICAL(1)); - LOGICAL(res)[0]=c_res; - r_result = res; + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(centralization=NEW_NUMERIC(1)); + REAL(centralization)[0]=c_centralization; + PROTECT(theoretical_max=NEW_NUMERIC(1)); + REAL(theoretical_max)[0]=c_theoretical_max; + SET_VECTOR_ELT(r_result, 0, res); + SET_VECTOR_ELT(r_result, 1, centralization); + SET_VECTOR_ELT(r_result, 2, theoretical_max); + SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("centralization")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("theoretical_max")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_has_multiple / +/ igraph_centralization_degree_tmax / /-------------------------------------------*/ -SEXP R_igraph_has_multiple(SEXP graph) { +SEXP R_igraph_centralization_degree_tmax(SEXP graph, SEXP nodes, SEXP mode, SEXP loops) { /* Declarations */ igraph_t c_graph; - igraph_bool_t c_res; + igraph_integer_t c_nodes; + igraph_neimode_t c_mode; + igraph_bool_t c_loops; + igraph_real_t c_res; SEXP res; SEXP r_result; /* Convert input */ - Rz_SEXP_to_igraph(graph, &c_graph); + if (!Rf_isNull(graph)) { + Rz_SEXP_to_igraph(graph, &c_graph); + } + IGRAPH_R_CHECK_INT(nodes); + c_nodes = (igraph_integer_t) REAL(nodes)[0]; + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK_BOOL(loops); + c_loops = LOGICAL(loops)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_has_multiple(&c_graph, &c_res)); + IGRAPH_R_CHECK(igraph_centralization_degree_tmax((Rf_isNull(graph) ? 0 : &c_graph), c_nodes, c_mode, c_loops, &c_res)); /* Convert output */ - PROTECT(res=NEW_LOGICAL(1)); - LOGICAL(res)[0]=c_res; + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=c_res; r_result = res; UNPROTECT(1); @@ -4375,56 +7413,81 @@ SEXP R_igraph_has_multiple(SEXP graph) { } /*-------------------------------------------/ -/ igraph_count_loops / +/ igraph_centralization_betweenness / /-------------------------------------------*/ -SEXP R_igraph_count_loops(SEXP graph) { +SEXP R_igraph_centralization_betweenness(SEXP graph, SEXP directed, SEXP normalized) { /* Declarations */ igraph_t c_graph; - igraph_integer_t c_loop_count; - SEXP loop_count; + igraph_vector_t c_res; + igraph_bool_t c_directed; + igraph_real_t c_centralization; + igraph_real_t c_theoretical_max; + igraph_bool_t c_normalized; + SEXP res; + SEXP centralization; + SEXP theoretical_max; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - c_loop_count=0; + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + IGRAPH_R_CHECK_BOOL(normalized); + c_normalized = LOGICAL(normalized)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_count_loops(&c_graph, &c_loop_count)); + IGRAPH_R_CHECK(igraph_centralization_betweenness(&c_graph, &c_res, c_directed, &c_centralization, &c_theoretical_max, c_normalized)); /* Convert output */ - PROTECT(loop_count=NEW_NUMERIC(1)); - REAL(loop_count)[0]=(double) c_loop_count; - r_result = loop_count; + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(centralization=NEW_NUMERIC(1)); + REAL(centralization)[0]=c_centralization; + PROTECT(theoretical_max=NEW_NUMERIC(1)); + REAL(theoretical_max)[0]=c_theoretical_max; + SET_VECTOR_ELT(r_result, 0, res); + SET_VECTOR_ELT(r_result, 1, centralization); + SET_VECTOR_ELT(r_result, 2, theoretical_max); + SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("centralization")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("theoretical_max")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_count_multiple / +/ igraph_centralization_betweenness_tmax / /-------------------------------------------*/ -SEXP R_igraph_count_multiple(SEXP graph, SEXP es) { +SEXP R_igraph_centralization_betweenness_tmax(SEXP graph, SEXP nodes, SEXP directed) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_t c_res; - igraph_es_t c_es; + igraph_integer_t c_nodes; + igraph_bool_t c_directed; + igraph_real_t c_res; SEXP res; SEXP r_result; /* Convert input */ - Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_res); - igraph_vector_int_t c_es_data; - IGRAPH_R_CHECK(Rz_SEXP_to_igraph_es(es, &c_graph, &c_es, &c_es_data)); + if (!Rf_isNull(graph)) { + Rz_SEXP_to_igraph(graph, &c_graph); + } + IGRAPH_R_CHECK_INT(nodes); + c_nodes = (igraph_integer_t) REAL(nodes)[0]; + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_count_multiple(&c_graph, &c_res, c_es)); + IGRAPH_R_CHECK(igraph_centralization_betweenness_tmax((Rf_isNull(graph) ? 0 : &c_graph), c_nodes, c_directed, &c_res)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_int_to_SEXP(&c_res)); - igraph_vector_int_destroy(&c_res); - IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_es_data); - igraph_es_destroy(&c_es); + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=c_res; r_result = res; UNPROTECT(1); @@ -4432,61 +7495,79 @@ SEXP R_igraph_count_multiple(SEXP graph, SEXP es) { } /*-------------------------------------------/ -/ igraph_girth / +/ igraph_centralization_closeness / /-------------------------------------------*/ -SEXP R_igraph_girth(SEXP graph) { +SEXP R_igraph_centralization_closeness(SEXP graph, SEXP mode, SEXP normalized) { /* Declarations */ igraph_t c_graph; - igraph_real_t c_girth; - igraph_vector_int_t c_circle; - SEXP girth; - SEXP circle; + igraph_vector_t c_res; + igraph_neimode_t c_mode; + igraph_real_t c_centralization; + igraph_real_t c_theoretical_max; + igraph_bool_t c_normalized; + SEXP res; + SEXP centralization; + SEXP theoretical_max; SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_circle, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_circle); + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK_BOOL(normalized); + c_normalized = LOGICAL(normalized)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_girth(&c_graph, &c_girth, &c_circle)); + IGRAPH_R_CHECK(igraph_centralization_closeness(&c_graph, &c_res, c_mode, &c_centralization, &c_theoretical_max, c_normalized)); /* Convert output */ - PROTECT(r_result=NEW_LIST(2)); - PROTECT(r_names=NEW_CHARACTER(2)); - PROTECT(girth=NEW_NUMERIC(1)); - REAL(girth)[0]=c_girth; - PROTECT(circle=Ry_igraph_vector_int_to_SEXPp1(&c_circle)); - igraph_vector_int_destroy(&c_circle); + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, girth); - SET_VECTOR_ELT(r_result, 1, circle); - SET_STRING_ELT(r_names, 0, Rf_mkChar("girth")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("circle")); + PROTECT(centralization=NEW_NUMERIC(1)); + REAL(centralization)[0]=c_centralization; + PROTECT(theoretical_max=NEW_NUMERIC(1)); + REAL(theoretical_max)[0]=c_theoretical_max; + SET_VECTOR_ELT(r_result, 0, res); + SET_VECTOR_ELT(r_result, 1, centralization); + SET_VECTOR_ELT(r_result, 2, theoretical_max); + SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("centralization")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("theoretical_max")); SET_NAMES(r_result, r_names); - UNPROTECT(3); + UNPROTECT(4); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_is_perfect / +/ igraph_centralization_closeness_tmax / /-------------------------------------------*/ -SEXP R_igraph_is_perfect(SEXP graph) { +SEXP R_igraph_centralization_closeness_tmax(SEXP graph, SEXP nodes, SEXP mode) { /* Declarations */ igraph_t c_graph; - igraph_bool_t c_res; + igraph_integer_t c_nodes; + igraph_neimode_t c_mode; + igraph_real_t c_res; SEXP res; SEXP r_result; /* Convert input */ - Rz_SEXP_to_igraph(graph, &c_graph); + if (!Rf_isNull(graph)) { + Rz_SEXP_to_igraph(graph, &c_graph); + } + IGRAPH_R_CHECK_INT(nodes); + c_nodes = (igraph_integer_t) REAL(nodes)[0]; + c_mode = (igraph_neimode_t) Rf_asInteger(mode); /* Call igraph */ - IGRAPH_R_CHECK(igraph_is_perfect(&c_graph, &c_res)); + IGRAPH_R_CHECK(igraph_centralization_closeness_tmax((Rf_isNull(graph) ? 0 : &c_graph), c_nodes, c_mode, &c_res)); /* Convert output */ - PROTECT(res=NEW_LOGICAL(1)); - LOGICAL(res)[0]=c_res; + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=c_res; r_result = res; UNPROTECT(1); @@ -4494,19 +7575,23 @@ SEXP R_igraph_is_perfect(SEXP graph) { } /*-------------------------------------------/ -/ igraph_eigenvector_centrality / +/ igraph_centralization_eigenvector_centrality / /-------------------------------------------*/ -SEXP R_igraph_eigenvector_centrality(SEXP graph, SEXP directed, SEXP scale, SEXP weights, SEXP options) { +SEXP R_igraph_centralization_eigenvector_centrality(SEXP graph, SEXP directed, SEXP scale, SEXP options, SEXP normalized) { /* Declarations */ igraph_t c_graph; igraph_vector_t c_vector; igraph_real_t c_value; igraph_bool_t c_directed; igraph_bool_t c_scale; - igraph_vector_t c_weights; igraph_arpack_options_t c_options; + igraph_real_t c_centralization; + igraph_real_t c_theoretical_max; + igraph_bool_t c_normalized; SEXP vector; SEXP value; + SEXP centralization; + SEXP theoretical_max; SEXP r_result, r_names; /* Convert input */ @@ -4517,170 +7602,142 @@ SEXP R_igraph_eigenvector_centrality(SEXP graph, SEXP directed, SEXP scale, SEXP c_directed = LOGICAL(directed)[0]; IGRAPH_R_CHECK_BOOL(scale); c_scale = LOGICAL(scale)[0]; - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } Rz_SEXP_to_igraph_arpack_options(options, &c_options); + IGRAPH_R_CHECK_BOOL(normalized); + c_normalized = LOGICAL(normalized)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_eigenvector_centrality(&c_graph, &c_vector, &c_value, c_directed, c_scale, (Rf_isNull(weights) ? 0 : &c_weights), &c_options)); + IGRAPH_R_CHECK(igraph_centralization_eigenvector_centrality(&c_graph, &c_vector, &c_value, c_directed, c_scale, &c_options, &c_centralization, &c_theoretical_max, c_normalized)); /* Convert output */ - PROTECT(r_result=NEW_LIST(3)); - PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(r_result=NEW_LIST(5)); + PROTECT(r_names=NEW_CHARACTER(5)); PROTECT(vector=Ry_igraph_vector_to_SEXP(&c_vector)); igraph_vector_destroy(&c_vector); IGRAPH_FINALLY_CLEAN(1); PROTECT(value=NEW_NUMERIC(1)); REAL(value)[0]=c_value; PROTECT(options=Ry_igraph_arpack_options_to_SEXP(&c_options)); + PROTECT(centralization=NEW_NUMERIC(1)); + REAL(centralization)[0]=c_centralization; + PROTECT(theoretical_max=NEW_NUMERIC(1)); + REAL(theoretical_max)[0]=c_theoretical_max; SET_VECTOR_ELT(r_result, 0, vector); SET_VECTOR_ELT(r_result, 1, value); SET_VECTOR_ELT(r_result, 2, options); + SET_VECTOR_ELT(r_result, 3, centralization); + SET_VECTOR_ELT(r_result, 4, theoretical_max); SET_STRING_ELT(r_names, 0, Rf_mkChar("vector")); SET_STRING_ELT(r_names, 1, Rf_mkChar("value")); SET_STRING_ELT(r_names, 2, Rf_mkChar("options")); + SET_STRING_ELT(r_names, 3, Rf_mkChar("centralization")); + SET_STRING_ELT(r_names, 4, Rf_mkChar("theoretical_max")); SET_NAMES(r_result, r_names); - UNPROTECT(4); + UNPROTECT(6); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_hub_and_authority_scores / +/ igraph_centralization_eigenvector_centrality_tmax / /-------------------------------------------*/ -SEXP R_igraph_hub_and_authority_scores(SEXP graph, SEXP scale, SEXP weights, SEXP options) { +SEXP R_igraph_centralization_eigenvector_centrality_tmax(SEXP graph, SEXP nodes, SEXP directed, SEXP scale) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_hub; - igraph_vector_t c_authority; - igraph_real_t c_value; + igraph_integer_t c_nodes; + igraph_bool_t c_directed; igraph_bool_t c_scale; - igraph_vector_t c_weights; - igraph_arpack_options_t c_options; - SEXP hub; - SEXP authority; - SEXP value; + igraph_real_t c_res; + SEXP res; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ - Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_init(&c_hub, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_hub); - IGRAPH_R_CHECK(igraph_vector_init(&c_authority, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_authority); + if (!Rf_isNull(graph)) { + Rz_SEXP_to_igraph(graph, &c_graph); + } + IGRAPH_R_CHECK_INT(nodes); + c_nodes = (igraph_integer_t) REAL(nodes)[0]; + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; IGRAPH_R_CHECK_BOOL(scale); c_scale = LOGICAL(scale)[0]; - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } - Rz_SEXP_to_igraph_arpack_options(options, &c_options); /* Call igraph */ - IGRAPH_R_CHECK(igraph_hub_and_authority_scores(&c_graph, &c_hub, &c_authority, &c_value, c_scale, (Rf_isNull(weights) ? 0 : &c_weights), &c_options)); + IGRAPH_R_CHECK(igraph_centralization_eigenvector_centrality_tmax((Rf_isNull(graph) ? 0 : &c_graph), c_nodes, c_directed, c_scale, &c_res)); /* Convert output */ - PROTECT(r_result=NEW_LIST(4)); - PROTECT(r_names=NEW_CHARACTER(4)); - PROTECT(hub=Ry_igraph_vector_to_SEXP(&c_hub)); - igraph_vector_destroy(&c_hub); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(authority=Ry_igraph_vector_to_SEXP(&c_authority)); - igraph_vector_destroy(&c_authority); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(value=NEW_NUMERIC(1)); - REAL(value)[0]=c_value; - PROTECT(options=Ry_igraph_arpack_options_to_SEXP(&c_options)); - SET_VECTOR_ELT(r_result, 0, hub); - SET_VECTOR_ELT(r_result, 1, authority); - SET_VECTOR_ELT(r_result, 2, value); - SET_VECTOR_ELT(r_result, 3, options); - SET_STRING_ELT(r_names, 0, Rf_mkChar("hub")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("authority")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("value")); - SET_STRING_ELT(r_names, 3, Rf_mkChar("options")); - SET_NAMES(r_result, r_names); - UNPROTECT(5); + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=c_res; + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_unfold_tree / +/ igraph_assortativity_nominal / /-------------------------------------------*/ -SEXP R_igraph_unfold_tree(SEXP graph, SEXP mode, SEXP roots) { +SEXP R_igraph_assortativity_nominal(SEXP graph, SEXP types, SEXP directed, SEXP normalized) { /* Declarations */ igraph_t c_graph; - igraph_t c_tree; - igraph_neimode_t c_mode; - igraph_vector_int_t c_roots; - igraph_vector_int_t c_vertex_index; - SEXP tree; - SEXP vertex_index; + igraph_vector_int_t c_types; + igraph_real_t c_res; + igraph_bool_t c_directed; + igraph_bool_t c_normalized; + SEXP res; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - c_mode = (igraph_neimode_t) Rf_asInteger(mode); - IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(roots, &c_roots)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_roots); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_vertex_index, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vertex_index); + Rz_SEXP_to_vector_int_copy(types, &c_types); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_types); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + IGRAPH_R_CHECK_BOOL(normalized); + c_normalized = LOGICAL(normalized)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_unfold_tree(&c_graph, &c_tree, c_mode, &c_roots, &c_vertex_index)); + IGRAPH_R_CHECK(igraph_assortativity_nominal(&c_graph, &c_types, &c_res, c_directed, c_normalized)); /* Convert output */ - PROTECT(r_result=NEW_LIST(2)); - PROTECT(r_names=NEW_CHARACTER(2)); - IGRAPH_FINALLY(igraph_destroy, &c_tree); - PROTECT(tree=Ry_igraph_to_SEXP(&c_tree)); - IGRAPH_I_DESTROY(&c_tree); - IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_roots); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(vertex_index=Ry_igraph_vector_int_to_SEXPp1(&c_vertex_index)); - igraph_vector_int_destroy(&c_vertex_index); + igraph_vector_int_destroy(&c_types); IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, tree); - SET_VECTOR_ELT(r_result, 1, vertex_index); - SET_STRING_ELT(r_names, 0, Rf_mkChar("tree")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("vertex_index")); - SET_NAMES(r_result, r_names); - UNPROTECT(3); + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=c_res; + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_is_mutual / +/ igraph_assortativity / /-------------------------------------------*/ -SEXP R_igraph_is_mutual(SEXP graph, SEXP es, SEXP loops) { +SEXP R_igraph_assortativity(SEXP graph, SEXP values, SEXP values_in, SEXP directed, SEXP normalized) { /* Declarations */ igraph_t c_graph; - igraph_vector_bool_t c_res; - igraph_es_t c_es; - igraph_bool_t c_loops; + igraph_vector_t c_values; + igraph_vector_t c_values_in; + igraph_real_t c_res; + igraph_bool_t c_directed; + igraph_bool_t c_normalized; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_bool_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_bool_destroy, &c_res); - igraph_vector_int_t c_es_data; - IGRAPH_R_CHECK(Rz_SEXP_to_igraph_es(es, &c_graph, &c_es, &c_es_data)); - IGRAPH_R_CHECK_BOOL(loops); - c_loops = LOGICAL(loops)[0]; + Rz_SEXP_to_vector(values, &c_values); + if (!Rf_isNull(values_in)) { + Rz_SEXP_to_vector(values_in, &c_values_in); + } + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + IGRAPH_R_CHECK_BOOL(normalized); + c_normalized = LOGICAL(normalized)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_is_mutual(&c_graph, &c_res, c_es, c_loops)); + IGRAPH_R_CHECK(igraph_assortativity(&c_graph, &c_values, (Rf_isNull(values_in) ? 0 : &c_values_in), &c_res, c_directed, c_normalized)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_bool_to_SEXP(&c_res)); - igraph_vector_bool_destroy(&c_res); - IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_es_data); - igraph_es_destroy(&c_es); + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=c_res; r_result = res; UNPROTECT(1); @@ -4688,26 +7745,26 @@ SEXP R_igraph_is_mutual(SEXP graph, SEXP es, SEXP loops) { } /*-------------------------------------------/ -/ igraph_has_mutual / +/ igraph_assortativity_degree / /-------------------------------------------*/ -SEXP R_igraph_has_mutual(SEXP graph, SEXP loops) { +SEXP R_igraph_assortativity_degree(SEXP graph, SEXP directed) { /* Declarations */ igraph_t c_graph; - igraph_bool_t c_res; - igraph_bool_t c_loops; + igraph_real_t c_res; + igraph_bool_t c_directed; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK_BOOL(loops); - c_loops = LOGICAL(loops)[0]; + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_has_mutual(&c_graph, &c_res, c_loops)); + IGRAPH_R_CHECK(igraph_assortativity_degree(&c_graph, &c_res, c_directed)); /* Convert output */ - PROTECT(res=NEW_LOGICAL(1)); - LOGICAL(res)[0]=c_res; + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=c_res; r_result = res; UNPROTECT(1); @@ -4715,177 +7772,203 @@ SEXP R_igraph_has_mutual(SEXP graph, SEXP loops) { } /*-------------------------------------------/ -/ igraph_maximum_cardinality_search / +/ igraph_joint_degree_matrix / /-------------------------------------------*/ -SEXP R_igraph_maximum_cardinality_search(SEXP graph) { +SEXP R_igraph_joint_degree_matrix(SEXP graph, SEXP weights, SEXP max_out_degree, SEXP max_in_degree) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_t c_alpha; - igraph_vector_int_t c_alpham1; - SEXP alpha; - SEXP alpham1; + igraph_vector_t c_weights; + igraph_matrix_t c_jdm; + igraph_integer_t c_max_out_degree; + igraph_integer_t c_max_in_degree; + SEXP jdm; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_alpha, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_alpha); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_alpham1, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_alpham1); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + IGRAPH_R_CHECK(igraph_matrix_init(&c_jdm, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_jdm); + IGRAPH_R_CHECK_INT(max_out_degree); + c_max_out_degree = (igraph_integer_t) REAL(max_out_degree)[0]; + IGRAPH_R_CHECK_INT(max_in_degree); + c_max_in_degree = (igraph_integer_t) REAL(max_in_degree)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_joint_degree_matrix(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_jdm, c_max_out_degree, c_max_in_degree)); + + /* Convert output */ + PROTECT(jdm=Ry_igraph_matrix_to_SEXP(&c_jdm)); + igraph_matrix_destroy(&c_jdm); + IGRAPH_FINALLY_CLEAN(1); + r_result = jdm; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_joint_degree_distribution / +/-------------------------------------------*/ +SEXP R_igraph_joint_degree_distribution(SEXP graph, SEXP weights, SEXP from_mode, SEXP to_mode, SEXP directed_neighbors, SEXP normalized, SEXP max_from_degree, SEXP max_to_degree) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_weights; + igraph_matrix_t c_p; + igraph_neimode_t c_from_mode; + igraph_neimode_t c_to_mode; + igraph_bool_t c_directed_neighbors; + igraph_bool_t c_normalized; + igraph_integer_t c_max_from_degree; + igraph_integer_t c_max_to_degree; + SEXP p; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + IGRAPH_R_CHECK(igraph_matrix_init(&c_p, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_p); + c_from_mode = (igraph_neimode_t) Rf_asInteger(from_mode); + c_to_mode = (igraph_neimode_t) Rf_asInteger(to_mode); + IGRAPH_R_CHECK_BOOL(directed_neighbors); + c_directed_neighbors = LOGICAL(directed_neighbors)[0]; + IGRAPH_R_CHECK_BOOL(normalized); + c_normalized = LOGICAL(normalized)[0]; + IGRAPH_R_CHECK_INT(max_from_degree); + c_max_from_degree = (igraph_integer_t) REAL(max_from_degree)[0]; + IGRAPH_R_CHECK_INT(max_to_degree); + c_max_to_degree = (igraph_integer_t) REAL(max_to_degree)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_maximum_cardinality_search(&c_graph, &c_alpha, &c_alpham1)); + IGRAPH_R_CHECK(igraph_joint_degree_distribution(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_p, c_from_mode, c_to_mode, c_directed_neighbors, c_normalized, c_max_from_degree, c_max_to_degree)); /* Convert output */ - PROTECT(r_result=NEW_LIST(2)); - PROTECT(r_names=NEW_CHARACTER(2)); - PROTECT(alpha=Ry_igraph_vector_int_to_SEXPp1(&c_alpha)); - igraph_vector_int_destroy(&c_alpha); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(alpham1=Ry_igraph_vector_int_to_SEXPp1(&c_alpham1)); - igraph_vector_int_destroy(&c_alpham1); + PROTECT(p=Ry_igraph_matrix_to_SEXP(&c_p)); + igraph_matrix_destroy(&c_p); IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, alpha); - SET_VECTOR_ELT(r_result, 1, alpham1); - SET_STRING_ELT(r_names, 0, Rf_mkChar("alpha")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("alpham1")); - SET_NAMES(r_result, r_names); - UNPROTECT(3); + r_result = p; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_avg_nearest_neighbor_degree / +/ igraph_joint_type_distribution / /-------------------------------------------*/ -SEXP R_igraph_avg_nearest_neighbor_degree(SEXP graph, SEXP vids, SEXP mode, SEXP neighbor_degree_mode, SEXP weights) { +SEXP R_igraph_joint_type_distribution(SEXP graph, SEXP weights, SEXP from_types, SEXP to_types, SEXP directed, SEXP normalized) { /* Declarations */ igraph_t c_graph; - igraph_vs_t c_vids; - igraph_neimode_t c_mode; - igraph_neimode_t c_neighbor_degree_mode; - igraph_vector_t c_knn; - igraph_vector_t c_knnk; igraph_vector_t c_weights; - SEXP knn; - SEXP knnk; + igraph_matrix_t c_p; + igraph_vector_int_t c_from_types; + igraph_vector_int_t c_to_types; + igraph_bool_t c_directed; + igraph_bool_t c_normalized; + SEXP p; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - igraph_vector_int_t c_vids_data; - Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); - c_mode = (igraph_neimode_t) Rf_asInteger(mode); - c_neighbor_degree_mode = (igraph_neimode_t) Rf_asInteger(neighbor_degree_mode); - IGRAPH_R_CHECK(igraph_vector_init(&c_knn, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_knn); - IGRAPH_R_CHECK(igraph_vector_init(&c_knnk, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_knnk); if (!Rf_isNull(weights)) { Rz_SEXP_to_vector(weights, &c_weights); } + IGRAPH_R_CHECK(igraph_matrix_init(&c_p, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_p); + Rz_SEXP_to_vector_int_copy(from_types, &c_from_types); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_from_types); + if (!Rf_isNull(to_types)) { + Rz_SEXP_to_vector_int_copy(to_types, &c_to_types); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_to_types); + } else { + IGRAPH_R_CHECK(igraph_vector_int_init(&c_to_types, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_to_types); + } + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + IGRAPH_R_CHECK_BOOL(normalized); + c_normalized = LOGICAL(normalized)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_avg_nearest_neighbor_degree(&c_graph, c_vids, c_mode, c_neighbor_degree_mode, &c_knn, &c_knnk, (Rf_isNull(weights) ? 0 : &c_weights))); + IGRAPH_R_CHECK(igraph_joint_type_distribution(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_p, &c_from_types, (Rf_isNull(to_types) ? 0 : &c_to_types), c_directed, c_normalized)); /* Convert output */ - PROTECT(r_result=NEW_LIST(2)); - PROTECT(r_names=NEW_CHARACTER(2)); - igraph_vector_int_destroy(&c_vids_data); - igraph_vs_destroy(&c_vids); - PROTECT(knn=Ry_igraph_vector_to_SEXP(&c_knn)); - igraph_vector_destroy(&c_knn); + PROTECT(p=Ry_igraph_matrix_to_SEXP(&c_p)); + igraph_matrix_destroy(&c_p); IGRAPH_FINALLY_CLEAN(1); - PROTECT(knnk=Ry_igraph_vector_to_SEXP(&c_knnk)); - igraph_vector_destroy(&c_knnk); + igraph_vector_int_destroy(&c_from_types); IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, knn); - SET_VECTOR_ELT(r_result, 1, knnk); - SET_STRING_ELT(r_names, 0, Rf_mkChar("knn")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("knnk")); - SET_NAMES(r_result, r_names); - UNPROTECT(3); + igraph_vector_int_destroy(&c_to_types); + IGRAPH_FINALLY_CLEAN(1); + r_result = p; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_degree_correlation_vector / +/ igraph_contract_vertices / /-------------------------------------------*/ -SEXP R_igraph_degree_correlation_vector(SEXP graph, SEXP weights, SEXP from_mode, SEXP to_mode, SEXP directed_neighbors) { +SEXP R_igraph_contract_vertices(SEXP graph, SEXP mapping, SEXP vertex_attr_comb) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_weights; - igraph_vector_t c_knnk; - igraph_neimode_t c_from_mode; - igraph_neimode_t c_to_mode; - igraph_bool_t c_directed_neighbors; - SEXP knnk; + igraph_vector_int_t c_mapping; + igraph_attribute_combination_t c_vertex_attr_comb; SEXP r_result; /* Convert input */ - Rz_SEXP_to_igraph(graph, &c_graph); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } - IGRAPH_R_CHECK(igraph_vector_init(&c_knnk, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_knnk); - c_from_mode = (igraph_neimode_t) Rf_asInteger(from_mode); - c_to_mode = (igraph_neimode_t) Rf_asInteger(to_mode); - IGRAPH_R_CHECK_BOOL(directed_neighbors); - c_directed_neighbors = LOGICAL(directed_neighbors)[0]; + Rz_SEXP_to_igraph_copy(graph, &c_graph); + IGRAPH_FINALLY(igraph_destroy, &c_graph); + Rz_SEXP_to_vector_int_copy(mapping, &c_mapping); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_mapping); + Rz_SEXP_to_attr_comb(vertex_attr_comb, &c_vertex_attr_comb); + IGRAPH_FINALLY(igraph_attribute_combination_destroy, &c_vertex_attr_comb); /* Call igraph */ - IGRAPH_R_CHECK(igraph_degree_correlation_vector(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_knnk, c_from_mode, c_to_mode, c_directed_neighbors)); + IGRAPH_R_CHECK(igraph_contract_vertices(&c_graph, &c_mapping, &c_vertex_attr_comb)); /* Convert output */ - PROTECT(knnk=Ry_igraph_vector_to_SEXP(&c_knnk)); - igraph_vector_destroy(&c_knnk); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); IGRAPH_FINALLY_CLEAN(1); - r_result = knnk; + igraph_vector_int_destroy(&c_mapping); + IGRAPH_FINALLY_CLEAN(1); + igraph_attribute_combination_destroy(&c_vertex_attr_comb); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_rich_club_sequence / +/ igraph_eccentricity / /-------------------------------------------*/ -SEXP R_igraph_rich_club_sequence(SEXP graph, SEXP weights, SEXP vertex_order, SEXP normalized, SEXP loops, SEXP directed) { +SEXP R_igraph_eccentricity(SEXP graph, SEXP vids, SEXP mode) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_weights; igraph_vector_t c_res; - igraph_vector_int_t c_vertex_order; - igraph_bool_t c_normalized; - igraph_bool_t c_loops; - igraph_bool_t c_directed; + igraph_vs_t c_vids; + igraph_neimode_t c_mode; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); IGRAPH_FINALLY(igraph_vector_destroy, &c_res); - Rz_SEXP_to_vector_int_copy(vertex_order, &c_vertex_order); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vertex_order); - IGRAPH_R_CHECK_BOOL(normalized); - c_normalized = LOGICAL(normalized)[0]; - IGRAPH_R_CHECK_BOOL(loops); - c_loops = LOGICAL(loops)[0]; - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); /* Call igraph */ - IGRAPH_R_CHECK(igraph_rich_club_sequence(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_res, &c_vertex_order, c_normalized, c_loops, c_directed)); + IGRAPH_R_CHECK(igraph_eccentricity(&c_graph, &c_res, c_vids, c_mode)); /* Convert output */ PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); igraph_vector_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_vertex_order); - IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); r_result = res; UNPROTECT(1); @@ -4893,33 +7976,30 @@ SEXP R_igraph_rich_club_sequence(SEXP graph, SEXP weights, SEXP vertex_order, SE } /*-------------------------------------------/ -/ igraph_strength / +/ igraph_eccentricity_dijkstra / /-------------------------------------------*/ -SEXP R_igraph_strength(SEXP graph, SEXP vids, SEXP mode, SEXP loops, SEXP weights) { +SEXP R_igraph_eccentricity_dijkstra(SEXP graph, SEXP weights, SEXP vids, SEXP mode) { /* Declarations */ igraph_t c_graph; + igraph_vector_t c_weights; igraph_vector_t c_res; igraph_vs_t c_vids; igraph_neimode_t c_mode; - igraph_bool_t c_loops; - igraph_vector_t c_weights; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); IGRAPH_FINALLY(igraph_vector_destroy, &c_res); igraph_vector_int_t c_vids_data; Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); c_mode = (igraph_neimode_t) Rf_asInteger(mode); - IGRAPH_R_CHECK_BOOL(loops); - c_loops = LOGICAL(loops)[0]; - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } /* Call igraph */ - IGRAPH_R_CHECK(igraph_strength(&c_graph, &c_res, c_vids, c_mode, c_loops, (Rf_isNull(weights) ? 0 : &c_weights))); + IGRAPH_R_CHECK(igraph_eccentricity_dijkstra(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_res, c_vids, c_mode)); /* Convert output */ PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); @@ -4934,162 +8014,167 @@ SEXP R_igraph_strength(SEXP graph, SEXP vids, SEXP mode, SEXP loops, SEXP weight } /*-------------------------------------------/ -/ igraph_centralization / +/ igraph_graph_center / /-------------------------------------------*/ -SEXP R_igraph_centralization(SEXP scores, SEXP theoretical_max, SEXP normalized) { +SEXP R_igraph_graph_center(SEXP graph, SEXP mode) { /* Declarations */ - igraph_vector_t c_scores; - igraph_real_t c_theoretical_max; - igraph_bool_t c_normalized; - igraph_real_t c_result; + igraph_t c_graph; + igraph_vector_int_t c_res; + igraph_neimode_t c_mode; + SEXP res; + SEXP r_result; /* Convert input */ - Rz_SEXP_to_vector(scores, &c_scores); - IGRAPH_R_CHECK_REAL(theoretical_max); - c_theoretical_max = REAL(theoretical_max)[0]; - IGRAPH_R_CHECK_BOOL(normalized); - c_normalized = LOGICAL(normalized)[0]; + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_res); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); /* Call igraph */ - c_result=igraph_centralization(&c_scores, c_theoretical_max, c_normalized); + IGRAPH_R_CHECK(igraph_graph_center(&c_graph, &c_res, c_mode)); /* Convert output */ - - PROTECT(r_result=NEW_NUMERIC(1)); - REAL(r_result)[0]=c_result; + PROTECT(res=Ry_igraph_vector_int_to_SEXPp1(&c_res)); + igraph_vector_int_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_centralization_degree / +/ igraph_graph_center_dijkstra / /-------------------------------------------*/ -SEXP R_igraph_centralization_degree(SEXP graph, SEXP mode, SEXP loops, SEXP normalized) { +SEXP R_igraph_graph_center_dijkstra(SEXP graph, SEXP weights, SEXP mode) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_res; + igraph_vector_t c_weights; + igraph_vector_int_t c_res; igraph_neimode_t c_mode; - igraph_bool_t c_loops; - igraph_real_t c_centralization; - igraph_real_t c_theoretical_max; - igraph_bool_t c_normalized; SEXP res; - SEXP centralization; - SEXP theoretical_max; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + IGRAPH_R_CHECK(igraph_vector_int_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_res); c_mode = (igraph_neimode_t) Rf_asInteger(mode); - IGRAPH_R_CHECK_BOOL(loops); - c_loops = LOGICAL(loops)[0]; - IGRAPH_R_CHECK_BOOL(normalized); - c_normalized = LOGICAL(normalized)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_centralization_degree(&c_graph, &c_res, c_mode, c_loops, &c_centralization, &c_theoretical_max, c_normalized)); + IGRAPH_R_CHECK(igraph_graph_center_dijkstra(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_res, c_mode)); /* Convert output */ - PROTECT(r_result=NEW_LIST(3)); - PROTECT(r_names=NEW_CHARACTER(3)); - PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); - igraph_vector_destroy(&c_res); + PROTECT(res=Ry_igraph_vector_int_to_SEXPp1(&c_res)); + igraph_vector_int_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); - PROTECT(centralization=NEW_NUMERIC(1)); - REAL(centralization)[0]=c_centralization; - PROTECT(theoretical_max=NEW_NUMERIC(1)); - REAL(theoretical_max)[0]=c_theoretical_max; - SET_VECTOR_ELT(r_result, 0, res); - SET_VECTOR_ELT(r_result, 1, centralization); - SET_VECTOR_ELT(r_result, 2, theoretical_max); - SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("centralization")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("theoretical_max")); - SET_NAMES(r_result, r_names); - UNPROTECT(4); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_radius / +/-------------------------------------------*/ +SEXP R_igraph_radius(SEXP graph, SEXP mode) { + /* Declarations */ + igraph_t c_graph; + igraph_real_t c_radius; + igraph_neimode_t c_mode; + SEXP radius; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_radius(&c_graph, &c_radius, c_mode)); + + /* Convert output */ + PROTECT(radius=NEW_NUMERIC(1)); + REAL(radius)[0]=c_radius; + r_result = radius; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_centralization_degree_tmax / +/ igraph_radius_dijkstra / /-------------------------------------------*/ -SEXP R_igraph_centralization_degree_tmax(SEXP graph, SEXP nodes, SEXP mode, SEXP loops) { +SEXP R_igraph_radius_dijkstra(SEXP graph, SEXP weights, SEXP mode) { /* Declarations */ igraph_t c_graph; - igraph_integer_t c_nodes; + igraph_vector_t c_weights; + igraph_real_t c_radius; igraph_neimode_t c_mode; - igraph_bool_t c_loops; - igraph_real_t c_res; - SEXP res; + SEXP radius; SEXP r_result; /* Convert input */ - if (!Rf_isNull(graph)) { - Rz_SEXP_to_igraph(graph, &c_graph); + Rz_SEXP_to_igraph(graph, &c_graph); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); } - IGRAPH_R_CHECK_INT(nodes); - c_nodes = (igraph_integer_t) REAL(nodes)[0]; c_mode = (igraph_neimode_t) Rf_asInteger(mode); - IGRAPH_R_CHECK_BOOL(loops); - c_loops = LOGICAL(loops)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_centralization_degree_tmax((Rf_isNull(graph) ? 0 : &c_graph), c_nodes, c_mode, c_loops, &c_res)); + IGRAPH_R_CHECK(igraph_radius_dijkstra(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_radius, c_mode)); /* Convert output */ - PROTECT(res=NEW_NUMERIC(1)); - REAL(res)[0]=c_res; - r_result = res; + PROTECT(radius=NEW_NUMERIC(1)); + REAL(radius)[0]=c_radius; + r_result = radius; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_centralization_betweenness / +/ igraph_pseudo_diameter / /-------------------------------------------*/ -SEXP R_igraph_centralization_betweenness(SEXP graph, SEXP directed, SEXP normalized) { +SEXP R_igraph_pseudo_diameter(SEXP graph, SEXP start_vid, SEXP directed, SEXP unconnected) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_res; + igraph_real_t c_diameter; + igraph_integer_t c_start_vid; + igraph_integer_t c_from; + igraph_integer_t c_to; igraph_bool_t c_directed; - igraph_real_t c_centralization; - igraph_real_t c_theoretical_max; - igraph_bool_t c_normalized; - SEXP res; - SEXP centralization; - SEXP theoretical_max; + igraph_bool_t c_unconnected; + SEXP diameter; + SEXP from; + SEXP to; SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + c_start_vid = (igraph_integer_t) REAL(start_vid)[0]; + c_from=0; + c_to=0; IGRAPH_R_CHECK_BOOL(directed); c_directed = LOGICAL(directed)[0]; - IGRAPH_R_CHECK_BOOL(normalized); - c_normalized = LOGICAL(normalized)[0]; + IGRAPH_R_CHECK_BOOL(unconnected); + c_unconnected = LOGICAL(unconnected)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_centralization_betweenness(&c_graph, &c_res, c_directed, &c_centralization, &c_theoretical_max, c_normalized)); + IGRAPH_R_CHECK(igraph_pseudo_diameter(&c_graph, &c_diameter, c_start_vid, &c_from, &c_to, c_directed, c_unconnected)); /* Convert output */ PROTECT(r_result=NEW_LIST(3)); PROTECT(r_names=NEW_CHARACTER(3)); - PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); - igraph_vector_destroy(&c_res); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(centralization=NEW_NUMERIC(1)); - REAL(centralization)[0]=c_centralization; - PROTECT(theoretical_max=NEW_NUMERIC(1)); - REAL(theoretical_max)[0]=c_theoretical_max; - SET_VECTOR_ELT(r_result, 0, res); - SET_VECTOR_ELT(r_result, 1, centralization); - SET_VECTOR_ELT(r_result, 2, theoretical_max); - SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("centralization")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("theoretical_max")); + PROTECT(diameter=NEW_NUMERIC(1)); + REAL(diameter)[0]=c_diameter; + PROTECT(from=NEW_NUMERIC(1)); + REAL(from)[0]=(double) c_from; + PROTECT(to=NEW_NUMERIC(1)); + REAL(to)[0]=(double) c_to; + SET_VECTOR_ELT(r_result, 0, diameter); + SET_VECTOR_ELT(r_result, 1, from); + SET_VECTOR_ELT(r_result, 2, to); + SET_STRING_ELT(r_names, 0, Rf_mkChar("diameter")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("from")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("to")); SET_NAMES(r_result, r_names); UNPROTECT(4); @@ -5098,206 +8183,211 @@ SEXP R_igraph_centralization_betweenness(SEXP graph, SEXP directed, SEXP normali } /*-------------------------------------------/ -/ igraph_centralization_betweenness_tmax / +/ igraph_pseudo_diameter_dijkstra / /-------------------------------------------*/ -SEXP R_igraph_centralization_betweenness_tmax(SEXP graph, SEXP nodes, SEXP directed) { +SEXP R_igraph_pseudo_diameter_dijkstra(SEXP graph, SEXP weights, SEXP start_vid, SEXP directed, SEXP unconnected) { /* Declarations */ igraph_t c_graph; - igraph_integer_t c_nodes; + igraph_vector_t c_weights; + igraph_real_t c_diameter; + igraph_integer_t c_start_vid; + igraph_integer_t c_from; + igraph_integer_t c_to; igraph_bool_t c_directed; - igraph_real_t c_res; - SEXP res; + igraph_bool_t c_unconnected; + SEXP diameter; + SEXP from; + SEXP to; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ - if (!Rf_isNull(graph)) { - Rz_SEXP_to_igraph(graph, &c_graph); + Rz_SEXP_to_igraph(graph, &c_graph); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); } - IGRAPH_R_CHECK_INT(nodes); - c_nodes = (igraph_integer_t) REAL(nodes)[0]; + c_start_vid = (igraph_integer_t) REAL(start_vid)[0]; + c_from=0; + c_to=0; IGRAPH_R_CHECK_BOOL(directed); c_directed = LOGICAL(directed)[0]; + IGRAPH_R_CHECK_BOOL(unconnected); + c_unconnected = LOGICAL(unconnected)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_centralization_betweenness_tmax((Rf_isNull(graph) ? 0 : &c_graph), c_nodes, c_directed, &c_res)); + IGRAPH_R_CHECK(igraph_pseudo_diameter_dijkstra(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_diameter, c_start_vid, &c_from, &c_to, c_directed, c_unconnected)); /* Convert output */ - PROTECT(res=NEW_NUMERIC(1)); - REAL(res)[0]=c_res; - r_result = res; + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(diameter=NEW_NUMERIC(1)); + REAL(diameter)[0]=c_diameter; + PROTECT(from=NEW_NUMERIC(1)); + REAL(from)[0]=(double) c_from; + PROTECT(to=NEW_NUMERIC(1)); + REAL(to)[0]=(double) c_to; + SET_VECTOR_ELT(r_result, 0, diameter); + SET_VECTOR_ELT(r_result, 1, from); + SET_VECTOR_ELT(r_result, 2, to); + SET_STRING_ELT(r_names, 0, Rf_mkChar("diameter")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("from")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("to")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_centralization_closeness / +/ igraph_diversity / /-------------------------------------------*/ -SEXP R_igraph_centralization_closeness(SEXP graph, SEXP mode, SEXP normalized) { +SEXP R_igraph_diversity(SEXP graph, SEXP weights, SEXP vids) { /* Declarations */ igraph_t c_graph; + igraph_vector_t c_weights; igraph_vector_t c_res; - igraph_neimode_t c_mode; - igraph_real_t c_centralization; - igraph_real_t c_theoretical_max; - igraph_bool_t c_normalized; + igraph_vs_t c_vids; SEXP res; - SEXP centralization; - SEXP theoretical_max; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); IGRAPH_FINALLY(igraph_vector_destroy, &c_res); - c_mode = (igraph_neimode_t) Rf_asInteger(mode); - IGRAPH_R_CHECK_BOOL(normalized); - c_normalized = LOGICAL(normalized)[0]; + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); /* Call igraph */ - IGRAPH_R_CHECK(igraph_centralization_closeness(&c_graph, &c_res, c_mode, &c_centralization, &c_theoretical_max, c_normalized)); + IGRAPH_R_CHECK(igraph_diversity(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_res, c_vids)); /* Convert output */ - PROTECT(r_result=NEW_LIST(3)); - PROTECT(r_names=NEW_CHARACTER(3)); PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); igraph_vector_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); - PROTECT(centralization=NEW_NUMERIC(1)); - REAL(centralization)[0]=c_centralization; - PROTECT(theoretical_max=NEW_NUMERIC(1)); - REAL(theoretical_max)[0]=c_theoretical_max; - SET_VECTOR_ELT(r_result, 0, res); - SET_VECTOR_ELT(r_result, 1, centralization); - SET_VECTOR_ELT(r_result, 2, theoretical_max); - SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("centralization")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("theoretical_max")); - SET_NAMES(r_result, r_names); - UNPROTECT(4); + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_centralization_closeness_tmax / +/ igraph_random_walk / /-------------------------------------------*/ -SEXP R_igraph_centralization_closeness_tmax(SEXP graph, SEXP nodes, SEXP mode) { +SEXP R_igraph_random_walk(SEXP graph, SEXP weights, SEXP start, SEXP mode, SEXP steps, SEXP stuck) { /* Declarations */ igraph_t c_graph; - igraph_integer_t c_nodes; + igraph_vector_t c_weights; + igraph_vector_int_t c_vertices; + igraph_vector_int_t c_edges; + igraph_integer_t c_start; igraph_neimode_t c_mode; - igraph_real_t c_res; - SEXP res; + igraph_integer_t c_steps; + igraph_random_walk_stuck_t c_stuck; + SEXP vertices; + SEXP edges; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ - if (!Rf_isNull(graph)) { - Rz_SEXP_to_igraph(graph, &c_graph); + Rz_SEXP_to_igraph(graph, &c_graph); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); } - IGRAPH_R_CHECK_INT(nodes); - c_nodes = (igraph_integer_t) REAL(nodes)[0]; + IGRAPH_R_CHECK(igraph_vector_int_init(&c_vertices, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vertices); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_edges, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edges); + c_start = (igraph_integer_t) REAL(start)[0]; c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK_INT(steps); + c_steps = (igraph_integer_t) REAL(steps)[0]; + c_stuck = (igraph_random_walk_stuck_t) Rf_asInteger(stuck); /* Call igraph */ - IGRAPH_R_CHECK(igraph_centralization_closeness_tmax((Rf_isNull(graph) ? 0 : &c_graph), c_nodes, c_mode, &c_res)); + IGRAPH_R_CHECK(igraph_random_walk(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_vertices, &c_edges, c_start, c_mode, c_steps, c_stuck)); /* Convert output */ - PROTECT(res=NEW_NUMERIC(1)); - REAL(res)[0]=c_res; - r_result = res; + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + PROTECT(vertices=Ry_igraph_vector_int_to_SEXPp1(&c_vertices)); + igraph_vector_int_destroy(&c_vertices); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(edges=Ry_igraph_vector_int_to_SEXPp1(&c_edges)); + igraph_vector_int_destroy(&c_edges); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, vertices); + SET_VECTOR_ELT(r_result, 1, edges); + SET_STRING_ELT(r_names, 0, Rf_mkChar("vertices")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("edges")); + SET_NAMES(r_result, r_names); + UNPROTECT(3); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_centralization_eigenvector_centrality / +/ igraph_random_edge_walk / /-------------------------------------------*/ -SEXP R_igraph_centralization_eigenvector_centrality(SEXP graph, SEXP directed, SEXP scale, SEXP options, SEXP normalized) { - /* Declarations */ - igraph_t c_graph; - igraph_vector_t c_vector; - igraph_real_t c_value; - igraph_bool_t c_directed; - igraph_bool_t c_scale; - igraph_arpack_options_t c_options; - igraph_real_t c_centralization; - igraph_real_t c_theoretical_max; - igraph_bool_t c_normalized; - SEXP vector; - SEXP value; - SEXP centralization; - SEXP theoretical_max; +SEXP R_igraph_random_edge_walk(SEXP graph, SEXP weights, SEXP start, SEXP mode, SEXP steps, SEXP stuck) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_weights; + igraph_vector_int_t c_edgewalk; + igraph_integer_t c_start; + igraph_neimode_t c_mode; + igraph_integer_t c_steps; + igraph_random_walk_stuck_t c_stuck; + SEXP edgewalk; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_init(&c_vector, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_vector); - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; - IGRAPH_R_CHECK_BOOL(scale); - c_scale = LOGICAL(scale)[0]; - Rz_SEXP_to_igraph_arpack_options(options, &c_options); - IGRAPH_R_CHECK_BOOL(normalized); - c_normalized = LOGICAL(normalized)[0]; + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + IGRAPH_R_CHECK(igraph_vector_int_init(&c_edgewalk, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edgewalk); + c_start = (igraph_integer_t) REAL(start)[0]; + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK_INT(steps); + c_steps = (igraph_integer_t) REAL(steps)[0]; + c_stuck = (igraph_random_walk_stuck_t) Rf_asInteger(stuck); /* Call igraph */ - IGRAPH_R_CHECK(igraph_centralization_eigenvector_centrality(&c_graph, &c_vector, &c_value, c_directed, c_scale, &c_options, &c_centralization, &c_theoretical_max, c_normalized)); + IGRAPH_R_CHECK(igraph_random_edge_walk(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_edgewalk, c_start, c_mode, c_steps, c_stuck)); /* Convert output */ - PROTECT(r_result=NEW_LIST(5)); - PROTECT(r_names=NEW_CHARACTER(5)); - PROTECT(vector=Ry_igraph_vector_to_SEXP(&c_vector)); - igraph_vector_destroy(&c_vector); + PROTECT(edgewalk=Ry_igraph_vector_int_to_SEXPp1(&c_edgewalk)); + igraph_vector_int_destroy(&c_edgewalk); IGRAPH_FINALLY_CLEAN(1); - PROTECT(value=NEW_NUMERIC(1)); - REAL(value)[0]=c_value; - PROTECT(options=Ry_igraph_arpack_options_to_SEXP(&c_options)); - PROTECT(centralization=NEW_NUMERIC(1)); - REAL(centralization)[0]=c_centralization; - PROTECT(theoretical_max=NEW_NUMERIC(1)); - REAL(theoretical_max)[0]=c_theoretical_max; - SET_VECTOR_ELT(r_result, 0, vector); - SET_VECTOR_ELT(r_result, 1, value); - SET_VECTOR_ELT(r_result, 2, options); - SET_VECTOR_ELT(r_result, 3, centralization); - SET_VECTOR_ELT(r_result, 4, theoretical_max); - SET_STRING_ELT(r_names, 0, Rf_mkChar("vector")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("value")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("options")); - SET_STRING_ELT(r_names, 3, Rf_mkChar("centralization")); - SET_STRING_ELT(r_names, 4, Rf_mkChar("theoretical_max")); - SET_NAMES(r_result, r_names); - UNPROTECT(6); + r_result = edgewalk; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_centralization_eigenvector_centrality_tmax / +/ igraph_global_efficiency / /-------------------------------------------*/ -SEXP R_igraph_centralization_eigenvector_centrality_tmax(SEXP graph, SEXP nodes, SEXP directed, SEXP scale) { +SEXP R_igraph_global_efficiency(SEXP graph, SEXP weights, SEXP directed) { /* Declarations */ igraph_t c_graph; - igraph_integer_t c_nodes; - igraph_bool_t c_directed; - igraph_bool_t c_scale; igraph_real_t c_res; + igraph_vector_t c_weights; + igraph_bool_t c_directed; SEXP res; SEXP r_result; /* Convert input */ - if (!Rf_isNull(graph)) { - Rz_SEXP_to_igraph(graph, &c_graph); + Rz_SEXP_to_igraph(graph, &c_graph); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); } - IGRAPH_R_CHECK_INT(nodes); - c_nodes = (igraph_integer_t) REAL(nodes)[0]; IGRAPH_R_CHECK_BOOL(directed); c_directed = LOGICAL(directed)[0]; - IGRAPH_R_CHECK_BOOL(scale); - c_scale = LOGICAL(scale)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_centralization_eigenvector_centrality_tmax((Rf_isNull(graph) ? 0 : &c_graph), c_nodes, c_directed, c_scale, &c_res)); + IGRAPH_R_CHECK(igraph_global_efficiency(&c_graph, &c_res, (Rf_isNull(weights) ? 0 : &c_weights), c_directed)); /* Convert output */ PROTECT(res=NEW_NUMERIC(1)); @@ -5309,34 +8399,40 @@ SEXP R_igraph_centralization_eigenvector_centrality_tmax(SEXP graph, SEXP nodes, } /*-------------------------------------------/ -/ igraph_assortativity_nominal / +/ igraph_local_efficiency / /-------------------------------------------*/ -SEXP R_igraph_assortativity_nominal(SEXP graph, SEXP types, SEXP directed, SEXP normalized) { +SEXP R_igraph_local_efficiency(SEXP graph, SEXP vids, SEXP weights, SEXP directed, SEXP mode) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_t c_types; - igraph_real_t c_res; + igraph_vector_t c_res; + igraph_vs_t c_vids; + igraph_vector_t c_weights; igraph_bool_t c_directed; - igraph_bool_t c_normalized; + igraph_neimode_t c_mode; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - Rz_SEXP_to_vector_int_copy(types, &c_types); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_types); + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } IGRAPH_R_CHECK_BOOL(directed); c_directed = LOGICAL(directed)[0]; - IGRAPH_R_CHECK_BOOL(normalized); - c_normalized = LOGICAL(normalized)[0]; + c_mode = (igraph_neimode_t) Rf_asInteger(mode); /* Call igraph */ - IGRAPH_R_CHECK(igraph_assortativity_nominal(&c_graph, &c_types, &c_res, c_directed, c_normalized)); + IGRAPH_R_CHECK(igraph_local_efficiency(&c_graph, &c_res, c_vids, (Rf_isNull(weights) ? 0 : &c_weights), c_directed, c_mode)); /* Convert output */ - igraph_vector_int_destroy(&c_types); + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); - PROTECT(res=NEW_NUMERIC(1)); - REAL(res)[0]=c_res; + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); r_result = res; UNPROTECT(1); @@ -5344,31 +8440,28 @@ SEXP R_igraph_assortativity_nominal(SEXP graph, SEXP types, SEXP directed, SEXP } /*-------------------------------------------/ -/ igraph_assortativity / +/ igraph_average_local_efficiency / /-------------------------------------------*/ -SEXP R_igraph_assortativity(SEXP graph, SEXP values, SEXP values_in, SEXP directed, SEXP normalized) { +SEXP R_igraph_average_local_efficiency(SEXP graph, SEXP weights, SEXP directed, SEXP mode) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_values; - igraph_vector_t c_values_in; igraph_real_t c_res; + igraph_vector_t c_weights; igraph_bool_t c_directed; - igraph_bool_t c_normalized; + igraph_neimode_t c_mode; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - Rz_SEXP_to_vector(values, &c_values); - if (!Rf_isNull(values_in)) { - Rz_SEXP_to_vector(values_in, &c_values_in); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); } IGRAPH_R_CHECK_BOOL(directed); c_directed = LOGICAL(directed)[0]; - IGRAPH_R_CHECK_BOOL(normalized); - c_normalized = LOGICAL(normalized)[0]; + c_mode = (igraph_neimode_t) Rf_asInteger(mode); /* Call igraph */ - IGRAPH_R_CHECK(igraph_assortativity(&c_graph, &c_values, (Rf_isNull(values_in) ? 0 : &c_values_in), &c_res, c_directed, c_normalized)); + IGRAPH_R_CHECK(igraph_average_local_efficiency(&c_graph, &c_res, (Rf_isNull(weights) ? 0 : &c_weights), c_directed, c_mode)); /* Convert output */ PROTECT(res=NEW_NUMERIC(1)); @@ -5380,492 +8473,571 @@ SEXP R_igraph_assortativity(SEXP graph, SEXP values, SEXP values_in, SEXP direct } /*-------------------------------------------/ -/ igraph_assortativity_degree / +/ igraph_transitive_closure_dag / /-------------------------------------------*/ -SEXP R_igraph_assortativity_degree(SEXP graph, SEXP directed) { +SEXP R_igraph_transitive_closure_dag(SEXP graph) { /* Declarations */ igraph_t c_graph; - igraph_real_t c_res; - igraph_bool_t c_directed; - SEXP res; + igraph_t c_closure; + SEXP closure; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_assortativity_degree(&c_graph, &c_res, c_directed)); + IGRAPH_R_CHECK(igraph_transitive_closure_dag(&c_graph, &c_closure)); /* Convert output */ - PROTECT(res=NEW_NUMERIC(1)); - REAL(res)[0]=c_res; - r_result = res; + IGRAPH_FINALLY(igraph_destroy, &c_closure); + PROTECT(closure=Ry_igraph_to_SEXP(&c_closure)); + IGRAPH_I_DESTROY(&c_closure); + IGRAPH_FINALLY_CLEAN(1); + r_result = closure; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_joint_degree_matrix / +/ igraph_transitive_closure / /-------------------------------------------*/ -SEXP R_igraph_joint_degree_matrix(SEXP graph, SEXP weights, SEXP max_out_degree, SEXP max_in_degree) { +SEXP R_igraph_transitive_closure(SEXP graph) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_weights; - igraph_matrix_t c_jdm; - igraph_integer_t c_max_out_degree; - igraph_integer_t c_max_in_degree; - SEXP jdm; + igraph_t c_closure; + SEXP closure; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } - IGRAPH_R_CHECK(igraph_matrix_init(&c_jdm, 0, 0)); - IGRAPH_FINALLY(igraph_matrix_destroy, &c_jdm); - IGRAPH_R_CHECK_INT(max_out_degree); - c_max_out_degree = (igraph_integer_t) REAL(max_out_degree)[0]; - IGRAPH_R_CHECK_INT(max_in_degree); - c_max_in_degree = (igraph_integer_t) REAL(max_in_degree)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_joint_degree_matrix(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_jdm, c_max_out_degree, c_max_in_degree)); + IGRAPH_R_CHECK(igraph_transitive_closure(&c_graph, &c_closure)); /* Convert output */ - PROTECT(jdm=Ry_igraph_matrix_to_SEXP(&c_jdm)); - igraph_matrix_destroy(&c_jdm); + IGRAPH_FINALLY(igraph_destroy, &c_closure); + PROTECT(closure=Ry_igraph_to_SEXP(&c_closure)); + IGRAPH_I_DESTROY(&c_closure); IGRAPH_FINALLY_CLEAN(1); - r_result = jdm; + r_result = closure; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_joint_degree_distribution / +/ igraph_trussness / /-------------------------------------------*/ -SEXP R_igraph_joint_degree_distribution(SEXP graph, SEXP weights, SEXP from_mode, SEXP to_mode, SEXP directed_neighbors, SEXP normalized, SEXP max_from_degree, SEXP max_to_degree) { +SEXP R_igraph_trussness(SEXP graph) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_weights; - igraph_matrix_t c_p; - igraph_neimode_t c_from_mode; - igraph_neimode_t c_to_mode; - igraph_bool_t c_directed_neighbors; - igraph_bool_t c_normalized; - igraph_integer_t c_max_from_degree; - igraph_integer_t c_max_to_degree; - SEXP p; + igraph_vector_int_t c_trussness; + SEXP trussness; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } - IGRAPH_R_CHECK(igraph_matrix_init(&c_p, 0, 0)); - IGRAPH_FINALLY(igraph_matrix_destroy, &c_p); - c_from_mode = (igraph_neimode_t) Rf_asInteger(from_mode); - c_to_mode = (igraph_neimode_t) Rf_asInteger(to_mode); - IGRAPH_R_CHECK_BOOL(directed_neighbors); - c_directed_neighbors = LOGICAL(directed_neighbors)[0]; - IGRAPH_R_CHECK_BOOL(normalized); - c_normalized = LOGICAL(normalized)[0]; - IGRAPH_R_CHECK_INT(max_from_degree); - c_max_from_degree = (igraph_integer_t) REAL(max_from_degree)[0]; - IGRAPH_R_CHECK_INT(max_to_degree); - c_max_to_degree = (igraph_integer_t) REAL(max_to_degree)[0]; + IGRAPH_R_CHECK(igraph_vector_int_init(&c_trussness, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_trussness); /* Call igraph */ - IGRAPH_R_CHECK(igraph_joint_degree_distribution(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_p, c_from_mode, c_to_mode, c_directed_neighbors, c_normalized, c_max_from_degree, c_max_to_degree)); + IGRAPH_R_CHECK(igraph_trussness(&c_graph, &c_trussness)); /* Convert output */ - PROTECT(p=Ry_igraph_matrix_to_SEXP(&c_p)); - igraph_matrix_destroy(&c_p); + PROTECT(trussness=Ry_igraph_vector_int_to_SEXP(&c_trussness)); + igraph_vector_int_destroy(&c_trussness); IGRAPH_FINALLY_CLEAN(1); - r_result = p; + r_result = trussness; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_joint_type_distribution / +/ igraph_is_bigraphical / /-------------------------------------------*/ -SEXP R_igraph_joint_type_distribution(SEXP graph, SEXP weights, SEXP from_types, SEXP to_types, SEXP directed, SEXP normalized) { +SEXP R_igraph_is_bigraphical(SEXP degrees1, SEXP degrees2, SEXP allowed_edge_types) { /* Declarations */ - igraph_t c_graph; - igraph_vector_t c_weights; - igraph_matrix_t c_p; - igraph_vector_int_t c_from_types; - igraph_vector_int_t c_to_types; - igraph_bool_t c_directed; - igraph_bool_t c_normalized; - SEXP p; + igraph_vector_int_t c_degrees1; + igraph_vector_int_t c_degrees2; + igraph_edge_type_sw_t c_allowed_edge_types; + igraph_bool_t c_res; + SEXP res; SEXP r_result; /* Convert input */ - Rz_SEXP_to_igraph(graph, &c_graph); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } - IGRAPH_R_CHECK(igraph_matrix_init(&c_p, 0, 0)); - IGRAPH_FINALLY(igraph_matrix_destroy, &c_p); - Rz_SEXP_to_vector_int_copy(from_types, &c_from_types); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_from_types); - if (!Rf_isNull(to_types)) { - Rz_SEXP_to_vector_int_copy(to_types, &c_to_types); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_to_types); - } else { - IGRAPH_R_CHECK(igraph_vector_int_init(&c_to_types, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_to_types); - } - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; - IGRAPH_R_CHECK_BOOL(normalized); - c_normalized = LOGICAL(normalized)[0]; + IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(degrees1, &c_degrees1)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_degrees1); + IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(degrees2, &c_degrees2)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_degrees2); + c_allowed_edge_types = (igraph_edge_type_sw_t) Rf_asInteger(allowed_edge_types); /* Call igraph */ - IGRAPH_R_CHECK(igraph_joint_type_distribution(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_p, &c_from_types, (Rf_isNull(to_types) ? 0 : &c_to_types), c_directed, c_normalized)); + IGRAPH_R_CHECK(igraph_is_bigraphical(&c_degrees1, &c_degrees2, c_allowed_edge_types, &c_res)); /* Convert output */ - PROTECT(p=Ry_igraph_matrix_to_SEXP(&c_p)); - igraph_matrix_destroy(&c_p); - IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_from_types); + igraph_vector_int_destroy(&c_degrees1); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_to_types); + igraph_vector_int_destroy(&c_degrees2); IGRAPH_FINALLY_CLEAN(1); - r_result = p; + PROTECT(res=NEW_LOGICAL(1)); + LOGICAL(res)[0]=c_res; + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_contract_vertices / +/ igraph_is_graphical / /-------------------------------------------*/ -SEXP R_igraph_contract_vertices(SEXP graph, SEXP mapping, SEXP vertex_attr_comb) { +SEXP R_igraph_is_graphical(SEXP out_deg, SEXP in_deg, SEXP allowed_edge_types) { /* Declarations */ - igraph_t c_graph; - igraph_vector_int_t c_mapping; - igraph_attribute_combination_t c_vertex_attr_comb; + igraph_vector_int_t c_out_deg; + igraph_vector_int_t c_in_deg; + igraph_edge_type_sw_t c_allowed_edge_types; + igraph_bool_t c_res; + SEXP res; SEXP r_result; /* Convert input */ - Rz_SEXP_to_igraph_copy(graph, &c_graph); - IGRAPH_FINALLY(igraph_destroy, &c_graph); - Rz_SEXP_to_vector_int_copy(mapping, &c_mapping); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_mapping); - Rz_SEXP_to_attr_comb(vertex_attr_comb, &c_vertex_attr_comb); - IGRAPH_FINALLY(igraph_attribute_combination_destroy, &c_vertex_attr_comb); + IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(out_deg, &c_out_deg)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_out_deg); + if (!Rf_isNull(in_deg)) { + IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(in_deg, &c_in_deg)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_in_deg); + } else { + IGRAPH_R_CHECK(igraph_vector_int_init(&c_in_deg, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_in_deg); + } + c_allowed_edge_types = (igraph_edge_type_sw_t) Rf_asInteger(allowed_edge_types); /* Call igraph */ - IGRAPH_R_CHECK(igraph_contract_vertices(&c_graph, &c_mapping, &c_vertex_attr_comb)); + IGRAPH_R_CHECK(igraph_is_graphical(&c_out_deg, (Rf_isNull(in_deg) ? 0 : &c_in_deg), c_allowed_edge_types, &c_res)); /* Convert output */ - PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); - IGRAPH_I_DESTROY(&c_graph); - IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_mapping); + igraph_vector_int_destroy(&c_out_deg); IGRAPH_FINALLY_CLEAN(1); - igraph_attribute_combination_destroy(&c_vertex_attr_comb); + igraph_vector_int_destroy(&c_in_deg); IGRAPH_FINALLY_CLEAN(1); - r_result = graph; + PROTECT(res=NEW_LOGICAL(1)); + LOGICAL(res)[0]=c_res; + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_eccentricity_dijkstra / +/ igraph_bfs / /-------------------------------------------*/ -SEXP R_igraph_eccentricity_dijkstra(SEXP graph, SEXP weights, SEXP vids, SEXP mode) { +SEXP R_igraph_bfs(SEXP graph, SEXP root, SEXP roots, SEXP mode, SEXP unreachable, SEXP restricted, SEXP callback) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_weights; - igraph_vector_t c_res; - igraph_vs_t c_vids; + igraph_integer_t c_root; + igraph_vector_int_t c_roots; igraph_neimode_t c_mode; - SEXP res; + igraph_bool_t c_unreachable; + igraph_vector_int_t c_restricted; + igraph_vector_int_t c_order; + igraph_vector_int_t c_rank; + igraph_vector_int_t c_parents; + igraph_vector_int_t c_pred; + igraph_vector_int_t c_succ; + igraph_vector_int_t c_dist; + igraph_bfshandler_t c_callback; - SEXP r_result; + SEXP order; + SEXP rank; + SEXP parents; + SEXP pred; + SEXP succ; + SEXP dist; + + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); + c_root = (igraph_integer_t) REAL(root)[0]; + if (!Rf_isNull(roots)) { + Rz_SEXP_to_vector_int_copy(roots, &c_roots); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_roots); + } else { + IGRAPH_R_CHECK(igraph_vector_int_init(&c_roots, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_roots); } - IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_res); - igraph_vector_int_t c_vids_data; - Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK_BOOL(unreachable); + c_unreachable = LOGICAL(unreachable)[0]; + Rz_SEXP_to_vector_int_copy(restricted, &c_restricted); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_restricted); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_order, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_order); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_rank, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_rank); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_parents, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_parents); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_pred, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_pred); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_succ, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_succ); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_dist, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_dist); /* Call igraph */ - IGRAPH_R_CHECK(igraph_eccentricity_dijkstra(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_res, c_vids, c_mode)); + IGRAPH_R_CHECK(igraph_bfs(&c_graph, c_root, (Rf_isNull(roots) ? 0 : &c_roots), c_mode, c_unreachable, &c_restricted, &c_order, &c_rank, &c_parents, &c_pred, &c_succ, &c_dist, (Rf_isNull(callback) ? 0 : c_callback), 0)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); - igraph_vector_destroy(&c_res); + PROTECT(r_result=NEW_LIST(6)); + PROTECT(r_names=NEW_CHARACTER(6)); + igraph_vector_int_destroy(&c_roots); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_vids_data); - igraph_vs_destroy(&c_vids); - r_result = res; + igraph_vector_int_destroy(&c_restricted); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(order=Ry_igraph_vector_int_to_SEXPp1(&c_order)); + igraph_vector_int_destroy(&c_order); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(rank=Ry_igraph_vector_int_to_SEXP(&c_rank)); + igraph_vector_int_destroy(&c_rank); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(parents=Ry_igraph_vector_int_to_SEXP(&c_parents)); + igraph_vector_int_destroy(&c_parents); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(pred=Ry_igraph_vector_int_to_SEXP(&c_pred)); + igraph_vector_int_destroy(&c_pred); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(succ=Ry_igraph_vector_int_to_SEXP(&c_succ)); + igraph_vector_int_destroy(&c_succ); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(dist=Ry_igraph_vector_int_to_SEXP(&c_dist)); + igraph_vector_int_destroy(&c_dist); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, order); + SET_VECTOR_ELT(r_result, 1, rank); + SET_VECTOR_ELT(r_result, 2, parents); + SET_VECTOR_ELT(r_result, 3, pred); + SET_VECTOR_ELT(r_result, 4, succ); + SET_VECTOR_ELT(r_result, 5, dist); + SET_STRING_ELT(r_names, 0, Rf_mkChar("order")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("rank")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("parents")); + SET_STRING_ELT(r_names, 3, Rf_mkChar("pred")); + SET_STRING_ELT(r_names, 4, Rf_mkChar("succ")); + SET_STRING_ELT(r_names, 5, Rf_mkChar("dist")); + SET_NAMES(r_result, r_names); + UNPROTECT(7); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_graph_center_dijkstra / +/ igraph_bfs_simple / /-------------------------------------------*/ -SEXP R_igraph_graph_center_dijkstra(SEXP graph, SEXP weights, SEXP mode) { +SEXP R_igraph_bfs_simple(SEXP graph, SEXP root, SEXP mode) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_weights; - igraph_vector_int_t c_res; + igraph_integer_t c_root; igraph_neimode_t c_mode; - SEXP res; + igraph_vector_int_t c_order; + igraph_vector_int_t c_layers; + igraph_vector_int_t c_parents; + SEXP order; + SEXP layers; + SEXP parents; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } - IGRAPH_R_CHECK(igraph_vector_int_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_res); + c_root = (igraph_integer_t) REAL(root)[0]; c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_order, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_order); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_layers, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_layers); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_parents, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_parents); /* Call igraph */ - IGRAPH_R_CHECK(igraph_graph_center_dijkstra(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_res, c_mode)); + IGRAPH_R_CHECK(igraph_bfs_simple(&c_graph, c_root, c_mode, &c_order, &c_layers, &c_parents)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_int_to_SEXPp1(&c_res)); - igraph_vector_int_destroy(&c_res); + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(order=Ry_igraph_vector_int_to_SEXPp1(&c_order)); + igraph_vector_int_destroy(&c_order); IGRAPH_FINALLY_CLEAN(1); - r_result = res; + PROTECT(layers=Ry_igraph_vector_int_to_SEXP(&c_layers)); + igraph_vector_int_destroy(&c_layers); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(parents=Ry_igraph_vector_int_to_SEXP(&c_parents)); + igraph_vector_int_destroy(&c_parents); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, order); + SET_VECTOR_ELT(r_result, 1, layers); + SET_VECTOR_ELT(r_result, 2, parents); + SET_STRING_ELT(r_names, 0, Rf_mkChar("order")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("layers")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("parents")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_radius_dijkstra / +/ igraph_dfs / /-------------------------------------------*/ -SEXP R_igraph_radius_dijkstra(SEXP graph, SEXP weights, SEXP mode) { +SEXP R_igraph_dfs(SEXP graph, SEXP root, SEXP mode, SEXP unreachable, SEXP in_callback, SEXP out_callback) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_weights; - igraph_real_t c_radius; + igraph_integer_t c_root; igraph_neimode_t c_mode; - SEXP radius; + igraph_bool_t c_unreachable; + igraph_vector_int_t c_order; + igraph_vector_int_t c_order_out; + igraph_vector_int_t c_father; + igraph_vector_int_t c_dist; + igraph_dfshandler_t c_in_callback; + igraph_dfshandler_t c_out_callback; - SEXP r_result; + SEXP order; + SEXP order_out; + SEXP father; + SEXP dist; + + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } + c_root = (igraph_integer_t) REAL(root)[0]; c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK_BOOL(unreachable); + c_unreachable = LOGICAL(unreachable)[0]; + IGRAPH_R_CHECK(igraph_vector_int_init(&c_order, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_order); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_order_out, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_order_out); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_father, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_father); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_dist, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_dist); /* Call igraph */ - IGRAPH_R_CHECK(igraph_radius_dijkstra(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_radius, c_mode)); + IGRAPH_R_CHECK(igraph_dfs(&c_graph, c_root, c_mode, c_unreachable, &c_order, &c_order_out, &c_father, &c_dist, (Rf_isNull(in_callback) ? 0 : c_in_callback), (Rf_isNull(out_callback) ? 0 : c_out_callback), 0)); /* Convert output */ - PROTECT(radius=NEW_NUMERIC(1)); - REAL(radius)[0]=c_radius; - r_result = radius; + PROTECT(r_result=NEW_LIST(4)); + PROTECT(r_names=NEW_CHARACTER(4)); + PROTECT(order=Ry_igraph_vector_int_to_SEXPp1(&c_order)); + igraph_vector_int_destroy(&c_order); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(order_out=Ry_igraph_vector_int_to_SEXPp1(&c_order_out)); + igraph_vector_int_destroy(&c_order_out); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(father=Ry_igraph_vector_int_to_SEXP(&c_father)); + igraph_vector_int_destroy(&c_father); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(dist=Ry_igraph_vector_int_to_SEXP(&c_dist)); + igraph_vector_int_destroy(&c_dist); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, order); + SET_VECTOR_ELT(r_result, 1, order_out); + SET_VECTOR_ELT(r_result, 2, father); + SET_VECTOR_ELT(r_result, 3, dist); + SET_STRING_ELT(r_names, 0, Rf_mkChar("order")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("order_out")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("father")); + SET_STRING_ELT(r_names, 3, Rf_mkChar("dist")); + SET_NAMES(r_result, r_names); + UNPROTECT(5); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_pseudo_diameter / +/ igraph_bipartite_projection_size / /-------------------------------------------*/ -SEXP R_igraph_pseudo_diameter(SEXP graph, SEXP start_vid, SEXP directed, SEXP unconnected) { +SEXP R_igraph_bipartite_projection_size(SEXP graph, SEXP types) { /* Declarations */ igraph_t c_graph; - igraph_real_t c_diameter; - igraph_integer_t c_start_vid; - igraph_integer_t c_from; - igraph_integer_t c_to; - igraph_bool_t c_directed; - igraph_bool_t c_unconnected; - SEXP diameter; - SEXP from; - SEXP to; + igraph_vector_bool_t c_types; + igraph_integer_t c_vcount1; + igraph_integer_t c_ecount1; + igraph_integer_t c_vcount2; + igraph_integer_t c_ecount2; + SEXP vcount1; + SEXP ecount1; + SEXP vcount2; + SEXP ecount2; SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - c_start_vid = (igraph_integer_t) REAL(start_vid)[0]; - c_from=0; - c_to=0; - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; - IGRAPH_R_CHECK_BOOL(unconnected); - c_unconnected = LOGICAL(unconnected)[0]; + Rz_SEXP_to_vector_bool(types, &c_types); + c_vcount1=0; + c_ecount1=0; + c_vcount2=0; + c_ecount2=0; /* Call igraph */ - IGRAPH_R_CHECK(igraph_pseudo_diameter(&c_graph, &c_diameter, c_start_vid, &c_from, &c_to, c_directed, c_unconnected)); + IGRAPH_R_CHECK(igraph_bipartite_projection_size(&c_graph, &c_types, &c_vcount1, &c_ecount1, &c_vcount2, &c_ecount2)); /* Convert output */ - PROTECT(r_result=NEW_LIST(3)); - PROTECT(r_names=NEW_CHARACTER(3)); - PROTECT(diameter=NEW_NUMERIC(1)); - REAL(diameter)[0]=c_diameter; - PROTECT(from=NEW_NUMERIC(1)); - REAL(from)[0]=(double) c_from; - PROTECT(to=NEW_NUMERIC(1)); - REAL(to)[0]=(double) c_to; - SET_VECTOR_ELT(r_result, 0, diameter); - SET_VECTOR_ELT(r_result, 1, from); - SET_VECTOR_ELT(r_result, 2, to); - SET_STRING_ELT(r_names, 0, Rf_mkChar("diameter")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("from")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("to")); + PROTECT(r_result=NEW_LIST(4)); + PROTECT(r_names=NEW_CHARACTER(4)); + PROTECT(vcount1=NEW_NUMERIC(1)); + REAL(vcount1)[0]=(double) c_vcount1; + PROTECT(ecount1=NEW_NUMERIC(1)); + REAL(ecount1)[0]=(double) c_ecount1; + PROTECT(vcount2=NEW_NUMERIC(1)); + REAL(vcount2)[0]=(double) c_vcount2; + PROTECT(ecount2=NEW_NUMERIC(1)); + REAL(ecount2)[0]=(double) c_ecount2; + SET_VECTOR_ELT(r_result, 0, vcount1); + SET_VECTOR_ELT(r_result, 1, ecount1); + SET_VECTOR_ELT(r_result, 2, vcount2); + SET_VECTOR_ELT(r_result, 3, ecount2); + SET_STRING_ELT(r_names, 0, Rf_mkChar("vcount1")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("ecount1")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("vcount2")); + SET_STRING_ELT(r_names, 3, Rf_mkChar("ecount2")); SET_NAMES(r_result, r_names); - UNPROTECT(4); + UNPROTECT(5); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_pseudo_diameter_dijkstra / +/ igraph_bipartite_projection / /-------------------------------------------*/ -SEXP R_igraph_pseudo_diameter_dijkstra(SEXP graph, SEXP weights, SEXP start_vid, SEXP directed, SEXP unconnected) { +SEXP R_igraph_bipartite_projection(SEXP graph, SEXP types, SEXP probe1) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_weights; - igraph_real_t c_diameter; - igraph_integer_t c_start_vid; - igraph_integer_t c_from; - igraph_integer_t c_to; - igraph_bool_t c_directed; - igraph_bool_t c_unconnected; - SEXP diameter; - SEXP from; - SEXP to; + igraph_vector_bool_t c_types; + igraph_t c_proj1; + igraph_t c_proj2; + igraph_vector_int_t c_multiplicity1; + igraph_vector_int_t c_multiplicity2; + igraph_integer_t c_probe1; + SEXP proj1; + SEXP proj2; + SEXP multiplicity1; + SEXP multiplicity2; SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } - c_start_vid = (igraph_integer_t) REAL(start_vid)[0]; - c_from=0; - c_to=0; - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; - IGRAPH_R_CHECK_BOOL(unconnected); - c_unconnected = LOGICAL(unconnected)[0]; + Rz_SEXP_to_vector_bool(types, &c_types); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_multiplicity1, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_multiplicity1); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_multiplicity2, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_multiplicity2); + IGRAPH_R_CHECK_INT(probe1); + c_probe1 = (igraph_integer_t) REAL(probe1)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_pseudo_diameter_dijkstra(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_diameter, c_start_vid, &c_from, &c_to, c_directed, c_unconnected)); + IGRAPH_R_CHECK(igraph_bipartite_projection(&c_graph, &c_types, &c_proj1, &c_proj2, &c_multiplicity1, &c_multiplicity2, c_probe1)); /* Convert output */ - PROTECT(r_result=NEW_LIST(3)); - PROTECT(r_names=NEW_CHARACTER(3)); - PROTECT(diameter=NEW_NUMERIC(1)); - REAL(diameter)[0]=c_diameter; - PROTECT(from=NEW_NUMERIC(1)); - REAL(from)[0]=(double) c_from; - PROTECT(to=NEW_NUMERIC(1)); - REAL(to)[0]=(double) c_to; - SET_VECTOR_ELT(r_result, 0, diameter); - SET_VECTOR_ELT(r_result, 1, from); - SET_VECTOR_ELT(r_result, 2, to); - SET_STRING_ELT(r_names, 0, Rf_mkChar("diameter")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("from")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("to")); + PROTECT(r_result=NEW_LIST(4)); + PROTECT(r_names=NEW_CHARACTER(4)); + IGRAPH_FINALLY(igraph_destroy, &c_proj1); + PROTECT(proj1=Ry_igraph_to_SEXP(&c_proj1)); + IGRAPH_I_DESTROY(&c_proj1); + IGRAPH_FINALLY_CLEAN(1); + IGRAPH_FINALLY(igraph_destroy, &c_proj2); + PROTECT(proj2=Ry_igraph_to_SEXP(&c_proj2)); + IGRAPH_I_DESTROY(&c_proj2); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(multiplicity1=Ry_igraph_vector_int_to_SEXP(&c_multiplicity1)); + igraph_vector_int_destroy(&c_multiplicity1); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(multiplicity2=Ry_igraph_vector_int_to_SEXP(&c_multiplicity2)); + igraph_vector_int_destroy(&c_multiplicity2); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, proj1); + SET_VECTOR_ELT(r_result, 1, proj2); + SET_VECTOR_ELT(r_result, 2, multiplicity1); + SET_VECTOR_ELT(r_result, 3, multiplicity2); + SET_STRING_ELT(r_names, 0, Rf_mkChar("proj1")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("proj2")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("multiplicity1")); + SET_STRING_ELT(r_names, 3, Rf_mkChar("multiplicity2")); SET_NAMES(r_result, r_names); - UNPROTECT(4); + UNPROTECT(5); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_diversity / +/ igraph_create_bipartite / /-------------------------------------------*/ -SEXP R_igraph_diversity(SEXP graph, SEXP weights, SEXP vids) { +SEXP R_igraph_create_bipartite(SEXP types, SEXP edges, SEXP directed) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_weights; - igraph_vector_t c_res; - igraph_vs_t c_vids; - SEXP res; + igraph_vector_bool_t c_types; + igraph_vector_int_t c_edges; + igraph_bool_t c_directed; + SEXP graph; SEXP r_result; /* Convert input */ - Rz_SEXP_to_igraph(graph, &c_graph); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } - IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_res); - igraph_vector_int_t c_vids_data; - Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + Rz_SEXP_to_vector_bool(types, &c_types); + IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(edges, &c_edges)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edges); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_diversity(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_res, c_vids)); + IGRAPH_R_CHECK(igraph_create_bipartite(&c_graph, &c_types, &c_edges, c_directed)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); - igraph_vector_destroy(&c_res); + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_vids_data); - igraph_vs_destroy(&c_vids); - r_result = res; + igraph_vector_int_destroy(&c_edges); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_random_walk / +/ igraph_biadjacency / /-------------------------------------------*/ -SEXP R_igraph_random_walk(SEXP graph, SEXP weights, SEXP start, SEXP mode, SEXP steps, SEXP stuck) { +SEXP R_igraph_biadjacency(SEXP incidence, SEXP directed, SEXP mode, SEXP multiple) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_weights; - igraph_vector_int_t c_vertices; - igraph_vector_int_t c_edges; - igraph_integer_t c_start; + igraph_vector_bool_t c_types; + igraph_matrix_t c_incidence; + igraph_bool_t c_directed; igraph_neimode_t c_mode; - igraph_integer_t c_steps; - igraph_random_walk_stuck_t c_stuck; - SEXP vertices; - SEXP edges; + igraph_bool_t c_multiple; + SEXP graph; + SEXP types; SEXP r_result, r_names; /* Convert input */ - Rz_SEXP_to_igraph(graph, &c_graph); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } - IGRAPH_R_CHECK(igraph_vector_int_init(&c_vertices, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vertices); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_edges, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edges); - c_start = (igraph_integer_t) REAL(start)[0]; + IGRAPH_R_CHECK(igraph_vector_bool_init(&c_types, 0)); + IGRAPH_FINALLY(igraph_vector_bool_destroy, &c_types); + Rz_SEXP_to_matrix(incidence, &c_incidence); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; c_mode = (igraph_neimode_t) Rf_asInteger(mode); - IGRAPH_R_CHECK_INT(steps); - c_steps = (igraph_integer_t) REAL(steps)[0]; - c_stuck = (igraph_random_walk_stuck_t) Rf_asInteger(stuck); + IGRAPH_R_CHECK_BOOL(multiple); + c_multiple = LOGICAL(multiple)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_random_walk(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_vertices, &c_edges, c_start, c_mode, c_steps, c_stuck)); + IGRAPH_R_CHECK(igraph_biadjacency(&c_graph, &c_types, &c_incidence, c_directed, c_mode, c_multiple)); /* Convert output */ PROTECT(r_result=NEW_LIST(2)); PROTECT(r_names=NEW_CHARACTER(2)); - PROTECT(vertices=Ry_igraph_vector_int_to_SEXPp1(&c_vertices)); - igraph_vector_int_destroy(&c_vertices); + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); IGRAPH_FINALLY_CLEAN(1); - PROTECT(edges=Ry_igraph_vector_int_to_SEXPp1(&c_edges)); - igraph_vector_int_destroy(&c_edges); + PROTECT(types=Ry_igraph_vector_bool_to_SEXP(&c_types)); + igraph_vector_bool_destroy(&c_types); IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, vertices); - SET_VECTOR_ELT(r_result, 1, edges); - SET_STRING_ELT(r_names, 0, Rf_mkChar("vertices")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("edges")); + 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); @@ -5874,275 +9046,369 @@ SEXP R_igraph_random_walk(SEXP graph, SEXP weights, SEXP start, SEXP mode, SEXP } /*-------------------------------------------/ -/ igraph_global_efficiency / +/ igraph_get_biadjacency / /-------------------------------------------*/ -SEXP R_igraph_global_efficiency(SEXP graph, SEXP weights, SEXP directed) { +SEXP R_igraph_get_biadjacency(SEXP graph, SEXP types) { /* Declarations */ igraph_t c_graph; - igraph_real_t c_res; - igraph_vector_t c_weights; - igraph_bool_t c_directed; + igraph_vector_bool_t c_types; + igraph_matrix_t c_res; + igraph_vector_int_t c_row_ids; + igraph_vector_int_t c_col_ids; SEXP res; + SEXP row_ids; + SEXP col_ids; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; + Rz_SEXP_to_vector_bool(types, &c_types); + IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_row_ids, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_row_ids); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_col_ids, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_col_ids); /* Call igraph */ - IGRAPH_R_CHECK(igraph_global_efficiency(&c_graph, &c_res, (Rf_isNull(weights) ? 0 : &c_weights), c_directed)); + IGRAPH_R_CHECK(igraph_get_biadjacency(&c_graph, &c_types, &c_res, &c_row_ids, &c_col_ids)); /* Convert output */ - PROTECT(res=NEW_NUMERIC(1)); - REAL(res)[0]=c_res; - r_result = res; + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); + igraph_matrix_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(row_ids=Ry_igraph_vector_int_to_SEXPp1(&c_row_ids)); + igraph_vector_int_destroy(&c_row_ids); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(col_ids=Ry_igraph_vector_int_to_SEXPp1(&c_col_ids)); + igraph_vector_int_destroy(&c_col_ids); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, res); + SET_VECTOR_ELT(r_result, 1, row_ids); + SET_VECTOR_ELT(r_result, 2, col_ids); + SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("row_ids")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("col_ids")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_local_efficiency / +/ igraph_is_bipartite / /-------------------------------------------*/ -SEXP R_igraph_local_efficiency(SEXP graph, SEXP vids, SEXP weights, SEXP directed, SEXP mode) { +SEXP R_igraph_is_bipartite(SEXP graph) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_res; - igraph_vs_t c_vids; - igraph_vector_t c_weights; - igraph_bool_t c_directed; - igraph_neimode_t c_mode; + igraph_bool_t c_res; + igraph_vector_bool_t c_type; SEXP res; + SEXP type; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_res); - igraph_vector_int_t c_vids_data; - Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; - c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK(igraph_vector_bool_init(&c_type, 0)); + IGRAPH_FINALLY(igraph_vector_bool_destroy, &c_type); /* Call igraph */ - IGRAPH_R_CHECK(igraph_local_efficiency(&c_graph, &c_res, c_vids, (Rf_isNull(weights) ? 0 : &c_weights), c_directed, c_mode)); + IGRAPH_R_CHECK(igraph_is_bipartite(&c_graph, &c_res, &c_type)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); - igraph_vector_destroy(&c_res); + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + PROTECT(res=NEW_LOGICAL(1)); + LOGICAL(res)[0]=c_res; + PROTECT(type=Ry_igraph_vector_bool_to_SEXP(&c_type)); + igraph_vector_bool_destroy(&c_type); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_vids_data); - igraph_vs_destroy(&c_vids); - r_result = res; + SET_VECTOR_ELT(r_result, 0, res); + SET_VECTOR_ELT(r_result, 1, type); + SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("type")); + SET_NAMES(r_result, r_names); + UNPROTECT(3); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_average_local_efficiency / +/ igraph_bipartite_game_gnp / /-------------------------------------------*/ -SEXP R_igraph_average_local_efficiency(SEXP graph, SEXP weights, SEXP directed, SEXP mode) { +SEXP R_igraph_bipartite_game_gnp(SEXP n1, SEXP n2, SEXP p, SEXP directed, SEXP mode) { /* Declarations */ igraph_t c_graph; - igraph_real_t c_res; - igraph_vector_t c_weights; + igraph_vector_bool_t c_types; + igraph_integer_t c_n1; + igraph_integer_t c_n2; + igraph_real_t c_p; igraph_bool_t c_directed; igraph_neimode_t c_mode; - SEXP res; + SEXP graph; + SEXP types; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ - Rz_SEXP_to_igraph(graph, &c_graph); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } + 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); + c_n2 = (igraph_integer_t) REAL(n2)[0]; + IGRAPH_R_CHECK_REAL(p); + c_p = REAL(p)[0]; IGRAPH_R_CHECK_BOOL(directed); c_directed = LOGICAL(directed)[0]; c_mode = (igraph_neimode_t) Rf_asInteger(mode); /* Call igraph */ - IGRAPH_R_CHECK(igraph_average_local_efficiency(&c_graph, &c_res, (Rf_isNull(weights) ? 0 : &c_weights), c_directed, c_mode)); + IGRAPH_R_CHECK(igraph_bipartite_game_gnp(&c_graph, &c_types, c_n1, c_n2, c_p, c_directed, c_mode)); /* Convert output */ - PROTECT(res=NEW_NUMERIC(1)); - REAL(res)[0]=c_res; - r_result = res; + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(types=Ry_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); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_transitive_closure_dag / +/ igraph_bipartite_game_gnm / /-------------------------------------------*/ -SEXP R_igraph_transitive_closure_dag(SEXP graph) { +SEXP R_igraph_bipartite_game_gnm(SEXP n1, SEXP n2, SEXP m, SEXP directed, SEXP mode) { /* Declarations */ igraph_t c_graph; - igraph_t c_closure; - SEXP closure; + igraph_vector_bool_t c_types; + igraph_integer_t c_n1; + igraph_integer_t c_n2; + igraph_integer_t c_m; + igraph_bool_t c_directed; + igraph_neimode_t c_mode; + SEXP graph; + SEXP types; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ - Rz_SEXP_to_igraph(graph, &c_graph); + 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); + c_n2 = (igraph_integer_t) REAL(n2)[0]; + IGRAPH_R_CHECK_INT(m); + c_m = (igraph_integer_t) REAL(m)[0]; + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + c_mode = (igraph_neimode_t) Rf_asInteger(mode); /* Call igraph */ - IGRAPH_R_CHECK(igraph_transitive_closure_dag(&c_graph, &c_closure)); + IGRAPH_R_CHECK(igraph_bipartite_game_gnm(&c_graph, &c_types, c_n1, c_n2, c_m, c_directed, c_mode)); /* Convert output */ - IGRAPH_FINALLY(igraph_destroy, &c_closure); - PROTECT(closure=Ry_igraph_to_SEXP(&c_closure)); - IGRAPH_I_DESTROY(&c_closure); + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); IGRAPH_FINALLY_CLEAN(1); - r_result = closure; + PROTECT(types=Ry_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); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_transitive_closure / +/ igraph_bipartite_game / /-------------------------------------------*/ -SEXP R_igraph_transitive_closure(SEXP graph) { +SEXP R_igraph_bipartite_game(SEXP type, SEXP n1, SEXP n2, SEXP p, SEXP m, SEXP directed, SEXP mode) { /* Declarations */ igraph_t c_graph; - igraph_t c_closure; - SEXP closure; + igraph_vector_bool_t c_types; + igraph_erdos_renyi_t c_type; + igraph_integer_t c_n1; + igraph_integer_t c_n2; + igraph_real_t c_p; + igraph_integer_t c_m; + igraph_bool_t c_directed; + igraph_neimode_t c_mode; + SEXP graph; + SEXP types; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ - Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_bool_init(&c_types, 0)); + IGRAPH_FINALLY(igraph_vector_bool_destroy, &c_types); + c_type = (igraph_erdos_renyi_t) Rf_asInteger(type); + IGRAPH_R_CHECK_INT(n1); + c_n1 = (igraph_integer_t) REAL(n1)[0]; + IGRAPH_R_CHECK_INT(n2); + c_n2 = (igraph_integer_t) REAL(n2)[0]; + IGRAPH_R_CHECK_REAL(p); + c_p = REAL(p)[0]; + IGRAPH_R_CHECK_INT(m); + c_m = (igraph_integer_t) REAL(m)[0]; + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + c_mode = (igraph_neimode_t) Rf_asInteger(mode); /* Call igraph */ - IGRAPH_R_CHECK(igraph_transitive_closure(&c_graph, &c_closure)); + IGRAPH_R_CHECK(igraph_bipartite_game(&c_graph, &c_types, c_type, c_n1, c_n2, c_p, c_m, c_directed, c_mode)); /* Convert output */ - IGRAPH_FINALLY(igraph_destroy, &c_closure); - PROTECT(closure=Ry_igraph_to_SEXP(&c_closure)); - IGRAPH_I_DESTROY(&c_closure); + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); IGRAPH_FINALLY_CLEAN(1); - r_result = closure; + PROTECT(types=Ry_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); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_trussness / +/ igraph_get_laplacian / /-------------------------------------------*/ -SEXP R_igraph_trussness(SEXP graph) { +SEXP R_igraph_get_laplacian(SEXP graph, SEXP mode, SEXP normalization, SEXP weights) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_t c_trussness; - SEXP trussness; + igraph_matrix_t c_res; + igraph_neimode_t c_mode; + igraph_laplacian_normalization_t c_normalization; + igraph_vector_t c_weights; + SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_trussness, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_trussness); + IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + c_normalization = (igraph_laplacian_normalization_t) Rf_asInteger(normalization); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } /* Call igraph */ - IGRAPH_R_CHECK(igraph_trussness(&c_graph, &c_trussness)); + IGRAPH_R_CHECK(igraph_get_laplacian(&c_graph, &c_res, c_mode, c_normalization, (Rf_isNull(weights) ? 0 : &c_weights))); /* Convert output */ - PROTECT(trussness=Ry_igraph_vector_int_to_SEXP(&c_trussness)); - igraph_vector_int_destroy(&c_trussness); + PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); + igraph_matrix_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); - r_result = trussness; + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_is_graphical / +/ igraph_get_laplacian_sparse / /-------------------------------------------*/ -SEXP R_igraph_is_graphical(SEXP out_deg, SEXP in_deg, SEXP allowed_edge_types) { +SEXP R_igraph_get_laplacian_sparse(SEXP graph, SEXP mode, SEXP normalization, SEXP weights) { /* Declarations */ - igraph_vector_int_t c_out_deg; - igraph_vector_int_t c_in_deg; - igraph_edge_type_sw_t c_allowed_edge_types; - igraph_bool_t c_res; - SEXP res; + igraph_t c_graph; + igraph_sparsemat_t c_sparseres; + igraph_neimode_t c_mode; + igraph_laplacian_normalization_t c_normalization; + igraph_vector_t c_weights; + SEXP sparseres; SEXP r_result; /* Convert input */ - IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(out_deg, &c_out_deg)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_out_deg); - if (!Rf_isNull(in_deg)) { - IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(in_deg, &c_in_deg)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_in_deg); - } else { - IGRAPH_R_CHECK(igraph_vector_int_init(&c_in_deg, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_in_deg); + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_sparsemat_init(&c_sparseres, 0, 0, 0)); + IGRAPH_FINALLY(igraph_sparsemat_destroy, &c_sparseres); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + c_normalization = (igraph_laplacian_normalization_t) Rf_asInteger(normalization); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); } - c_allowed_edge_types = (igraph_edge_type_sw_t) Rf_asInteger(allowed_edge_types); /* Call igraph */ - IGRAPH_R_CHECK(igraph_is_graphical(&c_out_deg, (Rf_isNull(in_deg) ? 0 : &c_in_deg), c_allowed_edge_types, &c_res)); + IGRAPH_R_CHECK(igraph_get_laplacian_sparse(&c_graph, &c_sparseres, c_mode, c_normalization, (Rf_isNull(weights) ? 0 : &c_weights))); /* Convert output */ - igraph_vector_int_destroy(&c_out_deg); - IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_in_deg); + PROTECT(sparseres=Ry_igraph_sparsemat_to_SEXP(&c_sparseres)); + igraph_sparsemat_destroy(&c_sparseres); IGRAPH_FINALLY_CLEAN(1); - PROTECT(res=NEW_LOGICAL(1)); - LOGICAL(res)[0]=c_res; - r_result = res; + r_result = sparseres; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_bfs_simple / +/ igraph_connected_components / /-------------------------------------------*/ -SEXP R_igraph_bfs_simple(SEXP graph, SEXP root, SEXP mode) { +SEXP R_igraph_connected_components(SEXP graph, SEXP mode) { /* Declarations */ igraph_t c_graph; - igraph_integer_t c_root; - igraph_neimode_t c_mode; - igraph_vector_int_t c_order; - igraph_vector_int_t c_layers; - igraph_vector_int_t c_parents; - SEXP order; - SEXP layers; - SEXP parents; + igraph_vector_int_t c_membership; + igraph_vector_int_t c_csize; + igraph_integer_t c_no; + igraph_connectedness_t c_mode; + SEXP membership; + SEXP csize; + SEXP no; SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - c_root = (igraph_integer_t) REAL(root)[0]; - c_mode = (igraph_neimode_t) Rf_asInteger(mode); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_order, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_order); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_layers, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_layers); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_parents, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_parents); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_membership, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_membership); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_csize, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_csize); + c_no=0; + c_mode = (igraph_connectedness_t) Rf_asInteger(mode); /* Call igraph */ - IGRAPH_R_CHECK(igraph_bfs_simple(&c_graph, c_root, c_mode, &c_order, &c_layers, &c_parents)); + IGRAPH_R_CHECK(igraph_connected_components(&c_graph, &c_membership, &c_csize, &c_no, c_mode)); /* Convert output */ PROTECT(r_result=NEW_LIST(3)); PROTECT(r_names=NEW_CHARACTER(3)); - PROTECT(order=Ry_igraph_vector_int_to_SEXPp1(&c_order)); - igraph_vector_int_destroy(&c_order); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(layers=Ry_igraph_vector_int_to_SEXP(&c_layers)); - igraph_vector_int_destroy(&c_layers); + PROTECT(membership=Ry_igraph_vector_int_to_SEXP(&c_membership)); + igraph_vector_int_destroy(&c_membership); IGRAPH_FINALLY_CLEAN(1); - PROTECT(parents=Ry_igraph_vector_int_to_SEXP(&c_parents)); - igraph_vector_int_destroy(&c_parents); + PROTECT(csize=Ry_igraph_vector_int_to_SEXP(&c_csize)); + igraph_vector_int_destroy(&c_csize); IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, order); - SET_VECTOR_ELT(r_result, 1, layers); - SET_VECTOR_ELT(r_result, 2, parents); - SET_STRING_ELT(r_names, 0, Rf_mkChar("order")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("layers")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("parents")); + PROTECT(no=NEW_NUMERIC(1)); + REAL(no)[0]=(double) c_no; + SET_VECTOR_ELT(r_result, 0, membership); + SET_VECTOR_ELT(r_result, 1, csize); + SET_VECTOR_ELT(r_result, 2, no); + SET_STRING_ELT(r_names, 0, Rf_mkChar("membership")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("csize")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("no")); SET_NAMES(r_result, r_names); UNPROTECT(4); @@ -6151,275 +9417,283 @@ SEXP R_igraph_bfs_simple(SEXP graph, SEXP root, SEXP mode) { } /*-------------------------------------------/ -/ igraph_bipartite_projection_size / +/ igraph_is_connected / +/-------------------------------------------*/ +SEXP R_igraph_is_connected(SEXP graph, SEXP mode) { + /* Declarations */ + igraph_t c_graph; + igraph_bool_t c_res; + igraph_connectedness_t c_mode; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + c_mode = (igraph_connectedness_t) Rf_asInteger(mode); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_is_connected(&c_graph, &c_res, c_mode)); + + /* Convert output */ + PROTECT(res=NEW_LOGICAL(1)); + LOGICAL(res)[0]=c_res; + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_decompose / /-------------------------------------------*/ -SEXP R_igraph_bipartite_projection_size(SEXP graph, SEXP types) { +SEXP R_igraph_decompose(SEXP graph, SEXP mode, SEXP maxcompno, SEXP minelements) { /* Declarations */ igraph_t c_graph; - igraph_vector_bool_t c_types; - igraph_integer_t c_vcount1; - igraph_integer_t c_ecount1; - igraph_integer_t c_vcount2; - igraph_integer_t c_ecount2; - SEXP vcount1; - SEXP ecount1; - SEXP vcount2; - SEXP ecount2; + igraph_graph_list_t c_components; + igraph_connectedness_t c_mode; + igraph_integer_t c_maxcompno; + igraph_integer_t c_minelements; + SEXP components; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - Rz_SEXP_to_vector_bool(types, &c_types); - c_vcount1=0; - c_ecount1=0; - c_vcount2=0; - c_ecount2=0; + IGRAPH_R_CHECK(igraph_graph_list_init(&c_components, 0)); + IGRAPH_FINALLY(igraph_graph_list_destroy, &c_components); + c_mode = (igraph_connectedness_t) Rf_asInteger(mode); + IGRAPH_R_CHECK_INT(maxcompno); + c_maxcompno = (igraph_integer_t) REAL(maxcompno)[0]; + IGRAPH_R_CHECK_INT(minelements); + c_minelements = (igraph_integer_t) REAL(minelements)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_bipartite_projection_size(&c_graph, &c_types, &c_vcount1, &c_ecount1, &c_vcount2, &c_ecount2)); + IGRAPH_R_CHECK(igraph_decompose(&c_graph, &c_components, c_mode, c_maxcompno, c_minelements)); /* Convert output */ - PROTECT(r_result=NEW_LIST(4)); - PROTECT(r_names=NEW_CHARACTER(4)); - PROTECT(vcount1=NEW_NUMERIC(1)); - REAL(vcount1)[0]=(double) c_vcount1; - PROTECT(ecount1=NEW_NUMERIC(1)); - REAL(ecount1)[0]=(double) c_ecount1; - PROTECT(vcount2=NEW_NUMERIC(1)); - REAL(vcount2)[0]=(double) c_vcount2; - PROTECT(ecount2=NEW_NUMERIC(1)); - REAL(ecount2)[0]=(double) c_ecount2; - SET_VECTOR_ELT(r_result, 0, vcount1); - SET_VECTOR_ELT(r_result, 1, ecount1); - SET_VECTOR_ELT(r_result, 2, vcount2); - SET_VECTOR_ELT(r_result, 3, ecount2); - SET_STRING_ELT(r_names, 0, Rf_mkChar("vcount1")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("ecount1")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("vcount2")); - SET_STRING_ELT(r_names, 3, Rf_mkChar("ecount2")); - SET_NAMES(r_result, r_names); - UNPROTECT(5); + PROTECT(components=Ry_igraph_graphlist_to_SEXP(&c_components)); + IGRAPH_FREE(c_components.stor_begin); + IGRAPH_FINALLY_CLEAN(1); + r_result = components; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_create_bipartite / +/ igraph_articulation_points / /-------------------------------------------*/ -SEXP R_igraph_create_bipartite(SEXP types, SEXP edges, SEXP directed) { +SEXP R_igraph_articulation_points(SEXP graph) { /* Declarations */ igraph_t c_graph; - igraph_vector_bool_t c_types; - igraph_vector_int_t c_edges; - igraph_bool_t c_directed; - SEXP graph; + igraph_vector_int_t c_res; + SEXP res; SEXP r_result; /* Convert input */ - Rz_SEXP_to_vector_bool(types, &c_types); - IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(edges, &c_edges)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edges); - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_res); /* Call igraph */ - IGRAPH_R_CHECK(igraph_create_bipartite(&c_graph, &c_types, &c_edges, c_directed)); + IGRAPH_R_CHECK(igraph_articulation_points(&c_graph, &c_res)); /* Convert output */ - IGRAPH_FINALLY(igraph_destroy, &c_graph); - PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); - IGRAPH_I_DESTROY(&c_graph); - IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_edges); + PROTECT(res=Ry_igraph_vector_int_to_SEXPp1(&c_res)); + igraph_vector_int_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); - r_result = graph; + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_biadjacency / +/ igraph_biconnected_components / /-------------------------------------------*/ -SEXP R_igraph_biadjacency(SEXP incidence, SEXP directed, SEXP mode, SEXP multiple) { +SEXP R_igraph_biconnected_components(SEXP graph) { /* Declarations */ igraph_t c_graph; - igraph_vector_bool_t c_types; - igraph_matrix_t c_incidence; - igraph_bool_t c_directed; - igraph_neimode_t c_mode; - igraph_bool_t c_multiple; - SEXP graph; - SEXP types; + igraph_integer_t c_no; + igraph_vector_int_list_t c_tree_edges; + igraph_vector_int_list_t c_component_edges; + igraph_vector_int_list_t c_components; + igraph_vector_int_t c_articulation_points; + SEXP no; + SEXP tree_edges; + SEXP component_edges; + SEXP components; + SEXP articulation_points; SEXP r_result, r_names; /* Convert input */ - IGRAPH_R_CHECK(igraph_vector_bool_init(&c_types, 0)); - IGRAPH_FINALLY(igraph_vector_bool_destroy, &c_types); - Rz_SEXP_to_matrix(incidence, &c_incidence); - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; - c_mode = (igraph_neimode_t) Rf_asInteger(mode); - IGRAPH_R_CHECK_BOOL(multiple); - c_multiple = LOGICAL(multiple)[0]; + Rz_SEXP_to_igraph(graph, &c_graph); + c_no=0; + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_tree_edges, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_tree_edges); + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_component_edges, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_component_edges); + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_components, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_components); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_articulation_points, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_articulation_points); /* Call igraph */ - IGRAPH_R_CHECK(igraph_biadjacency(&c_graph, &c_types, &c_incidence, c_directed, c_mode, c_multiple)); + IGRAPH_R_CHECK(igraph_biconnected_components(&c_graph, &c_no, &c_tree_edges, &c_component_edges, &c_components, &c_articulation_points)); /* Convert output */ - PROTECT(r_result=NEW_LIST(2)); - PROTECT(r_names=NEW_CHARACTER(2)); - IGRAPH_FINALLY(igraph_destroy, &c_graph); - PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); - IGRAPH_I_DESTROY(&c_graph); + PROTECT(r_result=NEW_LIST(5)); + PROTECT(r_names=NEW_CHARACTER(5)); + PROTECT(no=NEW_NUMERIC(1)); + REAL(no)[0]=(double) c_no; + PROTECT(tree_edges=Ry_igraph_vector_int_list_to_SEXPp1(&c_tree_edges)); + igraph_vector_int_list_destroy(&c_tree_edges); IGRAPH_FINALLY_CLEAN(1); - PROTECT(types=Ry_igraph_vector_bool_to_SEXP(&c_types)); - igraph_vector_bool_destroy(&c_types); + PROTECT(component_edges=Ry_igraph_vector_int_list_to_SEXPp1(&c_component_edges)); + igraph_vector_int_list_destroy(&c_component_edges); 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")); + PROTECT(components=Ry_igraph_vector_int_list_to_SEXPp1(&c_components)); + igraph_vector_int_list_destroy(&c_components); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(articulation_points=Ry_igraph_vector_int_to_SEXPp1(&c_articulation_points)); + igraph_vector_int_destroy(&c_articulation_points); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, no); + SET_VECTOR_ELT(r_result, 1, tree_edges); + SET_VECTOR_ELT(r_result, 2, component_edges); + SET_VECTOR_ELT(r_result, 3, components); + SET_VECTOR_ELT(r_result, 4, articulation_points); + SET_STRING_ELT(r_names, 0, Rf_mkChar("no")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("tree_edges")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("component_edges")); + SET_STRING_ELT(r_names, 3, Rf_mkChar("components")); + SET_STRING_ELT(r_names, 4, Rf_mkChar("articulation_points")); SET_NAMES(r_result, r_names); - UNPROTECT(3); + UNPROTECT(6); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_get_biadjacency / +/ igraph_bridges / /-------------------------------------------*/ -SEXP R_igraph_get_biadjacency(SEXP graph, SEXP types) { +SEXP R_igraph_bridges(SEXP graph) { /* Declarations */ igraph_t c_graph; - igraph_vector_bool_t c_types; - igraph_matrix_t c_res; - igraph_vector_int_t c_row_ids; - igraph_vector_int_t c_col_ids; + igraph_vector_int_t c_res; SEXP res; - SEXP row_ids; - SEXP col_ids; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - Rz_SEXP_to_vector_bool(types, &c_types); - IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); - IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_row_ids, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_row_ids); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_col_ids, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_col_ids); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_res); /* Call igraph */ - IGRAPH_R_CHECK(igraph_get_biadjacency(&c_graph, &c_types, &c_res, &c_row_ids, &c_col_ids)); + IGRAPH_R_CHECK(igraph_bridges(&c_graph, &c_res)); /* Convert output */ - PROTECT(r_result=NEW_LIST(3)); - PROTECT(r_names=NEW_CHARACTER(3)); - PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); - igraph_matrix_destroy(&c_res); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(row_ids=Ry_igraph_vector_int_to_SEXPp1(&c_row_ids)); - igraph_vector_int_destroy(&c_row_ids); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(col_ids=Ry_igraph_vector_int_to_SEXPp1(&c_col_ids)); - igraph_vector_int_destroy(&c_col_ids); + PROTECT(res=Ry_igraph_vector_int_to_SEXPp1(&c_res)); + igraph_vector_int_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, res); - SET_VECTOR_ELT(r_result, 1, row_ids); - SET_VECTOR_ELT(r_result, 2, col_ids); - SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("row_ids")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("col_ids")); - SET_NAMES(r_result, r_names); - UNPROTECT(4); + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_is_bipartite / +/ igraph_is_biconnected / /-------------------------------------------*/ -SEXP R_igraph_is_bipartite(SEXP graph) { +SEXP R_igraph_is_biconnected(SEXP graph) { /* Declarations */ igraph_t c_graph; igraph_bool_t c_res; - igraph_vector_bool_t c_type; SEXP res; - SEXP type; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_bool_init(&c_type, 0)); - IGRAPH_FINALLY(igraph_vector_bool_destroy, &c_type); /* Call igraph */ - IGRAPH_R_CHECK(igraph_is_bipartite(&c_graph, &c_res, &c_type)); + IGRAPH_R_CHECK(igraph_is_biconnected(&c_graph, &c_res)); /* Convert output */ - PROTECT(r_result=NEW_LIST(2)); - PROTECT(r_names=NEW_CHARACTER(2)); PROTECT(res=NEW_LOGICAL(1)); LOGICAL(res)[0]=c_res; - PROTECT(type=Ry_igraph_vector_bool_to_SEXP(&c_type)); - igraph_vector_bool_destroy(&c_type); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_count_reachable / +/-------------------------------------------*/ +SEXP R_igraph_count_reachable(SEXP graph, SEXP mode) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_int_t c_counts; + igraph_neimode_t c_mode; + SEXP counts; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_counts, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_counts); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_count_reachable(&c_graph, &c_counts, c_mode)); + + /* Convert output */ + PROTECT(counts=Ry_igraph_vector_int_to_SEXP(&c_counts)); + igraph_vector_int_destroy(&c_counts); IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, res); - SET_VECTOR_ELT(r_result, 1, type); - SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("type")); - SET_NAMES(r_result, r_names); - UNPROTECT(3); + r_result = counts; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_bipartite_game_gnp / +/ igraph_bond_percolation / /-------------------------------------------*/ -SEXP R_igraph_bipartite_game_gnp(SEXP n1, SEXP n2, SEXP p, SEXP directed, SEXP mode) { +SEXP R_igraph_bond_percolation(SEXP graph, SEXP edge_order) { /* Declarations */ igraph_t c_graph; - igraph_vector_bool_t c_types; - igraph_integer_t c_n1; - igraph_integer_t c_n2; - igraph_real_t c_p; - igraph_bool_t c_directed; - igraph_neimode_t c_mode; - SEXP graph; - SEXP types; + igraph_vector_int_t c_giant_size; + igraph_vector_int_t c_vetex_count; + igraph_vector_int_t c_edge_order; + SEXP giant_size; + SEXP vetex_count; SEXP r_result, r_names; /* 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); - c_n2 = (igraph_integer_t) REAL(n2)[0]; - IGRAPH_R_CHECK_REAL(p); - c_p = REAL(p)[0]; - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; - c_mode = (igraph_neimode_t) Rf_asInteger(mode); + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_giant_size, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_giant_size); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_vetex_count, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vetex_count); + if (!Rf_isNull(edge_order)) { + Rz_SEXP_to_vector_int_copy(edge_order, &c_edge_order); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edge_order); + } else { + IGRAPH_R_CHECK(igraph_vector_int_init(&c_edge_order, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edge_order); + } /* Call igraph */ - IGRAPH_R_CHECK(igraph_bipartite_game_gnp(&c_graph, &c_types, c_n1, c_n2, c_p, c_directed, c_mode)); + IGRAPH_R_CHECK(igraph_bond_percolation(&c_graph, &c_giant_size, &c_vetex_count, (Rf_isNull(edge_order) ? 0 : &c_edge_order))); /* Convert output */ PROTECT(r_result=NEW_LIST(2)); PROTECT(r_names=NEW_CHARACTER(2)); - IGRAPH_FINALLY(igraph_destroy, &c_graph); - PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); - IGRAPH_I_DESTROY(&c_graph); + PROTECT(giant_size=Ry_igraph_vector_int_to_SEXP(&c_giant_size)); + igraph_vector_int_destroy(&c_giant_size); IGRAPH_FINALLY_CLEAN(1); - PROTECT(types=Ry_igraph_vector_bool_to_SEXP(&c_types)); - igraph_vector_bool_destroy(&c_types); + PROTECT(vetex_count=Ry_igraph_vector_int_to_SEXP(&c_vetex_count)); + igraph_vector_int_destroy(&c_vetex_count); 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")); + igraph_vector_int_destroy(&c_edge_order); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, giant_size); + SET_VECTOR_ELT(r_result, 1, vetex_count); + SET_STRING_ELT(r_names, 0, Rf_mkChar("giant_size")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("vetex_count")); SET_NAMES(r_result, r_names); UNPROTECT(3); @@ -6428,50 +9702,49 @@ SEXP R_igraph_bipartite_game_gnp(SEXP n1, SEXP n2, SEXP p, SEXP directed, SEXP m } /*-------------------------------------------/ -/ igraph_bipartite_game_gnm / +/ igraph_site_percolation / /-------------------------------------------*/ -SEXP R_igraph_bipartite_game_gnm(SEXP n1, SEXP n2, SEXP m, SEXP directed, SEXP mode) { +SEXP R_igraph_site_percolation(SEXP graph, SEXP vertex_order) { /* Declarations */ igraph_t c_graph; - igraph_vector_bool_t c_types; - igraph_integer_t c_n1; - igraph_integer_t c_n2; - igraph_integer_t c_m; - igraph_bool_t c_directed; - igraph_neimode_t c_mode; - SEXP graph; - SEXP types; + igraph_vector_int_t c_giant_size; + igraph_vector_int_t c_edge_count; + igraph_vector_int_t c_vertex_order; + SEXP giant_size; + SEXP edge_count; SEXP r_result, r_names; /* 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); - c_n2 = (igraph_integer_t) REAL(n2)[0]; - IGRAPH_R_CHECK_INT(m); - c_m = (igraph_integer_t) REAL(m)[0]; - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; - c_mode = (igraph_neimode_t) Rf_asInteger(mode); + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_giant_size, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_giant_size); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_edge_count, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edge_count); + if (!Rf_isNull(vertex_order)) { + Rz_SEXP_to_vector_int_copy(vertex_order, &c_vertex_order); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vertex_order); + } else { + IGRAPH_R_CHECK(igraph_vector_int_init(&c_vertex_order, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vertex_order); + } /* Call igraph */ - IGRAPH_R_CHECK(igraph_bipartite_game_gnm(&c_graph, &c_types, c_n1, c_n2, c_m, c_directed, c_mode)); + IGRAPH_R_CHECK(igraph_site_percolation(&c_graph, &c_giant_size, &c_edge_count, (Rf_isNull(vertex_order) ? 0 : &c_vertex_order))); /* Convert output */ PROTECT(r_result=NEW_LIST(2)); PROTECT(r_names=NEW_CHARACTER(2)); - IGRAPH_FINALLY(igraph_destroy, &c_graph); - PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); - IGRAPH_I_DESTROY(&c_graph); + PROTECT(giant_size=Ry_igraph_vector_int_to_SEXP(&c_giant_size)); + igraph_vector_int_destroy(&c_giant_size); IGRAPH_FINALLY_CLEAN(1); - PROTECT(types=Ry_igraph_vector_bool_to_SEXP(&c_types)); - igraph_vector_bool_destroy(&c_types); + PROTECT(edge_count=Ry_igraph_vector_int_to_SEXP(&c_edge_count)); + igraph_vector_int_destroy(&c_edge_count); 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")); + igraph_vector_int_destroy(&c_vertex_order); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, giant_size); + SET_VECTOR_ELT(r_result, 1, edge_count); + SET_STRING_ELT(r_names, 0, Rf_mkChar("giant_size")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("edge_count")); SET_NAMES(r_result, r_names); UNPROTECT(3); @@ -6480,171 +9753,167 @@ SEXP R_igraph_bipartite_game_gnm(SEXP n1, SEXP n2, SEXP m, SEXP directed, SEXP m } /*-------------------------------------------/ -/ igraph_get_laplacian / +/ igraph_edgelist_percolation / /-------------------------------------------*/ -SEXP R_igraph_get_laplacian(SEXP graph, SEXP mode, SEXP normalization, SEXP weights) { +SEXP R_igraph_edgelist_percolation(SEXP edges) { /* Declarations */ - igraph_t c_graph; - igraph_matrix_t c_res; - igraph_neimode_t c_mode; - igraph_laplacian_normalization_t c_normalization; - igraph_vector_t c_weights; - SEXP res; + igraph_vector_int_t c_edges; + igraph_vector_int_t c_giant_size; + igraph_vector_int_t c_vertex_count; + SEXP giant_size; + SEXP vertex_count; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ - Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); - IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); - c_mode = (igraph_neimode_t) Rf_asInteger(mode); - c_normalization = (igraph_laplacian_normalization_t) Rf_asInteger(normalization); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } + Rz_SEXP_to_vector_int_copy(edges, &c_edges); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edges); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_giant_size, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_giant_size); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_vertex_count, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vertex_count); /* Call igraph */ - IGRAPH_R_CHECK(igraph_get_laplacian(&c_graph, &c_res, c_mode, c_normalization, (Rf_isNull(weights) ? 0 : &c_weights))); + IGRAPH_R_CHECK(igraph_edgelist_percolation(&c_edges, &c_giant_size, &c_vertex_count)); /* Convert output */ - PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); - igraph_matrix_destroy(&c_res); + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + igraph_vector_int_destroy(&c_edges); IGRAPH_FINALLY_CLEAN(1); - r_result = res; + PROTECT(giant_size=Ry_igraph_vector_int_to_SEXP(&c_giant_size)); + igraph_vector_int_destroy(&c_giant_size); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(vertex_count=Ry_igraph_vector_int_to_SEXP(&c_vertex_count)); + igraph_vector_int_destroy(&c_vertex_count); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, giant_size); + SET_VECTOR_ELT(r_result, 1, vertex_count); + SET_STRING_ELT(r_names, 0, Rf_mkChar("giant_size")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("vertex_count")); + SET_NAMES(r_result, r_names); + UNPROTECT(3); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_get_laplacian_sparse / +/ igraph_is_clique / /-------------------------------------------*/ -SEXP R_igraph_get_laplacian_sparse(SEXP graph, SEXP mode, SEXP normalization, SEXP weights) { +SEXP R_igraph_is_clique(SEXP graph, SEXP candidate, SEXP directed) { /* Declarations */ igraph_t c_graph; - igraph_sparsemat_t c_sparseres; - igraph_neimode_t c_mode; - igraph_laplacian_normalization_t c_normalization; - igraph_vector_t c_weights; - SEXP sparseres; + igraph_vs_t c_candidate; + igraph_bool_t c_directed; + igraph_bool_t c_res; + SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_sparsemat_init(&c_sparseres, 0, 0, 0)); - IGRAPH_FINALLY(igraph_sparsemat_destroy, &c_sparseres); - c_mode = (igraph_neimode_t) Rf_asInteger(mode); - c_normalization = (igraph_laplacian_normalization_t) Rf_asInteger(normalization); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } + igraph_vector_int_t c_candidate_data; + Rz_SEXP_to_igraph_vs(candidate, &c_graph, &c_candidate, &c_candidate_data); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_get_laplacian_sparse(&c_graph, &c_sparseres, c_mode, c_normalization, (Rf_isNull(weights) ? 0 : &c_weights))); + IGRAPH_R_CHECK(igraph_is_clique(&c_graph, c_candidate, c_directed, &c_res)); /* Convert output */ - PROTECT(sparseres=Ry_igraph_sparsemat_to_SEXP(&c_sparseres)); - igraph_sparsemat_destroy(&c_sparseres); - IGRAPH_FINALLY_CLEAN(1); - r_result = sparseres; + igraph_vector_int_destroy(&c_candidate_data); + igraph_vs_destroy(&c_candidate); + PROTECT(res=NEW_LOGICAL(1)); + LOGICAL(res)[0]=c_res; + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_connected_components / +/ igraph_cliques / /-------------------------------------------*/ -SEXP R_igraph_connected_components(SEXP graph, SEXP mode) { +SEXP R_igraph_cliques(SEXP graph, SEXP min_size, SEXP max_size) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_t c_membership; - igraph_vector_int_t c_csize; - igraph_integer_t c_no; - igraph_connectedness_t c_mode; - SEXP membership; - SEXP csize; - SEXP no; + igraph_vector_int_list_t c_res; + igraph_integer_t c_min_size; + igraph_integer_t c_max_size; + SEXP res; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_membership, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_membership); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_csize, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_csize); - c_no=0; - c_mode = (igraph_connectedness_t) Rf_asInteger(mode); + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_res); + IGRAPH_R_CHECK_INT(min_size); + c_min_size = (igraph_integer_t) REAL(min_size)[0]; + IGRAPH_R_CHECK_INT(max_size); + c_max_size = (igraph_integer_t) REAL(max_size)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_connected_components(&c_graph, &c_membership, &c_csize, &c_no, c_mode)); - - /* Convert output */ - PROTECT(r_result=NEW_LIST(3)); - PROTECT(r_names=NEW_CHARACTER(3)); - PROTECT(membership=Ry_igraph_vector_int_to_SEXP(&c_membership)); - igraph_vector_int_destroy(&c_membership); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(csize=Ry_igraph_vector_int_to_SEXP(&c_csize)); - igraph_vector_int_destroy(&c_csize); + IGRAPH_R_CHECK(igraph_cliques(&c_graph, &c_res, c_min_size, c_max_size)); + + /* Convert output */ + PROTECT(res=Ry_igraph_vector_int_list_to_SEXPp1(&c_res)); + igraph_vector_int_list_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); - PROTECT(no=NEW_NUMERIC(1)); - REAL(no)[0]=(double) c_no; - SET_VECTOR_ELT(r_result, 0, membership); - SET_VECTOR_ELT(r_result, 1, csize); - SET_VECTOR_ELT(r_result, 2, no); - SET_STRING_ELT(r_names, 0, Rf_mkChar("membership")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("csize")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("no")); - SET_NAMES(r_result, r_names); - UNPROTECT(4); + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_is_connected / +/ igraph_clique_size_hist / /-------------------------------------------*/ -SEXP R_igraph_is_connected(SEXP graph, SEXP mode) { +SEXP R_igraph_clique_size_hist(SEXP graph, SEXP min_size, SEXP max_size) { /* Declarations */ igraph_t c_graph; - igraph_bool_t c_res; - igraph_connectedness_t c_mode; - SEXP res; + igraph_vector_t c_hist; + igraph_integer_t c_min_size; + igraph_integer_t c_max_size; + SEXP hist; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - c_mode = (igraph_connectedness_t) Rf_asInteger(mode); + IGRAPH_R_CHECK(igraph_vector_init(&c_hist, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_hist); + IGRAPH_R_CHECK_INT(min_size); + c_min_size = (igraph_integer_t) REAL(min_size)[0]; + IGRAPH_R_CHECK_INT(max_size); + c_max_size = (igraph_integer_t) REAL(max_size)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_is_connected(&c_graph, &c_res, c_mode)); + IGRAPH_R_CHECK(igraph_clique_size_hist(&c_graph, &c_hist, c_min_size, c_max_size)); /* Convert output */ - PROTECT(res=NEW_LOGICAL(1)); - LOGICAL(res)[0]=c_res; - r_result = res; + PROTECT(hist=Ry_igraph_vector_to_SEXP(&c_hist)); + igraph_vector_destroy(&c_hist); + IGRAPH_FINALLY_CLEAN(1); + r_result = hist; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_articulation_points / +/ igraph_largest_cliques / /-------------------------------------------*/ -SEXP R_igraph_articulation_points(SEXP graph) { +SEXP R_igraph_largest_cliques(SEXP graph) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_t c_res; + igraph_vector_int_list_t c_res; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_res); + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_res); /* Call igraph */ - IGRAPH_R_CHECK(igraph_articulation_points(&c_graph, &c_res)); + IGRAPH_R_CHECK(igraph_largest_cliques(&c_graph, &c_res)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_int_to_SEXPp1(&c_res)); - igraph_vector_int_destroy(&c_res); + PROTECT(res=Ry_igraph_vector_int_list_to_SEXPp1(&c_res)); + igraph_vector_int_list_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); r_result = res; @@ -6653,323 +9922,275 @@ SEXP R_igraph_articulation_points(SEXP graph) { } /*-------------------------------------------/ -/ igraph_biconnected_components / +/ igraph_maximal_cliques / /-------------------------------------------*/ -SEXP R_igraph_biconnected_components(SEXP graph) { +SEXP R_igraph_maximal_cliques(SEXP graph, SEXP min_size, SEXP max_size) { /* Declarations */ igraph_t c_graph; - igraph_integer_t c_no; - igraph_vector_int_list_t c_tree_edges; - igraph_vector_int_list_t c_component_edges; - igraph_vector_int_list_t c_components; - igraph_vector_int_t c_articulation_points; - SEXP no; - SEXP tree_edges; - SEXP component_edges; - SEXP components; - SEXP articulation_points; + igraph_vector_int_list_t c_res; + igraph_integer_t c_min_size; + igraph_integer_t c_max_size; + SEXP res; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - c_no=0; - IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_tree_edges, 0)); - IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_tree_edges); - IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_component_edges, 0)); - IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_component_edges); - IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_components, 0)); - IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_components); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_articulation_points, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_articulation_points); + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_res); + IGRAPH_R_CHECK_INT(min_size); + c_min_size = (igraph_integer_t) REAL(min_size)[0]; + IGRAPH_R_CHECK_INT(max_size); + c_max_size = (igraph_integer_t) REAL(max_size)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_biconnected_components(&c_graph, &c_no, &c_tree_edges, &c_component_edges, &c_components, &c_articulation_points)); + IGRAPH_R_CHECK(igraph_maximal_cliques(&c_graph, &c_res, c_min_size, c_max_size)); /* Convert output */ - PROTECT(r_result=NEW_LIST(5)); - PROTECT(r_names=NEW_CHARACTER(5)); - PROTECT(no=NEW_NUMERIC(1)); - REAL(no)[0]=(double) c_no; - PROTECT(tree_edges=Ry_igraph_vector_int_list_to_SEXPp1(&c_tree_edges)); - igraph_vector_int_list_destroy(&c_tree_edges); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(component_edges=Ry_igraph_vector_int_list_to_SEXPp1(&c_component_edges)); - igraph_vector_int_list_destroy(&c_component_edges); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(components=Ry_igraph_vector_int_list_to_SEXPp1(&c_components)); - igraph_vector_int_list_destroy(&c_components); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(articulation_points=Ry_igraph_vector_int_to_SEXPp1(&c_articulation_points)); - igraph_vector_int_destroy(&c_articulation_points); + PROTECT(res=Ry_igraph_vector_int_list_to_SEXPp1(&c_res)); + igraph_vector_int_list_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, no); - SET_VECTOR_ELT(r_result, 1, tree_edges); - SET_VECTOR_ELT(r_result, 2, component_edges); - SET_VECTOR_ELT(r_result, 3, components); - SET_VECTOR_ELT(r_result, 4, articulation_points); - SET_STRING_ELT(r_names, 0, Rf_mkChar("no")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("tree_edges")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("component_edges")); - SET_STRING_ELT(r_names, 3, Rf_mkChar("components")); - SET_STRING_ELT(r_names, 4, Rf_mkChar("articulation_points")); - SET_NAMES(r_result, r_names); - UNPROTECT(6); + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_bridges / +/ igraph_maximal_cliques_subset / /-------------------------------------------*/ -SEXP R_igraph_bridges(SEXP graph) { +SEXP R_igraph_maximal_cliques_subset(SEXP graph, SEXP subset, SEXP outfile, SEXP min_size, SEXP max_size) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_t c_res; + igraph_vector_int_t c_subset; + igraph_vector_int_list_t c_res; + igraph_integer_t c_no; + FILE* c_outfile; + igraph_integer_t c_min_size; + igraph_integer_t c_max_size; SEXP res; + SEXP no; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_res); + Rz_SEXP_to_vector_int_copy(subset, &c_subset); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_subset); + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_res); + c_no=0; + if (!Rf_isNull(outfile)) { + c_outfile = Ry_igraph_fopen_write(outfile); + IGRAPH_FINALLY(fclose, c_outfile); + } + IGRAPH_R_CHECK_INT(min_size); + c_min_size = (igraph_integer_t) REAL(min_size)[0]; + IGRAPH_R_CHECK_INT(max_size); + c_max_size = (igraph_integer_t) REAL(max_size)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_bridges(&c_graph, &c_res)); + IGRAPH_R_CHECK(igraph_maximal_cliques_subset(&c_graph, &c_subset, &c_res, &c_no, (Rf_isNull(outfile) ? 0 : c_outfile), c_min_size, c_max_size)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_int_to_SEXPp1(&c_res)); - igraph_vector_int_destroy(&c_res); + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + igraph_vector_int_destroy(&c_subset); IGRAPH_FINALLY_CLEAN(1); - r_result = res; + PROTECT(res=Ry_igraph_vector_int_list_to_SEXPp1(&c_res)); + igraph_vector_int_list_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(no=NEW_NUMERIC(1)); + REAL(no)[0]=(double) c_no; + SET_VECTOR_ELT(r_result, 0, res); + SET_VECTOR_ELT(r_result, 1, no); + SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("no")); + SET_NAMES(r_result, r_names); + UNPROTECT(3); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_is_biconnected / +/ igraph_maximal_cliques_count / /-------------------------------------------*/ -SEXP R_igraph_is_biconnected(SEXP graph) { +SEXP R_igraph_maximal_cliques_count(SEXP graph, SEXP min_size, SEXP max_size) { /* Declarations */ igraph_t c_graph; - igraph_bool_t c_res; - SEXP res; + igraph_integer_t c_no; + igraph_integer_t c_min_size; + igraph_integer_t c_max_size; + SEXP no; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); + c_no=0; + IGRAPH_R_CHECK_INT(min_size); + c_min_size = (igraph_integer_t) REAL(min_size)[0]; + IGRAPH_R_CHECK_INT(max_size); + c_max_size = (igraph_integer_t) REAL(max_size)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_is_biconnected(&c_graph, &c_res)); + IGRAPH_R_CHECK(igraph_maximal_cliques_count(&c_graph, &c_no, c_min_size, c_max_size)); /* Convert output */ - PROTECT(res=NEW_LOGICAL(1)); - LOGICAL(res)[0]=c_res; - r_result = res; + PROTECT(no=NEW_NUMERIC(1)); + REAL(no)[0]=(double) c_no; + r_result = no; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_count_reachable / +/ igraph_maximal_cliques_file / /-------------------------------------------*/ -SEXP R_igraph_count_reachable(SEXP graph, SEXP mode) { +SEXP R_igraph_maximal_cliques_file(SEXP graph, SEXP res, SEXP min_size, SEXP max_size) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_t c_counts; - igraph_neimode_t c_mode; - SEXP counts; + FILE* c_res; + igraph_integer_t c_min_size; + igraph_integer_t c_max_size; - SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_counts, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_counts); - c_mode = (igraph_neimode_t) Rf_asInteger(mode); + c_res = Ry_igraph_fopen_write(res); + IGRAPH_FINALLY(fclose, c_res); + IGRAPH_R_CHECK_INT(min_size); + c_min_size = (igraph_integer_t) REAL(min_size)[0]; + IGRAPH_R_CHECK_INT(max_size); + c_max_size = (igraph_integer_t) REAL(max_size)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_count_reachable(&c_graph, &c_counts, c_mode)); + IGRAPH_R_CHECK(igraph_maximal_cliques_file(&c_graph, c_res, c_min_size, c_max_size)); /* Convert output */ - PROTECT(counts=Ry_igraph_vector_int_to_SEXP(&c_counts)); - igraph_vector_int_destroy(&c_counts); - IGRAPH_FINALLY_CLEAN(1); - r_result = counts; - UNPROTECT(1); - return(r_result); + + + return(R_NilValue); } /*-------------------------------------------/ -/ igraph_bond_percolation / +/ igraph_maximal_cliques_hist / /-------------------------------------------*/ -SEXP R_igraph_bond_percolation(SEXP graph, SEXP edge_order) { +SEXP R_igraph_maximal_cliques_hist(SEXP graph, SEXP min_size, SEXP max_size) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_t c_giant_size; - igraph_vector_int_t c_vetex_count; - igraph_vector_int_t c_edge_order; - SEXP giant_size; - SEXP vetex_count; + igraph_vector_t c_hist; + igraph_integer_t c_min_size; + igraph_integer_t c_max_size; + SEXP hist; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_giant_size, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_giant_size); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_vetex_count, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vetex_count); - if (!Rf_isNull(edge_order)) { - Rz_SEXP_to_vector_int_copy(edge_order, &c_edge_order); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edge_order); - } else { - IGRAPH_R_CHECK(igraph_vector_int_init(&c_edge_order, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edge_order); - } + IGRAPH_R_CHECK(igraph_vector_init(&c_hist, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_hist); + IGRAPH_R_CHECK_INT(min_size); + c_min_size = (igraph_integer_t) REAL(min_size)[0]; + IGRAPH_R_CHECK_INT(max_size); + c_max_size = (igraph_integer_t) REAL(max_size)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_bond_percolation(&c_graph, &c_giant_size, &c_vetex_count, (Rf_isNull(edge_order) ? 0 : &c_edge_order))); + IGRAPH_R_CHECK(igraph_maximal_cliques_hist(&c_graph, &c_hist, c_min_size, c_max_size)); - /* Convert output */ - PROTECT(r_result=NEW_LIST(2)); - PROTECT(r_names=NEW_CHARACTER(2)); - PROTECT(giant_size=Ry_igraph_vector_int_to_SEXP(&c_giant_size)); - igraph_vector_int_destroy(&c_giant_size); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(vetex_count=Ry_igraph_vector_int_to_SEXP(&c_vetex_count)); - igraph_vector_int_destroy(&c_vetex_count); - IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_edge_order); - IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, giant_size); - SET_VECTOR_ELT(r_result, 1, vetex_count); - SET_STRING_ELT(r_names, 0, Rf_mkChar("giant_size")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("vetex_count")); - SET_NAMES(r_result, r_names); - UNPROTECT(3); + /* Convert output */ + PROTECT(hist=Ry_igraph_vector_to_SEXP(&c_hist)); + igraph_vector_destroy(&c_hist); + IGRAPH_FINALLY_CLEAN(1); + r_result = hist; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_site_percolation / +/ igraph_clique_number / /-------------------------------------------*/ -SEXP R_igraph_site_percolation(SEXP graph, SEXP vertex_order) { +SEXP R_igraph_clique_number(SEXP graph) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_t c_giant_size; - igraph_vector_int_t c_edge_count; - igraph_vector_int_t c_vertex_order; - SEXP giant_size; - SEXP edge_count; + igraph_integer_t c_no; + SEXP no; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_giant_size, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_giant_size); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_edge_count, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edge_count); - if (!Rf_isNull(vertex_order)) { - Rz_SEXP_to_vector_int_copy(vertex_order, &c_vertex_order); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vertex_order); - } else { - IGRAPH_R_CHECK(igraph_vector_int_init(&c_vertex_order, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vertex_order); - } + c_no=0; /* Call igraph */ - IGRAPH_R_CHECK(igraph_site_percolation(&c_graph, &c_giant_size, &c_edge_count, (Rf_isNull(vertex_order) ? 0 : &c_vertex_order))); + IGRAPH_R_CHECK(igraph_clique_number(&c_graph, &c_no)); /* Convert output */ - PROTECT(r_result=NEW_LIST(2)); - PROTECT(r_names=NEW_CHARACTER(2)); - PROTECT(giant_size=Ry_igraph_vector_int_to_SEXP(&c_giant_size)); - igraph_vector_int_destroy(&c_giant_size); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(edge_count=Ry_igraph_vector_int_to_SEXP(&c_edge_count)); - igraph_vector_int_destroy(&c_edge_count); - IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_vertex_order); - IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, giant_size); - SET_VECTOR_ELT(r_result, 1, edge_count); - SET_STRING_ELT(r_names, 0, Rf_mkChar("giant_size")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("edge_count")); - SET_NAMES(r_result, r_names); - UNPROTECT(3); + PROTECT(no=NEW_NUMERIC(1)); + REAL(no)[0]=(double) c_no; + r_result = no; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_edgelist_percolation / +/ igraph_weighted_cliques / /-------------------------------------------*/ -SEXP R_igraph_edgelist_percolation(SEXP edges) { +SEXP R_igraph_weighted_cliques(SEXP graph, SEXP vertex_weights, SEXP min_weight, SEXP max_weight, SEXP maximal) { /* Declarations */ - igraph_vector_int_t c_edges; - igraph_vector_int_t c_giant_size; - igraph_vector_int_t c_vertex_count; - SEXP giant_size; - SEXP vertex_count; + igraph_t c_graph; + igraph_vector_t c_vertex_weights; + igraph_vector_int_list_t c_res; + igraph_real_t c_min_weight; + igraph_real_t c_max_weight; + igraph_bool_t c_maximal; + SEXP res; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ - Rz_SEXP_to_vector_int_copy(edges, &c_edges); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edges); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_giant_size, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_giant_size); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_vertex_count, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vertex_count); + Rz_SEXP_to_igraph(graph, &c_graph); + if (!Rf_isNull(vertex_weights)) { + Rz_SEXP_to_vector(vertex_weights, &c_vertex_weights); + } + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_res); + IGRAPH_R_CHECK_REAL(min_weight); + c_min_weight = REAL(min_weight)[0]; + IGRAPH_R_CHECK_REAL(max_weight); + c_max_weight = REAL(max_weight)[0]; + IGRAPH_R_CHECK_BOOL(maximal); + c_maximal = LOGICAL(maximal)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_edgelist_percolation(&c_edges, &c_giant_size, &c_vertex_count)); + IGRAPH_R_CHECK(igraph_weighted_cliques(&c_graph, (Rf_isNull(vertex_weights) ? 0 : &c_vertex_weights), &c_res, c_min_weight, c_max_weight, c_maximal)); /* Convert output */ - PROTECT(r_result=NEW_LIST(2)); - PROTECT(r_names=NEW_CHARACTER(2)); - igraph_vector_int_destroy(&c_edges); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(giant_size=Ry_igraph_vector_int_to_SEXP(&c_giant_size)); - igraph_vector_int_destroy(&c_giant_size); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(vertex_count=Ry_igraph_vector_int_to_SEXP(&c_vertex_count)); - igraph_vector_int_destroy(&c_vertex_count); + PROTECT(res=Ry_igraph_vector_int_list_to_SEXPp1(&c_res)); + igraph_vector_int_list_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, giant_size); - SET_VECTOR_ELT(r_result, 1, vertex_count); - SET_STRING_ELT(r_names, 0, Rf_mkChar("giant_size")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("vertex_count")); - SET_NAMES(r_result, r_names); - UNPROTECT(3); + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_is_clique / +/ igraph_largest_weighted_cliques / /-------------------------------------------*/ -SEXP R_igraph_is_clique(SEXP graph, SEXP candidate, SEXP directed) { +SEXP R_igraph_largest_weighted_cliques(SEXP graph, SEXP vertex_weights) { /* Declarations */ igraph_t c_graph; - igraph_vs_t c_candidate; - igraph_bool_t c_directed; - igraph_bool_t c_res; + igraph_vector_t c_vertex_weights; + igraph_vector_int_list_t c_res; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - igraph_vector_int_t c_candidate_data; - Rz_SEXP_to_igraph_vs(candidate, &c_graph, &c_candidate, &c_candidate_data); - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; + if (!Rf_isNull(vertex_weights)) { + Rz_SEXP_to_vector(vertex_weights, &c_vertex_weights); + } + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_res); /* Call igraph */ - IGRAPH_R_CHECK(igraph_is_clique(&c_graph, c_candidate, c_directed, &c_res)); + IGRAPH_R_CHECK(igraph_largest_weighted_cliques(&c_graph, (Rf_isNull(vertex_weights) ? 0 : &c_vertex_weights), &c_res)); /* Convert output */ - igraph_vector_int_destroy(&c_candidate_data); - igraph_vs_destroy(&c_candidate); - PROTECT(res=NEW_LOGICAL(1)); - LOGICAL(res)[0]=c_res; + PROTECT(res=Ry_igraph_vector_int_list_to_SEXPp1(&c_res)); + igraph_vector_int_list_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); r_result = res; UNPROTECT(1); @@ -6977,32 +10198,27 @@ SEXP R_igraph_is_clique(SEXP graph, SEXP candidate, SEXP directed) { } /*-------------------------------------------/ -/ igraph_cliques / +/ igraph_weighted_clique_number / /-------------------------------------------*/ -SEXP R_igraph_cliques(SEXP graph, SEXP min_size, SEXP max_size) { +SEXP R_igraph_weighted_clique_number(SEXP graph, SEXP vertex_weights) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_list_t c_res; - igraph_integer_t c_min_size; - igraph_integer_t c_max_size; + igraph_vector_t c_vertex_weights; + igraph_real_t c_res; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_res); - IGRAPH_R_CHECK_INT(min_size); - c_min_size = (igraph_integer_t) REAL(min_size)[0]; - IGRAPH_R_CHECK_INT(max_size); - c_max_size = (igraph_integer_t) REAL(max_size)[0]; + if (!Rf_isNull(vertex_weights)) { + Rz_SEXP_to_vector(vertex_weights, &c_vertex_weights); + } /* Call igraph */ - IGRAPH_R_CHECK(igraph_cliques(&c_graph, &c_res, c_min_size, c_max_size)); + IGRAPH_R_CHECK(igraph_weighted_clique_number(&c_graph, (Rf_isNull(vertex_weights) ? 0 : &c_vertex_weights), &c_res)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_int_list_to_SEXPp1(&c_res)); - igraph_vector_int_list_destroy(&c_res); - IGRAPH_FINALLY_CLEAN(1); + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=c_res; r_result = res; UNPROTECT(1); @@ -7010,45 +10226,43 @@ SEXP R_igraph_cliques(SEXP graph, SEXP min_size, SEXP max_size) { } /*-------------------------------------------/ -/ igraph_clique_size_hist / +/ igraph_is_independent_vertex_set / /-------------------------------------------*/ -SEXP R_igraph_clique_size_hist(SEXP graph, SEXP min_size, SEXP max_size) { +SEXP R_igraph_is_independent_vertex_set(SEXP graph, SEXP candidate) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_hist; - igraph_integer_t c_min_size; - igraph_integer_t c_max_size; - SEXP hist; + igraph_vs_t c_candidate; + igraph_bool_t c_res; + SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_init(&c_hist, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_hist); - IGRAPH_R_CHECK_INT(min_size); - c_min_size = (igraph_integer_t) REAL(min_size)[0]; - IGRAPH_R_CHECK_INT(max_size); - c_max_size = (igraph_integer_t) REAL(max_size)[0]; + igraph_vector_int_t c_candidate_data; + Rz_SEXP_to_igraph_vs(candidate, &c_graph, &c_candidate, &c_candidate_data); /* Call igraph */ - IGRAPH_R_CHECK(igraph_clique_size_hist(&c_graph, &c_hist, c_min_size, c_max_size)); + IGRAPH_R_CHECK(igraph_is_independent_vertex_set(&c_graph, c_candidate, &c_res)); /* Convert output */ - PROTECT(hist=Ry_igraph_vector_to_SEXP(&c_hist)); - igraph_vector_destroy(&c_hist); - IGRAPH_FINALLY_CLEAN(1); - r_result = hist; + igraph_vector_int_destroy(&c_candidate_data); + igraph_vs_destroy(&c_candidate); + PROTECT(res=NEW_LOGICAL(1)); + LOGICAL(res)[0]=c_res; + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_largest_cliques / +/ igraph_independent_vertex_sets / /-------------------------------------------*/ -SEXP R_igraph_largest_cliques(SEXP graph) { +SEXP R_igraph_independent_vertex_sets(SEXP graph, SEXP min_size, SEXP max_size) { /* Declarations */ igraph_t c_graph; igraph_vector_int_list_t c_res; + igraph_integer_t c_min_size; + igraph_integer_t c_max_size; SEXP res; SEXP r_result; @@ -7056,8 +10270,12 @@ SEXP R_igraph_largest_cliques(SEXP graph) { Rz_SEXP_to_igraph(graph, &c_graph); IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_res, 0)); IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_res); + IGRAPH_R_CHECK_INT(min_size); + c_min_size = (igraph_integer_t) REAL(min_size)[0]; + IGRAPH_R_CHECK_INT(max_size); + c_max_size = (igraph_integer_t) REAL(max_size)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_largest_cliques(&c_graph, &c_res)); + IGRAPH_R_CHECK(igraph_independent_vertex_sets(&c_graph, &c_res, c_min_size, c_max_size)); /* Convert output */ PROTECT(res=Ry_igraph_vector_int_list_to_SEXPp1(&c_res)); @@ -7070,73 +10288,63 @@ SEXP R_igraph_largest_cliques(SEXP graph) { } /*-------------------------------------------/ -/ igraph_maximal_cliques_count / +/ igraph_largest_independent_vertex_sets / /-------------------------------------------*/ -SEXP R_igraph_maximal_cliques_count(SEXP graph, SEXP min_size, SEXP max_size) { +SEXP R_igraph_largest_independent_vertex_sets(SEXP graph) { /* Declarations */ igraph_t c_graph; - igraph_integer_t c_no; - igraph_integer_t c_min_size; - igraph_integer_t c_max_size; - SEXP no; + igraph_vector_int_list_t c_res; + SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - c_no=0; - IGRAPH_R_CHECK_INT(min_size); - c_min_size = (igraph_integer_t) REAL(min_size)[0]; - IGRAPH_R_CHECK_INT(max_size); - c_max_size = (igraph_integer_t) REAL(max_size)[0]; + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_res); /* Call igraph */ - IGRAPH_R_CHECK(igraph_maximal_cliques_count(&c_graph, &c_no, c_min_size, c_max_size)); + IGRAPH_R_CHECK(igraph_largest_independent_vertex_sets(&c_graph, &c_res)); /* Convert output */ - PROTECT(no=NEW_NUMERIC(1)); - REAL(no)[0]=(double) c_no; - r_result = no; + PROTECT(res=Ry_igraph_vector_int_list_to_SEXPp1(&c_res)); + igraph_vector_int_list_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_maximal_cliques_hist / +/ igraph_maximal_independent_vertex_sets / /-------------------------------------------*/ -SEXP R_igraph_maximal_cliques_hist(SEXP graph, SEXP min_size, SEXP max_size) { +SEXP R_igraph_maximal_independent_vertex_sets(SEXP graph) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_hist; - igraph_integer_t c_min_size; - igraph_integer_t c_max_size; - SEXP hist; + igraph_vector_int_list_t c_res; + SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_init(&c_hist, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_hist); - IGRAPH_R_CHECK_INT(min_size); - c_min_size = (igraph_integer_t) REAL(min_size)[0]; - IGRAPH_R_CHECK_INT(max_size); - c_max_size = (igraph_integer_t) REAL(max_size)[0]; + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_res); /* Call igraph */ - IGRAPH_R_CHECK(igraph_maximal_cliques_hist(&c_graph, &c_hist, c_min_size, c_max_size)); + IGRAPH_R_CHECK(igraph_maximal_independent_vertex_sets(&c_graph, &c_res)); /* Convert output */ - PROTECT(hist=Ry_igraph_vector_to_SEXP(&c_hist)); - igraph_vector_destroy(&c_hist); + PROTECT(res=Ry_igraph_vector_int_list_to_SEXPp1(&c_res)); + igraph_vector_int_list_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); - r_result = hist; + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_clique_number / +/ igraph_independence_number / /-------------------------------------------*/ -SEXP R_igraph_clique_number(SEXP graph) { +SEXP R_igraph_independence_number(SEXP graph) { /* Declarations */ igraph_t c_graph; igraph_integer_t c_no; @@ -7147,7 +10355,7 @@ SEXP R_igraph_clique_number(SEXP graph) { Rz_SEXP_to_igraph(graph, &c_graph); c_no=0; /* Call igraph */ - IGRAPH_R_CHECK(igraph_clique_number(&c_graph, &c_no)); + IGRAPH_R_CHECK(igraph_independence_number(&c_graph, &c_no)); /* Convert output */ PROTECT(no=NEW_NUMERIC(1)); @@ -7159,38 +10367,25 @@ SEXP R_igraph_clique_number(SEXP graph) { } /*-------------------------------------------/ -/ igraph_weighted_cliques / +/ igraph_layout_random / /-------------------------------------------*/ -SEXP R_igraph_weighted_cliques(SEXP graph, SEXP vertex_weights, SEXP min_weight, SEXP max_weight, SEXP maximal) { +SEXP R_igraph_layout_random(SEXP graph) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_vertex_weights; - igraph_vector_int_list_t c_res; - igraph_real_t c_min_weight; - igraph_real_t c_max_weight; - igraph_bool_t c_maximal; + igraph_matrix_t c_res; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - if (!Rf_isNull(vertex_weights)) { - Rz_SEXP_to_vector(vertex_weights, &c_vertex_weights); - } - IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_res); - IGRAPH_R_CHECK_REAL(min_weight); - c_min_weight = REAL(min_weight)[0]; - IGRAPH_R_CHECK_REAL(max_weight); - c_max_weight = REAL(max_weight)[0]; - IGRAPH_R_CHECK_BOOL(maximal); - c_maximal = LOGICAL(maximal)[0]; + IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); /* Call igraph */ - IGRAPH_R_CHECK(igraph_weighted_cliques(&c_graph, (Rf_isNull(vertex_weights) ? 0 : &c_vertex_weights), &c_res, c_min_weight, c_max_weight, c_maximal)); + IGRAPH_R_CHECK(igraph_layout_random(&c_graph, &c_res)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_int_list_to_SEXPp1(&c_res)); - igraph_vector_int_list_destroy(&c_res); + PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); + igraph_matrix_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); r_result = res; @@ -7199,30 +10394,31 @@ SEXP R_igraph_weighted_cliques(SEXP graph, SEXP vertex_weights, SEXP min_weight, } /*-------------------------------------------/ -/ igraph_largest_weighted_cliques / +/ igraph_layout_circle / /-------------------------------------------*/ -SEXP R_igraph_largest_weighted_cliques(SEXP graph, SEXP vertex_weights) { +SEXP R_igraph_layout_circle(SEXP graph, SEXP order) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_vertex_weights; - igraph_vector_int_list_t c_res; + igraph_matrix_t c_res; + igraph_vs_t c_order; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - if (!Rf_isNull(vertex_weights)) { - Rz_SEXP_to_vector(vertex_weights, &c_vertex_weights); - } - IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_res); + IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); + igraph_vector_int_t c_order_data; + Rz_SEXP_to_igraph_vs(order, &c_graph, &c_order, &c_order_data); /* Call igraph */ - IGRAPH_R_CHECK(igraph_largest_weighted_cliques(&c_graph, (Rf_isNull(vertex_weights) ? 0 : &c_vertex_weights), &c_res)); + IGRAPH_R_CHECK(igraph_layout_circle(&c_graph, &c_res, c_order)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_int_list_to_SEXPp1(&c_res)); - igraph_vector_int_list_destroy(&c_res); + PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); + igraph_matrix_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_order_data); + igraph_vs_destroy(&c_order); r_result = res; UNPROTECT(1); @@ -7230,27 +10426,38 @@ SEXP R_igraph_largest_weighted_cliques(SEXP graph, SEXP vertex_weights) { } /*-------------------------------------------/ -/ igraph_weighted_clique_number / +/ igraph_layout_star / /-------------------------------------------*/ -SEXP R_igraph_weighted_clique_number(SEXP graph, SEXP vertex_weights) { +SEXP R_igraph_layout_star(SEXP graph, SEXP center, SEXP order) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_vertex_weights; - igraph_real_t c_res; + igraph_matrix_t c_res; + igraph_integer_t c_center; + igraph_vector_int_t c_order; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - if (!Rf_isNull(vertex_weights)) { - Rz_SEXP_to_vector(vertex_weights, &c_vertex_weights); + IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); + c_center = (igraph_integer_t) REAL(center)[0]; + if (!Rf_isNull(order)) { + Rz_SEXP_to_vector_int_copy(order, &c_order); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_order); + } else { + IGRAPH_R_CHECK(igraph_vector_int_init(&c_order, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_order); } /* Call igraph */ - IGRAPH_R_CHECK(igraph_weighted_clique_number(&c_graph, (Rf_isNull(vertex_weights) ? 0 : &c_vertex_weights), &c_res)); + IGRAPH_R_CHECK(igraph_layout_star(&c_graph, &c_res, c_center, (Rf_isNull(order) ? 0 : &c_order))); /* Convert output */ - PROTECT(res=NEW_NUMERIC(1)); - REAL(res)[0]=c_res; + PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); + igraph_matrix_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_order); + IGRAPH_FINALLY_CLEAN(1); r_result = res; UNPROTECT(1); @@ -7258,28 +10465,29 @@ SEXP R_igraph_weighted_clique_number(SEXP graph, SEXP vertex_weights) { } /*-------------------------------------------/ -/ igraph_is_independent_vertex_set / +/ igraph_layout_grid / /-------------------------------------------*/ -SEXP R_igraph_is_independent_vertex_set(SEXP graph, SEXP candidate) { +SEXP R_igraph_layout_grid(SEXP graph, SEXP width) { /* Declarations */ igraph_t c_graph; - igraph_vs_t c_candidate; - igraph_bool_t c_res; + igraph_matrix_t c_res; + igraph_integer_t c_width; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - igraph_vector_int_t c_candidate_data; - Rz_SEXP_to_igraph_vs(candidate, &c_graph, &c_candidate, &c_candidate_data); + IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); + IGRAPH_R_CHECK_INT(width); + c_width = (igraph_integer_t) REAL(width)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_is_independent_vertex_set(&c_graph, c_candidate, &c_res)); + IGRAPH_R_CHECK(igraph_layout_grid(&c_graph, &c_res, c_width)); /* Convert output */ - igraph_vector_int_destroy(&c_candidate_data); - igraph_vs_destroy(&c_candidate); - PROTECT(res=NEW_LOGICAL(1)); - LOGICAL(res)[0]=c_res; + PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); + igraph_matrix_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); r_result = res; UNPROTECT(1); @@ -7287,25 +10495,31 @@ SEXP R_igraph_is_independent_vertex_set(SEXP graph, SEXP candidate) { } /*-------------------------------------------/ -/ igraph_largest_independent_vertex_sets / +/ igraph_layout_grid_3d / /-------------------------------------------*/ -SEXP R_igraph_largest_independent_vertex_sets(SEXP graph) { +SEXP R_igraph_layout_grid_3d(SEXP graph, SEXP width, SEXP height) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_list_t c_res; + igraph_matrix_t c_res; + igraph_integer_t c_width; + igraph_integer_t c_height; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_res); + IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); + IGRAPH_R_CHECK_INT(width); + c_width = (igraph_integer_t) REAL(width)[0]; + IGRAPH_R_CHECK_INT(height); + c_height = (igraph_integer_t) REAL(height)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_largest_independent_vertex_sets(&c_graph, &c_res)); + IGRAPH_R_CHECK(igraph_layout_grid_3d(&c_graph, &c_res, c_width, c_height)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_int_list_to_SEXPp1(&c_res)); - igraph_vector_int_list_destroy(&c_res); + PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); + igraph_matrix_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); r_result = res; @@ -7314,64 +10528,140 @@ SEXP R_igraph_largest_independent_vertex_sets(SEXP graph) { } /*-------------------------------------------/ -/ igraph_maximal_independent_vertex_sets / +/ igraph_layout_fruchterman_reingold / /-------------------------------------------*/ -SEXP R_igraph_maximal_independent_vertex_sets(SEXP graph) { +SEXP R_igraph_layout_fruchterman_reingold(SEXP graph, SEXP coords, SEXP use_seed, SEXP niter, SEXP start_temp, SEXP grid, SEXP weights, SEXP minx, SEXP maxx, SEXP miny, SEXP maxy) { /* Declarations */ igraph_t c_graph; - igraph_vector_int_list_t c_res; - SEXP res; + igraph_matrix_t c_coords; + igraph_bool_t c_use_seed; + igraph_integer_t c_niter; + igraph_real_t c_start_temp; + igraph_layout_grid_t c_grid; + igraph_vector_t c_weights; + igraph_vector_t c_minx; + igraph_vector_t c_maxx; + igraph_vector_t c_miny; + igraph_vector_t c_maxy; + + + + SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_res); + if (!Rf_isNull(coords)) { + IGRAPH_R_CHECK(Rz_SEXP_to_igraph_matrix_copy(coords, &c_coords)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_coords); + } + IGRAPH_R_CHECK_BOOL(use_seed); + c_use_seed = LOGICAL(use_seed)[0]; + IGRAPH_R_CHECK_INT(niter); + c_niter = (igraph_integer_t) REAL(niter)[0]; + IGRAPH_R_CHECK_REAL(start_temp); + c_start_temp = REAL(start_temp)[0]; + c_grid = (igraph_layout_grid_t) Rf_asInteger(grid); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + if (!Rf_isNull(minx)) { + Rz_SEXP_to_vector(minx, &c_minx); + } + if (!Rf_isNull(maxx)) { + Rz_SEXP_to_vector(maxx, &c_maxx); + } + if (!Rf_isNull(miny)) { + Rz_SEXP_to_vector(miny, &c_miny); + } + if (!Rf_isNull(maxy)) { + Rz_SEXP_to_vector(maxy, &c_maxy); + } /* Call igraph */ - IGRAPH_R_CHECK(igraph_maximal_independent_vertex_sets(&c_graph, &c_res)); + IGRAPH_R_CHECK(igraph_layout_fruchterman_reingold(&c_graph, &c_coords, c_use_seed, c_niter, c_start_temp, c_grid, (Rf_isNull(weights) ? 0 : &c_weights), (Rf_isNull(minx) ? 0 : &c_minx), (Rf_isNull(maxx) ? 0 : &c_maxx), (Rf_isNull(miny) ? 0 : &c_miny), (Rf_isNull(maxy) ? 0 : &c_maxy))); /* Convert output */ - PROTECT(res=Ry_igraph_vector_int_list_to_SEXPp1(&c_res)); - igraph_vector_int_list_destroy(&c_res); + PROTECT(coords=Ry_igraph_matrix_to_SEXP(&c_coords)); + igraph_matrix_destroy(&c_coords); IGRAPH_FINALLY_CLEAN(1); - r_result = res; + r_result = coords; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_independence_number / +/ igraph_layout_kamada_kawai / /-------------------------------------------*/ -SEXP R_igraph_independence_number(SEXP graph) { +SEXP R_igraph_layout_kamada_kawai(SEXP graph, SEXP coords, SEXP use_seed, SEXP maxiter, SEXP epsilon, SEXP kkconst, SEXP weights, SEXP minx, SEXP maxx, SEXP miny, SEXP maxy) { /* Declarations */ igraph_t c_graph; - igraph_integer_t c_no; - SEXP no; + igraph_matrix_t c_coords; + igraph_bool_t c_use_seed; + igraph_integer_t c_maxiter; + igraph_real_t c_epsilon; + igraph_real_t c_kkconst; + igraph_vector_t c_weights; + igraph_vector_t c_minx; + igraph_vector_t c_maxx; + igraph_vector_t c_miny; + igraph_vector_t c_maxy; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - c_no=0; + IGRAPH_R_CHECK(Rz_SEXP_to_igraph_matrix_copy(coords, &c_coords)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_coords); + IGRAPH_R_CHECK_BOOL(use_seed); + c_use_seed = LOGICAL(use_seed)[0]; + IGRAPH_R_CHECK_INT(maxiter); + c_maxiter = (igraph_integer_t) REAL(maxiter)[0]; + IGRAPH_R_CHECK_REAL(epsilon); + c_epsilon = REAL(epsilon)[0]; + IGRAPH_R_CHECK_REAL(kkconst); + c_kkconst = REAL(kkconst)[0]; + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + if (!Rf_isNull(minx)) { + Rz_SEXP_to_vector(minx, &c_minx); + } + if (!Rf_isNull(maxx)) { + Rz_SEXP_to_vector(maxx, &c_maxx); + } + if (!Rf_isNull(miny)) { + Rz_SEXP_to_vector(miny, &c_miny); + } + if (!Rf_isNull(maxy)) { + Rz_SEXP_to_vector(maxy, &c_maxy); + } /* Call igraph */ - IGRAPH_R_CHECK(igraph_independence_number(&c_graph, &c_no)); + IGRAPH_R_CHECK(igraph_layout_kamada_kawai(&c_graph, &c_coords, c_use_seed, c_maxiter, c_epsilon, c_kkconst, (Rf_isNull(weights) ? 0 : &c_weights), (Rf_isNull(minx) ? 0 : &c_minx), (Rf_isNull(maxx) ? 0 : &c_maxx), (Rf_isNull(miny) ? 0 : &c_miny), (Rf_isNull(maxy) ? 0 : &c_maxy))); /* Convert output */ - PROTECT(no=NEW_NUMERIC(1)); - REAL(no)[0]=(double) c_no; - r_result = no; + PROTECT(coords=Ry_igraph_matrix_to_SEXP(&c_coords)); + igraph_matrix_destroy(&c_coords); + IGRAPH_FINALLY_CLEAN(1); + r_result = coords; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_layout_random / +/ igraph_layout_lgl / /-------------------------------------------*/ -SEXP R_igraph_layout_random(SEXP graph) { +SEXP R_igraph_layout_lgl(SEXP graph, SEXP maxiter, SEXP maxdelta, SEXP area, SEXP coolexp, SEXP repulserad, SEXP cellsize, SEXP root) { /* Declarations */ igraph_t c_graph; igraph_matrix_t c_res; + igraph_integer_t c_maxiter; + igraph_real_t c_maxdelta; + igraph_real_t c_area; + igraph_real_t c_coolexp; + igraph_real_t c_repulserad; + igraph_real_t c_cellsize; + igraph_integer_t c_root; SEXP res; SEXP r_result; @@ -7379,8 +10669,22 @@ SEXP R_igraph_layout_random(SEXP graph) { Rz_SEXP_to_igraph(graph, &c_graph); IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); + IGRAPH_R_CHECK_INT(maxiter); + c_maxiter = (igraph_integer_t) REAL(maxiter)[0]; + IGRAPH_R_CHECK_REAL(maxdelta); + c_maxdelta = REAL(maxdelta)[0]; + IGRAPH_R_CHECK_REAL(area); + c_area = REAL(area)[0]; + IGRAPH_R_CHECK_REAL(coolexp); + c_coolexp = REAL(coolexp)[0]; + IGRAPH_R_CHECK_REAL(repulserad); + c_repulserad = REAL(repulserad)[0]; + IGRAPH_R_CHECK_REAL(cellsize); + c_cellsize = REAL(cellsize)[0]; + IGRAPH_R_CHECK_INT(root); + c_root = (igraph_integer_t) REAL(root)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_layout_random(&c_graph, &c_res)); + IGRAPH_R_CHECK(igraph_layout_lgl(&c_graph, &c_res, c_maxiter, c_maxdelta, c_area, c_coolexp, c_repulserad, c_cellsize, c_root)); /* Convert output */ PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); @@ -7393,13 +10697,15 @@ SEXP R_igraph_layout_random(SEXP graph) { } /*-------------------------------------------/ -/ igraph_layout_circle / +/ igraph_layout_reingold_tilford / /-------------------------------------------*/ -SEXP R_igraph_layout_circle(SEXP graph, SEXP order) { +SEXP R_igraph_layout_reingold_tilford(SEXP graph, SEXP mode, SEXP roots, SEXP rootlevel) { /* Declarations */ igraph_t c_graph; igraph_matrix_t c_res; - igraph_vs_t c_order; + igraph_neimode_t c_mode; + igraph_vector_int_t c_roots; + igraph_vector_int_t c_rootlevel; SEXP res; SEXP r_result; @@ -7407,17 +10713,32 @@ SEXP R_igraph_layout_circle(SEXP graph, SEXP order) { Rz_SEXP_to_igraph(graph, &c_graph); IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); - igraph_vector_int_t c_order_data; - Rz_SEXP_to_igraph_vs(order, &c_graph, &c_order, &c_order_data); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + if (!Rf_isNull(roots)) { + Rz_SEXP_to_vector_int_copy(roots, &c_roots); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_roots); + } else { + IGRAPH_R_CHECK(igraph_vector_int_init(&c_roots, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_roots); + } + if (!Rf_isNull(rootlevel)) { + IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(rootlevel, &c_rootlevel)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_rootlevel); + } else { + IGRAPH_R_CHECK(igraph_vector_int_init(&c_rootlevel, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_rootlevel); + } /* Call igraph */ - IGRAPH_R_CHECK(igraph_layout_circle(&c_graph, &c_res, c_order)); + IGRAPH_R_CHECK(igraph_layout_reingold_tilford(&c_graph, &c_res, c_mode, (Rf_isNull(roots) ? 0 : &c_roots), (Rf_isNull(rootlevel) ? 0 : &c_rootlevel))); /* Convert output */ PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); igraph_matrix_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_order_data); - igraph_vs_destroy(&c_order); + igraph_vector_int_destroy(&c_roots); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_rootlevel); + IGRAPH_FINALLY_CLEAN(1); r_result = res; UNPROTECT(1); @@ -7425,14 +10746,15 @@ SEXP R_igraph_layout_circle(SEXP graph, SEXP order) { } /*-------------------------------------------/ -/ igraph_layout_star / +/ igraph_layout_reingold_tilford_circular / /-------------------------------------------*/ -SEXP R_igraph_layout_star(SEXP graph, SEXP center, SEXP order) { +SEXP R_igraph_layout_reingold_tilford_circular(SEXP graph, SEXP mode, SEXP roots, SEXP rootlevel) { /* Declarations */ igraph_t c_graph; igraph_matrix_t c_res; - igraph_integer_t c_center; - igraph_vector_int_t c_order; + igraph_neimode_t c_mode; + igraph_vector_int_t c_roots; + igraph_vector_int_t c_rootlevel; SEXP res; SEXP r_result; @@ -7440,37 +10762,76 @@ SEXP R_igraph_layout_star(SEXP graph, SEXP center, SEXP order) { Rz_SEXP_to_igraph(graph, &c_graph); IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); - c_center = (igraph_integer_t) REAL(center)[0]; - if (!Rf_isNull(order)) { - Rz_SEXP_to_vector_int_copy(order, &c_order); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_order); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + if (!Rf_isNull(roots)) { + Rz_SEXP_to_vector_int_copy(roots, &c_roots); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_roots); } else { - IGRAPH_R_CHECK(igraph_vector_int_init(&c_order, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_order); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_roots, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_roots); + } + if (!Rf_isNull(rootlevel)) { + IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(rootlevel, &c_rootlevel)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_rootlevel); + } else { + IGRAPH_R_CHECK(igraph_vector_int_init(&c_rootlevel, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_rootlevel); } /* Call igraph */ - IGRAPH_R_CHECK(igraph_layout_star(&c_graph, &c_res, c_center, (Rf_isNull(order) ? 0 : &c_order))); + IGRAPH_R_CHECK(igraph_layout_reingold_tilford_circular(&c_graph, &c_res, c_mode, (Rf_isNull(roots) ? 0 : &c_roots), (Rf_isNull(rootlevel) ? 0 : &c_rootlevel))); /* Convert output */ PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); igraph_matrix_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_order); + igraph_vector_int_destroy(&c_roots); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_rootlevel); + IGRAPH_FINALLY_CLEAN(1); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_roots_for_tree_layout / +/-------------------------------------------*/ +SEXP R_igraph_roots_for_tree_layout(SEXP graph, SEXP mode, SEXP heuristic) { + /* Declarations */ + igraph_t c_graph; + igraph_neimode_t c_mode; + igraph_vector_int_t c_roots; + igraph_root_choice_t c_heuristic; + SEXP roots; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_roots, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_roots); + c_heuristic = (igraph_root_choice_t) Rf_asInteger(heuristic); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_roots_for_tree_layout(&c_graph, c_mode, &c_roots, c_heuristic)); + + /* Convert output */ + PROTECT(roots=Ry_igraph_vector_int_to_SEXPp1(&c_roots)); + igraph_vector_int_destroy(&c_roots); IGRAPH_FINALLY_CLEAN(1); - r_result = res; + r_result = roots; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_layout_grid / +/ igraph_layout_random_3d / /-------------------------------------------*/ -SEXP R_igraph_layout_grid(SEXP graph, SEXP width) { +SEXP R_igraph_layout_random_3d(SEXP graph) { /* Declarations */ igraph_t c_graph; igraph_matrix_t c_res; - igraph_integer_t c_width; SEXP res; SEXP r_result; @@ -7478,10 +10839,8 @@ SEXP R_igraph_layout_grid(SEXP graph, SEXP width) { Rz_SEXP_to_igraph(graph, &c_graph); IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); - IGRAPH_R_CHECK_INT(width); - c_width = (igraph_integer_t) REAL(width)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_layout_grid(&c_graph, &c_res, c_width)); + IGRAPH_R_CHECK(igraph_layout_random_3d(&c_graph, &c_res)); /* Convert output */ PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); @@ -7494,14 +10853,12 @@ SEXP R_igraph_layout_grid(SEXP graph, SEXP width) { } /*-------------------------------------------/ -/ igraph_layout_grid_3d / +/ igraph_layout_sphere / /-------------------------------------------*/ -SEXP R_igraph_layout_grid_3d(SEXP graph, SEXP width, SEXP height) { +SEXP R_igraph_layout_sphere(SEXP graph) { /* Declarations */ igraph_t c_graph; igraph_matrix_t c_res; - igraph_integer_t c_width; - igraph_integer_t c_height; SEXP res; SEXP r_result; @@ -7509,12 +10866,8 @@ SEXP R_igraph_layout_grid_3d(SEXP graph, SEXP width, SEXP height) { Rz_SEXP_to_igraph(graph, &c_graph); IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); - IGRAPH_R_CHECK_INT(width); - c_width = (igraph_integer_t) REAL(width)[0]; - IGRAPH_R_CHECK_INT(height); - c_height = (igraph_integer_t) REAL(height)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_layout_grid_3d(&c_graph, &c_res, c_width, c_height)); + IGRAPH_R_CHECK(igraph_layout_sphere(&c_graph, &c_res)); /* Convert output */ PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); @@ -7527,79 +10880,176 @@ SEXP R_igraph_layout_grid_3d(SEXP graph, SEXP width, SEXP height) { } /*-------------------------------------------/ -/ igraph_roots_for_tree_layout / +/ igraph_layout_fruchterman_reingold_3d / /-------------------------------------------*/ -SEXP R_igraph_roots_for_tree_layout(SEXP graph, SEXP mode, SEXP heuristic) { +SEXP R_igraph_layout_fruchterman_reingold_3d(SEXP graph, SEXP coords, SEXP use_seed, SEXP niter, SEXP start_temp, SEXP weights, SEXP minx, SEXP maxx, SEXP miny, SEXP maxy, SEXP minz, SEXP maxz) { /* Declarations */ igraph_t c_graph; - igraph_neimode_t c_mode; - igraph_vector_int_t c_roots; - igraph_root_choice_t c_heuristic; - SEXP roots; + igraph_matrix_t c_coords; + igraph_bool_t c_use_seed; + igraph_integer_t c_niter; + igraph_real_t c_start_temp; + igraph_vector_t c_weights; + igraph_vector_t c_minx; + igraph_vector_t c_maxx; + igraph_vector_t c_miny; + igraph_vector_t c_maxy; + igraph_vector_t c_minz; + igraph_vector_t c_maxz; + + + + SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - c_mode = (igraph_neimode_t) Rf_asInteger(mode); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_roots, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_roots); - c_heuristic = (igraph_root_choice_t) Rf_asInteger(heuristic); + if (!Rf_isNull(coords)) { + IGRAPH_R_CHECK(Rz_SEXP_to_igraph_matrix_copy(coords, &c_coords)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_coords); + } + IGRAPH_R_CHECK_BOOL(use_seed); + c_use_seed = LOGICAL(use_seed)[0]; + IGRAPH_R_CHECK_INT(niter); + c_niter = (igraph_integer_t) REAL(niter)[0]; + IGRAPH_R_CHECK_REAL(start_temp); + c_start_temp = REAL(start_temp)[0]; + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + if (!Rf_isNull(minx)) { + Rz_SEXP_to_vector(minx, &c_minx); + } + if (!Rf_isNull(maxx)) { + Rz_SEXP_to_vector(maxx, &c_maxx); + } + if (!Rf_isNull(miny)) { + Rz_SEXP_to_vector(miny, &c_miny); + } + if (!Rf_isNull(maxy)) { + Rz_SEXP_to_vector(maxy, &c_maxy); + } + if (!Rf_isNull(minz)) { + Rz_SEXP_to_vector(minz, &c_minz); + } + if (!Rf_isNull(maxz)) { + Rz_SEXP_to_vector(maxz, &c_maxz); + } /* Call igraph */ - IGRAPH_R_CHECK(igraph_roots_for_tree_layout(&c_graph, c_mode, &c_roots, c_heuristic)); + IGRAPH_R_CHECK(igraph_layout_fruchterman_reingold_3d(&c_graph, &c_coords, c_use_seed, c_niter, c_start_temp, (Rf_isNull(weights) ? 0 : &c_weights), (Rf_isNull(minx) ? 0 : &c_minx), (Rf_isNull(maxx) ? 0 : &c_maxx), (Rf_isNull(miny) ? 0 : &c_miny), (Rf_isNull(maxy) ? 0 : &c_maxy), (Rf_isNull(minz) ? 0 : &c_minz), (Rf_isNull(maxz) ? 0 : &c_maxz))); /* Convert output */ - PROTECT(roots=Ry_igraph_vector_int_to_SEXPp1(&c_roots)); - igraph_vector_int_destroy(&c_roots); + PROTECT(coords=Ry_igraph_matrix_to_SEXP(&c_coords)); + igraph_matrix_destroy(&c_coords); IGRAPH_FINALLY_CLEAN(1); - r_result = roots; + r_result = coords; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_layout_random_3d / +/ igraph_layout_kamada_kawai_3d / /-------------------------------------------*/ -SEXP R_igraph_layout_random_3d(SEXP graph) { +SEXP R_igraph_layout_kamada_kawai_3d(SEXP graph, SEXP coords, SEXP use_seed, SEXP maxiter, SEXP epsilon, SEXP kkconst, SEXP weights, SEXP minx, SEXP maxx, SEXP miny, SEXP maxy, SEXP minz, SEXP maxz) { /* Declarations */ igraph_t c_graph; - igraph_matrix_t c_res; - SEXP res; + igraph_matrix_t c_coords; + igraph_bool_t c_use_seed; + igraph_integer_t c_maxiter; + igraph_real_t c_epsilon; + igraph_real_t c_kkconst; + igraph_vector_t c_weights; + igraph_vector_t c_minx; + igraph_vector_t c_maxx; + igraph_vector_t c_miny; + igraph_vector_t c_maxy; + igraph_vector_t c_minz; + igraph_vector_t c_maxz; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); - IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); + IGRAPH_R_CHECK(Rz_SEXP_to_igraph_matrix_copy(coords, &c_coords)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_coords); + IGRAPH_R_CHECK_BOOL(use_seed); + c_use_seed = LOGICAL(use_seed)[0]; + IGRAPH_R_CHECK_INT(maxiter); + c_maxiter = (igraph_integer_t) REAL(maxiter)[0]; + IGRAPH_R_CHECK_REAL(epsilon); + c_epsilon = REAL(epsilon)[0]; + IGRAPH_R_CHECK_REAL(kkconst); + c_kkconst = REAL(kkconst)[0]; + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + if (!Rf_isNull(minx)) { + Rz_SEXP_to_vector(minx, &c_minx); + } + if (!Rf_isNull(maxx)) { + Rz_SEXP_to_vector(maxx, &c_maxx); + } + if (!Rf_isNull(miny)) { + Rz_SEXP_to_vector(miny, &c_miny); + } + if (!Rf_isNull(maxy)) { + Rz_SEXP_to_vector(maxy, &c_maxy); + } + if (!Rf_isNull(minz)) { + Rz_SEXP_to_vector(minz, &c_minz); + } + if (!Rf_isNull(maxz)) { + Rz_SEXP_to_vector(maxz, &c_maxz); + } /* Call igraph */ - IGRAPH_R_CHECK(igraph_layout_random_3d(&c_graph, &c_res)); + IGRAPH_R_CHECK(igraph_layout_kamada_kawai_3d(&c_graph, &c_coords, c_use_seed, c_maxiter, c_epsilon, c_kkconst, (Rf_isNull(weights) ? 0 : &c_weights), (Rf_isNull(minx) ? 0 : &c_minx), (Rf_isNull(maxx) ? 0 : &c_maxx), (Rf_isNull(miny) ? 0 : &c_miny), (Rf_isNull(maxy) ? 0 : &c_maxy), (Rf_isNull(minz) ? 0 : &c_minz), (Rf_isNull(maxz) ? 0 : &c_maxz))); /* Convert output */ - PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); - igraph_matrix_destroy(&c_res); + PROTECT(coords=Ry_igraph_matrix_to_SEXP(&c_coords)); + igraph_matrix_destroy(&c_coords); IGRAPH_FINALLY_CLEAN(1); - r_result = res; + r_result = coords; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_layout_sphere / +/ igraph_layout_graphopt / /-------------------------------------------*/ -SEXP R_igraph_layout_sphere(SEXP graph) { +SEXP R_igraph_layout_graphopt(SEXP graph, SEXP res, SEXP niter, SEXP node_charge, SEXP node_mass, SEXP spring_length, SEXP spring_constant, SEXP max_sa_movement, SEXP use_seed) { /* Declarations */ igraph_t c_graph; igraph_matrix_t c_res; - SEXP res; + igraph_integer_t c_niter; + igraph_real_t c_node_charge; + igraph_real_t c_node_mass; + igraph_real_t c_spring_length; + igraph_real_t c_spring_constant; + igraph_real_t c_max_sa_movement; + igraph_bool_t c_use_seed; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); + IGRAPH_R_CHECK(Rz_SEXP_to_igraph_matrix_copy(res, &c_res)); IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); + IGRAPH_R_CHECK_INT(niter); + c_niter = (igraph_integer_t) REAL(niter)[0]; + IGRAPH_R_CHECK_REAL(node_charge); + c_node_charge = REAL(node_charge)[0]; + IGRAPH_R_CHECK_REAL(node_mass); + c_node_mass = REAL(node_mass)[0]; + IGRAPH_R_CHECK_REAL(spring_length); + c_spring_length = REAL(spring_length)[0]; + IGRAPH_R_CHECK_REAL(spring_constant); + c_spring_constant = REAL(spring_constant)[0]; + IGRAPH_R_CHECK_REAL(max_sa_movement); + c_max_sa_movement = REAL(max_sa_movement)[0]; + IGRAPH_R_CHECK_BOOL(use_seed); + c_use_seed = LOGICAL(use_seed)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_layout_sphere(&c_graph, &c_res)); + IGRAPH_R_CHECK(igraph_layout_graphopt(&c_graph, &c_res, c_niter, c_node_charge, c_node_mass, c_spring_length, c_spring_constant, c_max_sa_movement, c_use_seed)); /* Convert output */ PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); @@ -7681,6 +11131,34 @@ SEXP R_igraph_layout_drl_3d(SEXP graph, SEXP res, SEXP use_seed, SEXP options, S return(r_result); } +/*-------------------------------------------/ +/ igraph_layout_merge_dla / +/-------------------------------------------*/ +SEXP R_igraph_layout_merge_dla(SEXP graphs, SEXP coords) { + /* Declarations */ + igraph_vector_ptr_t c_graphs; + igraph_matrix_list_t c_coords; + igraph_matrix_t c_res; + SEXP res; + + SEXP r_result; + /* Convert input */ + Ry_igraph_SEXP_to_matrixlist(coords, &c_coords); + IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_layout_merge_dla(c_graphs, &c_coords, &c_res)); + + /* Convert output */ + PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); + igraph_matrix_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + /*-------------------------------------------/ / igraph_layout_sugiyama / /-------------------------------------------*/ @@ -8058,31 +11536,174 @@ SEXP R_igraph_layout_align(SEXP graph, SEXP layout) { } /*-------------------------------------------/ -/ igraph_cocitation / +/ igraph_cocitation / +/-------------------------------------------*/ +SEXP R_igraph_cocitation(SEXP graph, SEXP vids) { + /* Declarations */ + igraph_t c_graph; + igraph_matrix_t c_res; + igraph_vs_t c_vids; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_cocitation(&c_graph, &c_res, c_vids)); + + /* Convert output */ + PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); + igraph_matrix_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_bibcoupling / +/-------------------------------------------*/ +SEXP R_igraph_bibcoupling(SEXP graph, SEXP vids) { + /* Declarations */ + igraph_t c_graph; + igraph_matrix_t c_res; + igraph_vs_t c_vids; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_bibcoupling(&c_graph, &c_res, c_vids)); + + /* Convert output */ + PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); + igraph_matrix_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_similarity_dice / +/-------------------------------------------*/ +SEXP R_igraph_similarity_dice(SEXP graph, SEXP vids, SEXP mode, SEXP loops) { + /* Declarations */ + igraph_t c_graph; + igraph_matrix_t c_res; + igraph_vs_t c_vids; + igraph_neimode_t c_mode; + igraph_bool_t c_loops; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); + igraph_vector_int_t c_vids_data; + Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK_BOOL(loops); + c_loops = LOGICAL(loops)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_similarity_dice(&c_graph, &c_res, c_vids, c_mode, c_loops)); + + /* Convert output */ + PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); + igraph_matrix_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_vids_data); + igraph_vs_destroy(&c_vids); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_similarity_dice_es / +/-------------------------------------------*/ +SEXP R_igraph_similarity_dice_es(SEXP graph, SEXP es, SEXP mode, SEXP loops) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_res; + igraph_es_t c_es; + igraph_neimode_t c_mode; + igraph_bool_t c_loops; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + igraph_vector_int_t c_es_data; + IGRAPH_R_CHECK(Rz_SEXP_to_igraph_es(es, &c_graph, &c_es, &c_es_data)); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK_BOOL(loops); + c_loops = LOGICAL(loops)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_similarity_dice_es(&c_graph, &c_res, c_es, c_mode, c_loops)); + + /* Convert output */ + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_es_data); + igraph_es_destroy(&c_es); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_similarity_dice_pairs / /-------------------------------------------*/ -SEXP R_igraph_cocitation(SEXP graph, SEXP vids) { +SEXP R_igraph_similarity_dice_pairs(SEXP graph, SEXP pairs, SEXP mode, SEXP loops) { /* Declarations */ igraph_t c_graph; - igraph_matrix_t c_res; - igraph_vs_t c_vids; + igraph_vector_t c_res; + igraph_vector_int_t c_pairs; + igraph_neimode_t c_mode; + igraph_bool_t c_loops; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); - IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); - igraph_vector_int_t c_vids_data; - Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + Rz_SEXP_to_vector_int_copy(pairs, &c_pairs); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_pairs); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK_BOOL(loops); + c_loops = LOGICAL(loops)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_cocitation(&c_graph, &c_res, c_vids)); + IGRAPH_R_CHECK(igraph_similarity_dice_pairs(&c_graph, &c_res, &c_pairs, c_mode, c_loops)); /* Convert output */ - PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); - igraph_matrix_destroy(&c_res); + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + igraph_vector_int_destroy(&c_pairs); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_vids_data); - igraph_vs_destroy(&c_vids); r_result = res; UNPROTECT(1); @@ -8090,13 +11711,14 @@ SEXP R_igraph_cocitation(SEXP graph, SEXP vids) { } /*-------------------------------------------/ -/ igraph_bibcoupling / +/ igraph_similarity_inverse_log_weighted / /-------------------------------------------*/ -SEXP R_igraph_bibcoupling(SEXP graph, SEXP vids) { +SEXP R_igraph_similarity_inverse_log_weighted(SEXP graph, SEXP vids, SEXP mode) { /* Declarations */ igraph_t c_graph; igraph_matrix_t c_res; igraph_vs_t c_vids; + igraph_neimode_t c_mode; SEXP res; SEXP r_result; @@ -8106,8 +11728,9 @@ SEXP R_igraph_bibcoupling(SEXP graph, SEXP vids) { IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); igraph_vector_int_t c_vids_data; Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); + c_mode = (igraph_neimode_t) Rf_asInteger(mode); /* Call igraph */ - IGRAPH_R_CHECK(igraph_bibcoupling(&c_graph, &c_res, c_vids)); + IGRAPH_R_CHECK(igraph_similarity_inverse_log_weighted(&c_graph, &c_res, c_vids, c_mode)); /* Convert output */ PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); @@ -8122,9 +11745,9 @@ SEXP R_igraph_bibcoupling(SEXP graph, SEXP vids) { } /*-------------------------------------------/ -/ igraph_similarity_dice / +/ igraph_similarity_jaccard / /-------------------------------------------*/ -SEXP R_igraph_similarity_dice(SEXP graph, SEXP vids, SEXP mode, SEXP loops) { +SEXP R_igraph_similarity_jaccard(SEXP graph, SEXP vids, SEXP mode, SEXP loops) { /* Declarations */ igraph_t c_graph; igraph_matrix_t c_res; @@ -8144,7 +11767,7 @@ SEXP R_igraph_similarity_dice(SEXP graph, SEXP vids, SEXP mode, SEXP loops) { IGRAPH_R_CHECK_BOOL(loops); c_loops = LOGICAL(loops)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_similarity_dice(&c_graph, &c_res, c_vids, c_mode, c_loops)); + IGRAPH_R_CHECK(igraph_similarity_jaccard(&c_graph, &c_res, c_vids, c_mode, c_loops)); /* Convert output */ PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); @@ -8159,9 +11782,9 @@ SEXP R_igraph_similarity_dice(SEXP graph, SEXP vids, SEXP mode, SEXP loops) { } /*-------------------------------------------/ -/ igraph_similarity_dice_es / +/ igraph_similarity_jaccard_es / /-------------------------------------------*/ -SEXP R_igraph_similarity_dice_es(SEXP graph, SEXP es, SEXP mode, SEXP loops) { +SEXP R_igraph_similarity_jaccard_es(SEXP graph, SEXP es, SEXP mode, SEXP loops) { /* Declarations */ igraph_t c_graph; igraph_vector_t c_res; @@ -8181,7 +11804,7 @@ SEXP R_igraph_similarity_dice_es(SEXP graph, SEXP es, SEXP mode, SEXP loops) { IGRAPH_R_CHECK_BOOL(loops); c_loops = LOGICAL(loops)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_similarity_dice_es(&c_graph, &c_res, c_es, c_mode, c_loops)); + IGRAPH_R_CHECK(igraph_similarity_jaccard_es(&c_graph, &c_res, c_es, c_mode, c_loops)); /* Convert output */ PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); @@ -8196,9 +11819,9 @@ SEXP R_igraph_similarity_dice_es(SEXP graph, SEXP es, SEXP mode, SEXP loops) { } /*-------------------------------------------/ -/ igraph_similarity_dice_pairs / +/ igraph_similarity_jaccard_pairs / /-------------------------------------------*/ -SEXP R_igraph_similarity_dice_pairs(SEXP graph, SEXP pairs, SEXP mode, SEXP loops) { +SEXP R_igraph_similarity_jaccard_pairs(SEXP graph, SEXP pairs, SEXP mode, SEXP loops) { /* Declarations */ igraph_t c_graph; igraph_vector_t c_res; @@ -8218,7 +11841,7 @@ SEXP R_igraph_similarity_dice_pairs(SEXP graph, SEXP pairs, SEXP mode, SEXP loop IGRAPH_R_CHECK_BOOL(loops); c_loops = LOGICAL(loops)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_similarity_dice_pairs(&c_graph, &c_res, &c_pairs, c_mode, c_loops)); + IGRAPH_R_CHECK(igraph_similarity_jaccard_pairs(&c_graph, &c_res, &c_pairs, c_mode, c_loops)); /* Convert output */ PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); @@ -8233,33 +11856,33 @@ SEXP R_igraph_similarity_dice_pairs(SEXP graph, SEXP pairs, SEXP mode, SEXP loop } /*-------------------------------------------/ -/ igraph_similarity_inverse_log_weighted / +/ igraph_compare_communities / /-------------------------------------------*/ -SEXP R_igraph_similarity_inverse_log_weighted(SEXP graph, SEXP vids, SEXP mode) { +SEXP R_igraph_compare_communities(SEXP comm1, SEXP comm2, SEXP method) { /* Declarations */ - igraph_t c_graph; - igraph_matrix_t c_res; - igraph_vs_t c_vids; - igraph_neimode_t c_mode; + igraph_vector_int_t c_comm1; + igraph_vector_int_t c_comm2; + igraph_real_t c_res; + igraph_community_comparison_t c_method; SEXP res; SEXP r_result; /* Convert input */ - Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); - IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); - igraph_vector_int_t c_vids_data; - Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); - c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(comm1, &c_comm1)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_comm1); + IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(comm2, &c_comm2)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_comm2); + c_method = (igraph_community_comparison_t) Rf_asInteger(method); /* Call igraph */ - IGRAPH_R_CHECK(igraph_similarity_inverse_log_weighted(&c_graph, &c_res, c_vids, c_mode)); + IGRAPH_R_CHECK(igraph_compare_communities(&c_comm1, &c_comm2, &c_res, c_method)); /* Convert output */ - PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); - igraph_matrix_destroy(&c_res); + igraph_vector_int_destroy(&c_comm1); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_vids_data); - igraph_vs_destroy(&c_vids); + igraph_vector_int_destroy(&c_comm2); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=c_res; r_result = res; UNPROTECT(1); @@ -8267,145 +11890,517 @@ SEXP R_igraph_similarity_inverse_log_weighted(SEXP graph, SEXP vids, SEXP mode) } /*-------------------------------------------/ -/ igraph_similarity_jaccard / +/ igraph_community_spinglass / +/-------------------------------------------*/ +SEXP R_igraph_community_spinglass(SEXP graph, SEXP weights, SEXP spins, SEXP parupdate, SEXP starttemp, SEXP stoptemp, SEXP coolfact, SEXP update_rule, SEXP gamma, SEXP implementation, SEXP lambda) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_weights; + igraph_real_t c_modularity; + igraph_real_t c_temperature; + igraph_vector_int_t c_membership; + igraph_vector_int_t c_csize; + igraph_integer_t c_spins; + igraph_bool_t c_parupdate; + igraph_real_t c_starttemp; + igraph_real_t c_stoptemp; + igraph_real_t c_coolfact; + igraph_spincomm_update_t c_update_rule; + igraph_real_t c_gamma; + igraph_spinglass_implementation_t c_implementation; + igraph_real_t c_lambda; + SEXP modularity; + SEXP temperature; + SEXP membership; + SEXP csize; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + IGRAPH_R_CHECK(igraph_vector_int_init(&c_membership, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_membership); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_csize, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_csize); + IGRAPH_R_CHECK_INT(spins); + c_spins = (igraph_integer_t) REAL(spins)[0]; + IGRAPH_R_CHECK_BOOL(parupdate); + c_parupdate = LOGICAL(parupdate)[0]; + IGRAPH_R_CHECK_REAL(starttemp); + c_starttemp = REAL(starttemp)[0]; + IGRAPH_R_CHECK_REAL(stoptemp); + c_stoptemp = REAL(stoptemp)[0]; + IGRAPH_R_CHECK_REAL(coolfact); + c_coolfact = REAL(coolfact)[0]; + c_update_rule = (igraph_spincomm_update_t) Rf_asInteger(update_rule); + IGRAPH_R_CHECK_REAL(gamma); + c_gamma = REAL(gamma)[0]; + c_implementation = (igraph_spinglass_implementation_t) Rf_asInteger(implementation); + IGRAPH_R_CHECK_REAL(lambda); + c_lambda = REAL(lambda)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_community_spinglass(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_modularity, &c_temperature, &c_membership, &c_csize, c_spins, c_parupdate, c_starttemp, c_stoptemp, c_coolfact, c_update_rule, c_gamma, c_implementation, c_lambda)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(4)); + PROTECT(r_names=NEW_CHARACTER(4)); + PROTECT(modularity=NEW_NUMERIC(1)); + REAL(modularity)[0]=c_modularity; + PROTECT(temperature=NEW_NUMERIC(1)); + REAL(temperature)[0]=c_temperature; + PROTECT(membership=Ry_igraph_vector_int_to_SEXP(&c_membership)); + igraph_vector_int_destroy(&c_membership); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(csize=Ry_igraph_vector_int_to_SEXP(&c_csize)); + igraph_vector_int_destroy(&c_csize); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, modularity); + SET_VECTOR_ELT(r_result, 1, temperature); + SET_VECTOR_ELT(r_result, 2, membership); + SET_VECTOR_ELT(r_result, 3, csize); + SET_STRING_ELT(r_names, 0, Rf_mkChar("modularity")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("temperature")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("membership")); + SET_STRING_ELT(r_names, 3, Rf_mkChar("csize")); + SET_NAMES(r_result, r_names); + UNPROTECT(5); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_community_spinglass_single / +/-------------------------------------------*/ +SEXP R_igraph_community_spinglass_single(SEXP graph, SEXP weights, SEXP vertex, SEXP spins, SEXP update_rule, SEXP gamma) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_weights; + igraph_integer_t c_vertex; + igraph_vector_int_t c_community; + igraph_real_t c_cohesion; + igraph_real_t c_adhesion; + igraph_integer_t c_inner_links; + igraph_integer_t c_outer_links; + igraph_integer_t c_spins; + igraph_spincomm_update_t c_update_rule; + igraph_real_t c_gamma; + SEXP community; + SEXP cohesion; + SEXP adhesion; + SEXP inner_links; + SEXP outer_links; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + IGRAPH_R_CHECK_INT(vertex); + c_vertex = (igraph_integer_t) REAL(vertex)[0]; + IGRAPH_R_CHECK(igraph_vector_int_init(&c_community, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_community); + c_inner_links=0; + c_outer_links=0; + IGRAPH_R_CHECK_INT(spins); + c_spins = (igraph_integer_t) REAL(spins)[0]; + c_update_rule = (igraph_spincomm_update_t) Rf_asInteger(update_rule); + IGRAPH_R_CHECK_REAL(gamma); + c_gamma = REAL(gamma)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_community_spinglass_single(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), c_vertex, &c_community, &c_cohesion, &c_adhesion, &c_inner_links, &c_outer_links, c_spins, c_update_rule, c_gamma)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(5)); + PROTECT(r_names=NEW_CHARACTER(5)); + PROTECT(community=Ry_igraph_vector_int_to_SEXP(&c_community)); + igraph_vector_int_destroy(&c_community); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(cohesion=NEW_NUMERIC(1)); + REAL(cohesion)[0]=c_cohesion; + PROTECT(adhesion=NEW_NUMERIC(1)); + REAL(adhesion)[0]=c_adhesion; + PROTECT(inner_links=NEW_NUMERIC(1)); + REAL(inner_links)[0]=(double) c_inner_links; + PROTECT(outer_links=NEW_NUMERIC(1)); + REAL(outer_links)[0]=(double) c_outer_links; + SET_VECTOR_ELT(r_result, 0, community); + SET_VECTOR_ELT(r_result, 1, cohesion); + SET_VECTOR_ELT(r_result, 2, adhesion); + SET_VECTOR_ELT(r_result, 3, inner_links); + SET_VECTOR_ELT(r_result, 4, outer_links); + SET_STRING_ELT(r_names, 0, Rf_mkChar("community")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("cohesion")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("adhesion")); + SET_STRING_ELT(r_names, 3, Rf_mkChar("inner_links")); + SET_STRING_ELT(r_names, 4, Rf_mkChar("outer_links")); + SET_NAMES(r_result, r_names); + UNPROTECT(6); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_community_walktrap / +/-------------------------------------------*/ +SEXP R_igraph_community_walktrap(SEXP graph, SEXP weights, SEXP steps) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_weights; + igraph_integer_t c_steps; + igraph_matrix_int_t c_merges; + igraph_vector_t c_modularity; + igraph_vector_int_t c_membership; + SEXP merges; + SEXP modularity; + SEXP membership; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + IGRAPH_R_CHECK_INT(steps); + c_steps = (igraph_integer_t) REAL(steps)[0]; + IGRAPH_R_CHECK(igraph_matrix_int_init(&c_merges, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_int_destroy, &c_merges); + IGRAPH_R_CHECK(igraph_vector_init(&c_modularity, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_modularity); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_membership, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_membership); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_community_walktrap(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), c_steps, &c_merges, &c_modularity, &c_membership)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(merges=Ry_igraph_matrix_int_to_SEXP(&c_merges)); + igraph_matrix_int_destroy(&c_merges); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(modularity=Ry_igraph_vector_to_SEXP(&c_modularity)); + igraph_vector_destroy(&c_modularity); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(membership=Ry_igraph_vector_int_to_SEXP(&c_membership)); + igraph_vector_int_destroy(&c_membership); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, merges); + SET_VECTOR_ELT(r_result, 1, modularity); + SET_VECTOR_ELT(r_result, 2, membership); + SET_STRING_ELT(r_names, 0, Rf_mkChar("merges")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("modularity")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("membership")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_community_edge_betweenness / +/-------------------------------------------*/ +SEXP R_igraph_community_edge_betweenness(SEXP graph, SEXP directed, SEXP weights) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_int_t c_removed_edges; + igraph_vector_t c_edge_betweenness; + igraph_matrix_int_t c_merges; + igraph_vector_int_t c_bridges; + igraph_vector_t c_modularity; + igraph_vector_int_t c_membership; + igraph_bool_t c_directed; + igraph_vector_t c_weights; + SEXP removed_edges; + SEXP edge_betweenness; + SEXP merges; + SEXP bridges; + SEXP modularity; + SEXP membership; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_removed_edges, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_removed_edges); + IGRAPH_R_CHECK(igraph_vector_init(&c_edge_betweenness, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_edge_betweenness); + IGRAPH_R_CHECK(igraph_matrix_int_init(&c_merges, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_int_destroy, &c_merges); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_bridges, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_bridges); + IGRAPH_R_CHECK(igraph_vector_init(&c_modularity, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_modularity); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_membership, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_membership); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + /* Call igraph */ + IGRAPH_R_CHECK(igraph_community_edge_betweenness(&c_graph, &c_removed_edges, &c_edge_betweenness, &c_merges, &c_bridges, &c_modularity, &c_membership, c_directed, (Rf_isNull(weights) ? 0 : &c_weights))); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(6)); + PROTECT(r_names=NEW_CHARACTER(6)); + PROTECT(removed_edges=Ry_igraph_vector_int_to_SEXP(&c_removed_edges)); + igraph_vector_int_destroy(&c_removed_edges); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(edge_betweenness=Ry_igraph_vector_to_SEXP(&c_edge_betweenness)); + igraph_vector_destroy(&c_edge_betweenness); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(merges=Ry_igraph_matrix_int_to_SEXP(&c_merges)); + igraph_matrix_int_destroy(&c_merges); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(bridges=Ry_igraph_vector_int_to_SEXPp1(&c_bridges)); + igraph_vector_int_destroy(&c_bridges); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(modularity=Ry_igraph_vector_to_SEXP(&c_modularity)); + igraph_vector_destroy(&c_modularity); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(membership=Ry_igraph_vector_int_to_SEXP(&c_membership)); + igraph_vector_int_destroy(&c_membership); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, removed_edges); + SET_VECTOR_ELT(r_result, 1, edge_betweenness); + SET_VECTOR_ELT(r_result, 2, merges); + SET_VECTOR_ELT(r_result, 3, bridges); + SET_VECTOR_ELT(r_result, 4, modularity); + SET_VECTOR_ELT(r_result, 5, membership); + SET_STRING_ELT(r_names, 0, Rf_mkChar("removed_edges")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("edge_betweenness")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("merges")); + SET_STRING_ELT(r_names, 3, Rf_mkChar("bridges")); + SET_STRING_ELT(r_names, 4, Rf_mkChar("modularity")); + SET_STRING_ELT(r_names, 5, Rf_mkChar("membership")); + SET_NAMES(r_result, r_names); + UNPROTECT(7); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_community_eb_get_merges / /-------------------------------------------*/ -SEXP R_igraph_similarity_jaccard(SEXP graph, SEXP vids, SEXP mode, SEXP loops) { +SEXP R_igraph_community_eb_get_merges(SEXP graph, SEXP directed, SEXP edges, SEXP weights) { /* Declarations */ igraph_t c_graph; - igraph_matrix_t c_res; - igraph_vs_t c_vids; - igraph_neimode_t c_mode; - igraph_bool_t c_loops; - SEXP res; + igraph_bool_t c_directed; + igraph_vector_int_t c_edges; + igraph_vector_t c_weights; + igraph_matrix_int_t c_merges; + igraph_vector_int_t c_bridges; + igraph_vector_t c_modularity; + igraph_vector_int_t c_membership; + SEXP merges; + SEXP bridges; + SEXP modularity; + SEXP membership; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); - IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); - igraph_vector_int_t c_vids_data; - Rz_SEXP_to_igraph_vs(vids, &c_graph, &c_vids, &c_vids_data); - c_mode = (igraph_neimode_t) Rf_asInteger(mode); - IGRAPH_R_CHECK_BOOL(loops); - c_loops = LOGICAL(loops)[0]; + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + Rz_SEXP_to_vector_int_copy(edges, &c_edges); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edges); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + IGRAPH_R_CHECK(igraph_matrix_int_init(&c_merges, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_int_destroy, &c_merges); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_bridges, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_bridges); + IGRAPH_R_CHECK(igraph_vector_init(&c_modularity, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_modularity); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_membership, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_membership); /* Call igraph */ - IGRAPH_R_CHECK(igraph_similarity_jaccard(&c_graph, &c_res, c_vids, c_mode, c_loops)); + IGRAPH_R_CHECK(igraph_community_eb_get_merges(&c_graph, c_directed, &c_edges, (Rf_isNull(weights) ? 0 : &c_weights), &c_merges, &c_bridges, &c_modularity, &c_membership)); /* Convert output */ - PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); - igraph_matrix_destroy(&c_res); + PROTECT(r_result=NEW_LIST(4)); + PROTECT(r_names=NEW_CHARACTER(4)); + igraph_vector_int_destroy(&c_edges); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_vids_data); - igraph_vs_destroy(&c_vids); - r_result = res; + PROTECT(merges=Ry_igraph_matrix_int_to_SEXP(&c_merges)); + igraph_matrix_int_destroy(&c_merges); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(bridges=Ry_igraph_vector_int_to_SEXPp1(&c_bridges)); + igraph_vector_int_destroy(&c_bridges); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(modularity=Ry_igraph_vector_to_SEXP(&c_modularity)); + igraph_vector_destroy(&c_modularity); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(membership=Ry_igraph_vector_int_to_SEXP(&c_membership)); + igraph_vector_int_destroy(&c_membership); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, merges); + SET_VECTOR_ELT(r_result, 1, bridges); + SET_VECTOR_ELT(r_result, 2, modularity); + SET_VECTOR_ELT(r_result, 3, membership); + SET_STRING_ELT(r_names, 0, Rf_mkChar("merges")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("bridges")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("modularity")); + SET_STRING_ELT(r_names, 3, Rf_mkChar("membership")); + SET_NAMES(r_result, r_names); + UNPROTECT(5); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_similarity_jaccard_es / +/ igraph_community_fastgreedy / /-------------------------------------------*/ -SEXP R_igraph_similarity_jaccard_es(SEXP graph, SEXP es, SEXP mode, SEXP loops) { +SEXP R_igraph_community_fastgreedy(SEXP graph, SEXP weights) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_res; - igraph_es_t c_es; - igraph_neimode_t c_mode; - igraph_bool_t c_loops; - SEXP res; + igraph_vector_t c_weights; + igraph_matrix_int_t c_merges; + igraph_vector_t c_modularity; + igraph_vector_int_t c_membership; + SEXP merges; + SEXP modularity; + SEXP membership; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_res); - igraph_vector_int_t c_es_data; - IGRAPH_R_CHECK(Rz_SEXP_to_igraph_es(es, &c_graph, &c_es, &c_es_data)); - c_mode = (igraph_neimode_t) Rf_asInteger(mode); - IGRAPH_R_CHECK_BOOL(loops); - c_loops = LOGICAL(loops)[0]; + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + IGRAPH_R_CHECK(igraph_matrix_int_init(&c_merges, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_int_destroy, &c_merges); + IGRAPH_R_CHECK(igraph_vector_init(&c_modularity, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_modularity); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_membership, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_membership); /* Call igraph */ - IGRAPH_R_CHECK(igraph_similarity_jaccard_es(&c_graph, &c_res, c_es, c_mode, c_loops)); + IGRAPH_R_CHECK(igraph_community_fastgreedy(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_merges, &c_modularity, &c_membership)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); - igraph_vector_destroy(&c_res); + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(merges=Ry_igraph_matrix_int_to_SEXP(&c_merges)); + igraph_matrix_int_destroy(&c_merges); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_es_data); - igraph_es_destroy(&c_es); - r_result = res; + PROTECT(modularity=Ry_igraph_vector_to_SEXP(&c_modularity)); + igraph_vector_destroy(&c_modularity); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(membership=Ry_igraph_vector_int_to_SEXP(&c_membership)); + igraph_vector_int_destroy(&c_membership); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, merges); + SET_VECTOR_ELT(r_result, 1, modularity); + SET_VECTOR_ELT(r_result, 2, membership); + SET_STRING_ELT(r_names, 0, Rf_mkChar("merges")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("modularity")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("membership")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_similarity_jaccard_pairs / +/ igraph_community_to_membership / /-------------------------------------------*/ -SEXP R_igraph_similarity_jaccard_pairs(SEXP graph, SEXP pairs, SEXP mode, SEXP loops) { +SEXP R_igraph_community_to_membership(SEXP merges, SEXP nodes, SEXP steps) { /* Declarations */ - igraph_t c_graph; - igraph_vector_t c_res; - igraph_vector_int_t c_pairs; - igraph_neimode_t c_mode; - igraph_bool_t c_loops; - SEXP res; + igraph_matrix_int_t c_merges; + igraph_integer_t c_nodes; + igraph_integer_t c_steps; + igraph_vector_int_t c_membership; + igraph_vector_int_t c_csize; + SEXP membership; + SEXP csize; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ - Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_res); - Rz_SEXP_to_vector_int_copy(pairs, &c_pairs); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_pairs); - c_mode = (igraph_neimode_t) Rf_asInteger(mode); - IGRAPH_R_CHECK_BOOL(loops); - c_loops = LOGICAL(loops)[0]; + Rz_SEXP_to_matrix_int(merges, &c_merges); + IGRAPH_FINALLY(igraph_matrix_int_destroy, &c_merges); + IGRAPH_R_CHECK_INT(nodes); + c_nodes = (igraph_integer_t) REAL(nodes)[0]; + IGRAPH_R_CHECK_INT(steps); + c_steps = (igraph_integer_t) REAL(steps)[0]; + IGRAPH_R_CHECK(igraph_vector_int_init(&c_membership, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_membership); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_csize, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_csize); /* Call igraph */ - IGRAPH_R_CHECK(igraph_similarity_jaccard_pairs(&c_graph, &c_res, &c_pairs, c_mode, c_loops)); + IGRAPH_R_CHECK(igraph_community_to_membership(&c_merges, c_nodes, c_steps, &c_membership, &c_csize)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); - igraph_vector_destroy(&c_res); + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + igraph_matrix_int_destroy(&c_merges); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_pairs); + PROTECT(membership=Ry_igraph_vector_int_to_SEXP(&c_membership)); + igraph_vector_int_destroy(&c_membership); IGRAPH_FINALLY_CLEAN(1); - r_result = res; + PROTECT(csize=Ry_igraph_vector_int_to_SEXP(&c_csize)); + igraph_vector_int_destroy(&c_csize); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, membership); + SET_VECTOR_ELT(r_result, 1, csize); + SET_STRING_ELT(r_names, 0, Rf_mkChar("membership")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("csize")); + SET_NAMES(r_result, r_names); + UNPROTECT(3); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_compare_communities / +/ igraph_le_community_to_membership / /-------------------------------------------*/ -SEXP R_igraph_compare_communities(SEXP comm1, SEXP comm2, SEXP method) { +SEXP R_igraph_le_community_to_membership(SEXP merges, SEXP steps, SEXP membership) { /* Declarations */ - igraph_vector_int_t c_comm1; - igraph_vector_int_t c_comm2; - igraph_real_t c_res; - igraph_community_comparison_t c_method; - SEXP res; + igraph_matrix_int_t c_merges; + igraph_integer_t c_steps; + igraph_vector_int_t c_membership; + igraph_vector_int_t c_csize; + SEXP csize; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ - IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(comm1, &c_comm1)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_comm1); - IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(comm2, &c_comm2)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_comm2); - c_method = (igraph_community_comparison_t) Rf_asInteger(method); + Rz_SEXP_to_matrix_int(merges, &c_merges); + IGRAPH_FINALLY(igraph_matrix_int_destroy, &c_merges); + IGRAPH_R_CHECK_INT(steps); + c_steps = (igraph_integer_t) REAL(steps)[0]; + IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(membership, &c_membership)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_membership); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_csize, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_csize); /* Call igraph */ - IGRAPH_R_CHECK(igraph_compare_communities(&c_comm1, &c_comm2, &c_res, c_method)); + IGRAPH_R_CHECK(igraph_le_community_to_membership(&c_merges, c_steps, &c_membership, &c_csize)); /* Convert output */ - igraph_vector_int_destroy(&c_comm1); + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + igraph_matrix_int_destroy(&c_merges); IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_comm2); + PROTECT(membership=Ry_igraph_vector_int_to_SEXP(&c_membership)); + igraph_vector_int_destroy(&c_membership); IGRAPH_FINALLY_CLEAN(1); - PROTECT(res=NEW_NUMERIC(1)); - REAL(res)[0]=c_res; - r_result = res; + PROTECT(csize=Ry_igraph_vector_int_to_SEXP(&c_csize)); + igraph_vector_int_destroy(&c_csize); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, membership); + SET_VECTOR_ELT(r_result, 1, csize); + SET_STRING_ELT(r_names, 0, Rf_mkChar("membership")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("csize")); + SET_NAMES(r_result, r_names); + UNPROTECT(3); UNPROTECT(1); return(r_result); @@ -8451,37 +12446,173 @@ SEXP R_igraph_modularity(SEXP graph, SEXP membership, SEXP weights, SEXP resolut } /*-------------------------------------------/ -/ igraph_modularity_matrix / +/ igraph_modularity_matrix / +/-------------------------------------------*/ +SEXP R_igraph_modularity_matrix(SEXP graph, SEXP weights, SEXP resolution, SEXP directed) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_weights; + igraph_real_t c_resolution; + igraph_matrix_t c_modmat; + igraph_bool_t c_directed; + SEXP modmat; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + IGRAPH_R_CHECK_REAL(resolution); + c_resolution = REAL(resolution)[0]; + IGRAPH_R_CHECK(igraph_matrix_init(&c_modmat, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_modmat); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_modularity_matrix(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), c_resolution, &c_modmat, c_directed)); + + /* Convert output */ + PROTECT(modmat=Ry_igraph_matrix_to_SEXP(&c_modmat)); + igraph_matrix_destroy(&c_modmat); + IGRAPH_FINALLY_CLEAN(1); + r_result = modmat; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_reindex_membership / +/-------------------------------------------*/ +SEXP R_igraph_reindex_membership(SEXP membership) { + /* Declarations */ + igraph_vector_int_t c_membership; + igraph_vector_int_t c_new_to_old; + igraph_integer_t c_nb_clusters; + SEXP new_to_old; + SEXP nb_clusters; + + SEXP r_result, r_names; + /* Convert input */ + IGRAPH_R_CHECK(Rz_SEXP_to_vector_int_copy(membership, &c_membership)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_membership); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_new_to_old, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_new_to_old); + c_nb_clusters=0; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_reindex_membership(&c_membership, &c_new_to_old, &c_nb_clusters)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(membership=Ry_igraph_vector_int_to_SEXP(&c_membership)); + igraph_vector_int_destroy(&c_membership); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(new_to_old=Ry_igraph_vector_int_to_SEXPp1(&c_new_to_old)); + igraph_vector_int_destroy(&c_new_to_old); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(nb_clusters=NEW_NUMERIC(1)); + REAL(nb_clusters)[0]=(double) c_nb_clusters; + SET_VECTOR_ELT(r_result, 0, membership); + SET_VECTOR_ELT(r_result, 1, new_to_old); + SET_VECTOR_ELT(r_result, 2, nb_clusters); + SET_STRING_ELT(r_names, 0, Rf_mkChar("membership")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("new_to_old")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("nb_clusters")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_community_leading_eigenvector / /-------------------------------------------*/ -SEXP R_igraph_modularity_matrix(SEXP graph, SEXP weights, SEXP resolution, SEXP directed) { +SEXP R_igraph_community_leading_eigenvector(SEXP graph, SEXP weights, SEXP steps, SEXP options, SEXP start, SEXP callback) { /* Declarations */ igraph_t c_graph; igraph_vector_t c_weights; - igraph_real_t c_resolution; - igraph_matrix_t c_modmat; - igraph_bool_t c_directed; - SEXP modmat; + igraph_matrix_int_t c_merges; + igraph_vector_int_t c_membership; + igraph_integer_t c_steps; + igraph_arpack_options_t c_options; + igraph_real_t c_modularity; + igraph_bool_t c_start; + igraph_vector_t c_eigenvalues; + igraph_vector_list_t c_eigenvectors; + igraph_vector_t c_history; + igraph_community_leading_eigenvector_callback_t c_callback; - SEXP r_result; + SEXP merges; + SEXP membership; + SEXP modularity; + SEXP eigenvalues; + SEXP eigenvectors; + SEXP history; + + SEXP r_result, r_names; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); if (!Rf_isNull(weights)) { Rz_SEXP_to_vector(weights, &c_weights); } - IGRAPH_R_CHECK_REAL(resolution); - c_resolution = REAL(resolution)[0]; - IGRAPH_R_CHECK(igraph_matrix_init(&c_modmat, 0, 0)); - IGRAPH_FINALLY(igraph_matrix_destroy, &c_modmat); - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; + IGRAPH_R_CHECK(igraph_matrix_int_init(&c_merges, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_int_destroy, &c_merges); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_membership, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_membership); + IGRAPH_R_CHECK_INT(steps); + c_steps = (igraph_integer_t) REAL(steps)[0]; + Rz_SEXP_to_igraph_arpack_options(options, &c_options); + IGRAPH_R_CHECK_BOOL(start); + c_start = LOGICAL(start)[0]; + IGRAPH_R_CHECK(igraph_vector_init(&c_eigenvalues, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_eigenvalues); + IGRAPH_R_CHECK(igraph_vector_list_init(&c_eigenvectors, 0)); + IGRAPH_FINALLY(igraph_vector_list_destroy, &c_eigenvectors); + IGRAPH_R_CHECK(igraph_vector_init(&c_history, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_history); /* Call igraph */ - IGRAPH_R_CHECK(igraph_modularity_matrix(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), c_resolution, &c_modmat, c_directed)); + IGRAPH_R_CHECK(igraph_community_leading_eigenvector(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_merges, &c_membership, c_steps, &c_options, &c_modularity, c_start, &c_eigenvalues, &c_eigenvectors, &c_history, (Rf_isNull(callback) ? 0 : c_callback), 0)); /* Convert output */ - PROTECT(modmat=Ry_igraph_matrix_to_SEXP(&c_modmat)); - igraph_matrix_destroy(&c_modmat); + PROTECT(r_result=NEW_LIST(7)); + PROTECT(r_names=NEW_CHARACTER(7)); + PROTECT(merges=Ry_igraph_matrix_int_to_SEXP(&c_merges)); + igraph_matrix_int_destroy(&c_merges); IGRAPH_FINALLY_CLEAN(1); - r_result = modmat; + PROTECT(membership=Ry_igraph_vector_int_to_SEXP(&c_membership)); + igraph_vector_int_destroy(&c_membership); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(options=Ry_igraph_arpack_options_to_SEXP(&c_options)); + PROTECT(modularity=NEW_NUMERIC(1)); + REAL(modularity)[0]=c_modularity; + PROTECT(eigenvalues=Ry_igraph_vector_to_SEXP(&c_eigenvalues)); + igraph_vector_destroy(&c_eigenvalues); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(eigenvectors=Rx_igraph_vectorlist_to_SEXP(&c_eigenvectors)); + igraph_vector_list_destroy(&c_eigenvectors); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(history=Ry_igraph_vector_to_SEXP(&c_history)); + igraph_vector_destroy(&c_history); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, merges); + SET_VECTOR_ELT(r_result, 1, membership); + SET_VECTOR_ELT(r_result, 2, options); + SET_VECTOR_ELT(r_result, 3, modularity); + SET_VECTOR_ELT(r_result, 4, eigenvalues); + SET_VECTOR_ELT(r_result, 5, eigenvectors); + SET_VECTOR_ELT(r_result, 6, history); + SET_STRING_ELT(r_names, 0, Rf_mkChar("merges")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("membership")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("options")); + SET_STRING_ELT(r_names, 3, Rf_mkChar("modularity")); + SET_STRING_ELT(r_names, 4, Rf_mkChar("eigenvalues")); + SET_STRING_ELT(r_names, 5, Rf_mkChar("eigenvectors")); + SET_STRING_ELT(r_names, 6, Rf_mkChar("history")); + SET_NAMES(r_result, r_names); + UNPROTECT(8); UNPROTECT(1); return(r_result); @@ -8826,6 +12957,111 @@ SEXP R_igraph_community_infomap(SEXP graph, SEXP e_weights, SEXP v_weights, SEXP return(r_result); } +/*-------------------------------------------/ +/ igraph_community_voronoi / +/-------------------------------------------*/ +SEXP R_igraph_community_voronoi(SEXP graph, SEXP lengths, SEXP weights, SEXP mode, SEXP radius) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_int_t c_membership; + igraph_vector_int_t c_generators; + igraph_real_t c_modularity; + igraph_vector_t c_lengths; + igraph_vector_t c_weights; + igraph_neimode_t c_mode; + igraph_real_t c_radius; + SEXP membership; + SEXP generators; + SEXP modularity; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_membership, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_membership); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_generators, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_generators); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + c_mode = (igraph_neimode_t) Rf_asInteger(mode); + IGRAPH_R_CHECK_REAL(radius); + c_radius = REAL(radius)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_community_voronoi(&c_graph, &c_membership, &c_generators, &c_modularity, (Rf_isNull(lengths) ? 0 : c_lengths), (Rf_isNull(weights) ? 0 : &c_weights), c_mode, c_radius)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(membership=Ry_igraph_vector_int_to_SEXP(&c_membership)); + igraph_vector_int_destroy(&c_membership); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(generators=Ry_igraph_vector_int_to_SEXPp1(&c_generators)); + igraph_vector_int_destroy(&c_generators); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(modularity=NEW_NUMERIC(1)); + REAL(modularity)[0]=c_modularity; + SET_VECTOR_ELT(r_result, 0, membership); + SET_VECTOR_ELT(r_result, 1, generators); + SET_VECTOR_ELT(r_result, 2, modularity); + SET_STRING_ELT(r_names, 0, Rf_mkChar("membership")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("generators")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("modularity")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_graphlets / +/-------------------------------------------*/ +SEXP R_igraph_graphlets(SEXP graph, SEXP weights, SEXP niter) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_weights; + igraph_vector_int_list_t c_cliques; + igraph_vector_t c_Mu; + igraph_integer_t c_niter; + SEXP cliques; + SEXP Mu; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_cliques, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_cliques); + IGRAPH_R_CHECK(igraph_vector_init(&c_Mu, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_Mu); + IGRAPH_R_CHECK_INT(niter); + c_niter = (igraph_integer_t) REAL(niter)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_graphlets(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_cliques, &c_Mu, c_niter)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + PROTECT(cliques=Ry_igraph_vector_int_list_to_SEXPp1(&c_cliques)); + igraph_vector_int_list_destroy(&c_cliques); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(Mu=Ry_igraph_vector_to_SEXP(&c_Mu)); + igraph_vector_destroy(&c_Mu); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, cliques); + SET_VECTOR_ELT(r_result, 1, Mu); + SET_STRING_ELT(r_names, 0, Rf_mkChar("cliques")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("Mu")); + SET_NAMES(r_result, r_names); + UNPROTECT(3); + + UNPROTECT(1); + return(r_result); +} + /*-------------------------------------------/ / igraph_graphlets_candidate_basis / /-------------------------------------------*/ @@ -9271,6 +13507,41 @@ SEXP R_igraph_from_hrg_dendrogram(SEXP hrg) { return(r_result); } +/*-------------------------------------------/ +/ igraph_get_adjacency / +/-------------------------------------------*/ +SEXP R_igraph_get_adjacency(SEXP graph, SEXP type, SEXP weights, SEXP loops) { + /* Declarations */ + igraph_t c_graph; + igraph_matrix_t c_res; + igraph_get_adjacency_t c_type; + igraph_vector_t c_weights; + igraph_loops_t c_loops; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); + c_type = (igraph_get_adjacency_t) Rf_asInteger(type); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + c_loops = (igraph_loops_t) Rf_asInteger(loops); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_get_adjacency(&c_graph, &c_res, c_type, (Rf_isNull(weights) ? 0 : &c_weights), c_loops)); + + /* Convert output */ + PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); + igraph_matrix_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + /*-------------------------------------------/ / igraph_get_adjacency_sparse / /-------------------------------------------*/ @@ -9398,29 +13669,132 @@ SEXP R_igraph_get_stochastic_sparse(SEXP graph, SEXP column_wise, SEXP weights) PROTECT(sparsemat=Ry_igraph_sparsemat_to_SEXP(&c_sparsemat)); igraph_sparsemat_destroy(&c_sparsemat); IGRAPH_FINALLY_CLEAN(1); - r_result = sparsemat; + r_result = sparsemat; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_to_directed / +/-------------------------------------------*/ +SEXP R_igraph_to_directed(SEXP graph, SEXP mode) { + /* Declarations */ + igraph_t c_graph; + igraph_to_directed_t c_mode; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph_copy(graph, &c_graph); + IGRAPH_FINALLY(igraph_destroy, &c_graph); + c_mode = (igraph_to_directed_t) Rf_asInteger(mode); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_to_directed(&c_graph, c_mode)); + + /* Convert output */ + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_to_undirected / +/-------------------------------------------*/ +SEXP R_igraph_to_undirected(SEXP graph, SEXP mode, SEXP edge_attr_comb) { + /* Declarations */ + igraph_t c_graph; + igraph_to_undirected_t c_mode; + igraph_attribute_combination_t c_edge_attr_comb; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph_copy(graph, &c_graph); + IGRAPH_FINALLY(igraph_destroy, &c_graph); + c_mode = (igraph_to_undirected_t) Rf_asInteger(mode); + Rz_SEXP_to_attr_comb(edge_attr_comb, &c_edge_attr_comb); + IGRAPH_FINALLY(igraph_attribute_combination_destroy, &c_edge_attr_comb); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_to_undirected(&c_graph, c_mode, &c_edge_attr_comb)); + + /* Convert output */ + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + igraph_attribute_combination_destroy(&c_edge_attr_comb); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_read_graph_edgelist / +/-------------------------------------------*/ +SEXP R_igraph_read_graph_edgelist(SEXP instream, SEXP n, SEXP directed) { + /* Declarations */ + igraph_t c_graph; + FILE* c_instream; + igraph_integer_t c_n; + igraph_bool_t c_directed; + SEXP graph; + + SEXP r_result; + /* Convert input */ + c_instream = Ry_igraph_fopen_read(instream); + IGRAPH_FINALLY(fclose, c_instream); + 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_read_graph_edgelist(&c_graph, c_instream, c_n, c_directed)); + + /* Convert output */ + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_to_directed / +/ igraph_read_graph_ncol / /-------------------------------------------*/ -SEXP R_igraph_to_directed(SEXP graph, SEXP mode) { +SEXP R_igraph_read_graph_ncol(SEXP instream, SEXP predefnames, SEXP names, SEXP weights, SEXP directed) { /* Declarations */ igraph_t c_graph; - igraph_to_directed_t c_mode; + FILE* c_instream; + igraph_strvector_t c_predefnames; + igraph_bool_t c_names; + igraph_add_weights_t c_weights; + igraph_bool_t c_directed; + SEXP graph; SEXP r_result; /* Convert input */ - Rz_SEXP_to_igraph_copy(graph, &c_graph); - IGRAPH_FINALLY(igraph_destroy, &c_graph); - c_mode = (igraph_to_directed_t) Rf_asInteger(mode); + c_instream = Ry_igraph_fopen_read(instream); + IGRAPH_FINALLY(fclose, c_instream); + if (!Rf_isNull(predefnames)) { + Rx_igraph_SEXP_to_strvector(predefnames, &c_predefnames); + } + IGRAPH_R_CHECK_BOOL(names); + c_names = LOGICAL(names)[0]; + c_weights = (igraph_add_weights_t) Rf_asInteger(weights); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_to_directed(&c_graph, c_mode)); + IGRAPH_R_CHECK(igraph_read_graph_ncol(&c_graph, c_instream, (Rf_isNull(predefnames) ? 0 : &c_predefnames), c_names, c_weights, c_directed)); /* Convert output */ + IGRAPH_FINALLY(igraph_destroy, &c_graph); PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); IGRAPH_I_DESTROY(&c_graph); IGRAPH_FINALLY_CLEAN(1); @@ -9431,30 +13805,34 @@ SEXP R_igraph_to_directed(SEXP graph, SEXP mode) { } /*-------------------------------------------/ -/ igraph_to_undirected / +/ igraph_read_graph_lgl / /-------------------------------------------*/ -SEXP R_igraph_to_undirected(SEXP graph, SEXP mode, SEXP edge_attr_comb) { +SEXP R_igraph_read_graph_lgl(SEXP instream, SEXP names, SEXP weights, SEXP directed) { /* Declarations */ igraph_t c_graph; - igraph_to_undirected_t c_mode; - igraph_attribute_combination_t c_edge_attr_comb; + FILE* c_instream; + igraph_bool_t c_names; + igraph_add_weights_t c_weights; + igraph_bool_t c_directed; + SEXP graph; SEXP r_result; /* Convert input */ - Rz_SEXP_to_igraph_copy(graph, &c_graph); - IGRAPH_FINALLY(igraph_destroy, &c_graph); - c_mode = (igraph_to_undirected_t) Rf_asInteger(mode); - Rz_SEXP_to_attr_comb(edge_attr_comb, &c_edge_attr_comb); - IGRAPH_FINALLY(igraph_attribute_combination_destroy, &c_edge_attr_comb); + c_instream = Ry_igraph_fopen_read(instream); + IGRAPH_FINALLY(fclose, c_instream); + IGRAPH_R_CHECK_BOOL(names); + c_names = LOGICAL(names)[0]; + c_weights = (igraph_add_weights_t) Rf_asInteger(weights); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_to_undirected(&c_graph, c_mode, &c_edge_attr_comb)); + IGRAPH_R_CHECK(igraph_read_graph_lgl(&c_graph, c_instream, c_names, c_weights, c_directed)); /* Convert output */ + IGRAPH_FINALLY(igraph_destroy, &c_graph); PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); IGRAPH_I_DESTROY(&c_graph); IGRAPH_FINALLY_CLEAN(1); - igraph_attribute_combination_destroy(&c_edge_attr_comb); - IGRAPH_FINALLY_CLEAN(1); r_result = graph; UNPROTECT(1); @@ -9518,6 +13896,82 @@ SEXP R_igraph_read_graph_graphml(SEXP instream, SEXP index) { return(r_result); } +/*-------------------------------------------/ +/ igraph_read_graph_dimacs_flow / +/-------------------------------------------*/ +SEXP R_igraph_read_graph_dimacs_flow(SEXP instream, SEXP directed) { + /* Declarations */ + igraph_t c_graph; + FILE* c_instream; + igraph_strvector_t c_problem; + igraph_vector_int_t c_label; + igraph_integer_t c_source; + igraph_integer_t c_target; + igraph_vector_t c_capacity; + igraph_bool_t c_directed; + SEXP graph; + SEXP problem; + SEXP label; + SEXP source; + SEXP target; + SEXP capacity; + + SEXP r_result, r_names; + /* Convert input */ + c_instream = Ry_igraph_fopen_read(instream); + IGRAPH_FINALLY(fclose, c_instream); + IGRAPH_R_CHECK(igraph_strvector_init(&c_problem, 0)); + IGRAPH_FINALLY(igraph_strvector_destroy, &c_problem); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_label, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_label); + c_source=0; + c_target=0; + IGRAPH_R_CHECK(igraph_vector_init(&c_capacity, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_capacity); + IGRAPH_R_CHECK_BOOL(directed); + c_directed = LOGICAL(directed)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_read_graph_dimacs_flow(&c_graph, c_instream, &c_problem, &c_label, &c_source, &c_target, &c_capacity, c_directed)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(6)); + PROTECT(r_names=NEW_CHARACTER(6)); + IGRAPH_FINALLY(igraph_destroy, &c_graph); + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(problem=Rx_igraph_strvector_to_SEXP(&c_problem)); + igraph_strvector_destroy(&c_problem); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(label=Ry_igraph_vector_int_to_SEXP(&c_label)); + igraph_vector_int_destroy(&c_label); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(source=NEW_NUMERIC(1)); + REAL(source)[0]=(double) c_source; + PROTECT(target=NEW_NUMERIC(1)); + REAL(target)[0]=(double) c_target; + PROTECT(capacity=Ry_igraph_vector_to_SEXP(&c_capacity)); + igraph_vector_destroy(&c_capacity); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, graph); + SET_VECTOR_ELT(r_result, 1, problem); + SET_VECTOR_ELT(r_result, 2, label); + SET_VECTOR_ELT(r_result, 3, source); + SET_VECTOR_ELT(r_result, 4, target); + SET_VECTOR_ELT(r_result, 5, capacity); + SET_STRING_ELT(r_names, 0, Rf_mkChar("graph")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("problem")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("label")); + SET_STRING_ELT(r_names, 3, Rf_mkChar("source")); + SET_STRING_ELT(r_names, 4, Rf_mkChar("target")); + SET_STRING_ELT(r_names, 5, Rf_mkChar("capacity")); + SET_NAMES(r_result, r_names); + UNPROTECT(7); + + UNPROTECT(1); + return(r_result); +} + /*-------------------------------------------/ / igraph_read_graph_graphdb / /-------------------------------------------*/ @@ -9624,6 +14078,61 @@ SEXP R_igraph_write_graph_edgelist(SEXP graph, SEXP outstream) { + return(R_NilValue); +} + +/*-------------------------------------------/ +/ igraph_write_graph_ncol / +/-------------------------------------------*/ +SEXP R_igraph_write_graph_ncol(SEXP graph, SEXP outstream, SEXP names, SEXP weights) { + /* Declarations */ + igraph_t c_graph; + FILE* c_outstream; + const char* c_names; + const char* c_weights; + + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + c_outstream = Ry_igraph_fopen_write(outstream); + IGRAPH_FINALLY(fclose, c_outstream); + c_names = Rf_translateCharUTF8(STRING_ELT(names, 0)); + c_weights = Rf_translateCharUTF8(STRING_ELT(weights, 0)); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_write_graph_ncol(&c_graph, c_outstream, c_names, c_weights)); + + /* Convert output */ + + + + return(R_NilValue); +} + +/*-------------------------------------------/ +/ igraph_write_graph_lgl / +/-------------------------------------------*/ +SEXP R_igraph_write_graph_lgl(SEXP graph, SEXP outstream, SEXP names, SEXP weights, SEXP isolates) { + /* Declarations */ + igraph_t c_graph; + FILE* c_outstream; + const char* c_names; + const char* c_weights; + igraph_bool_t c_isolates; + + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + c_outstream = Ry_igraph_fopen_write(outstream); + IGRAPH_FINALLY(fclose, c_outstream); + c_names = Rf_translateCharUTF8(STRING_ELT(names, 0)); + c_weights = Rf_translateCharUTF8(STRING_ELT(weights, 0)); + IGRAPH_R_CHECK_BOOL(isolates); + c_isolates = LOGICAL(isolates)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_write_graph_lgl(&c_graph, c_outstream, c_names, c_weights, c_isolates)); + + /* Convert output */ + + + return(R_NilValue); } @@ -9700,6 +14209,39 @@ SEXP R_igraph_write_graph_pajek(SEXP graph, SEXP outstream) { return(R_NilValue); } +/*-------------------------------------------/ +/ igraph_write_graph_dimacs_flow / +/-------------------------------------------*/ +SEXP R_igraph_write_graph_dimacs_flow(SEXP graph, SEXP outstream, SEXP source, SEXP target, SEXP capacity) { + /* Declarations */ + igraph_t c_graph; + FILE* c_outstream; + igraph_integer_t c_source; + igraph_integer_t c_target; + igraph_vector_t c_capacity; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph_copy(graph, &c_graph); + IGRAPH_FINALLY(igraph_destroy, &c_graph); + c_outstream = Ry_igraph_fopen_write(outstream); + IGRAPH_FINALLY(fclose, c_outstream); + c_source = (igraph_integer_t) REAL(source)[0]; + c_target = (igraph_integer_t) REAL(target)[0]; + Rz_SEXP_to_vector(capacity, &c_capacity); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_write_graph_dimacs_flow(&c_graph, c_outstream, c_source, c_target, &c_capacity)); + + /* Convert output */ + PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); + IGRAPH_I_DESTROY(&c_graph); + IGRAPH_FINALLY_CLEAN(1); + r_result = graph; + + UNPROTECT(1); + return(r_result); +} + /*-------------------------------------------/ / igraph_write_graph_gml / /-------------------------------------------*/ @@ -10324,38 +14866,154 @@ SEXP R_igraph_disjoint_union(SEXP left, SEXP right) { return(r_result); } +/*-------------------------------------------/ +/ igraph_disjoint_union_many / +/-------------------------------------------*/ +SEXP R_igraph_disjoint_union_many(SEXP graphs) { + /* Declarations */ + igraph_t c_res; + igraph_vector_ptr_t c_graphs; + SEXP res; + + SEXP r_result; + /* Convert input */ + + /* Call igraph */ + IGRAPH_R_CHECK(igraph_disjoint_union_many(&c_res, c_graphs)); + + /* Convert output */ + IGRAPH_FINALLY(igraph_destroy, &c_res); + PROTECT(res=Ry_igraph_to_SEXP(&c_res)); + IGRAPH_I_DESTROY(&c_res); + IGRAPH_FINALLY_CLEAN(1); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + /*-------------------------------------------/ / igraph_join / /-------------------------------------------*/ SEXP R_igraph_join(SEXP left, SEXP right) { /* Declarations */ igraph_t c_res; - igraph_t c_left; - igraph_t c_right; + igraph_t c_left; + igraph_t c_right; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(left, &c_left); + Rz_SEXP_to_igraph(right, &c_right); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_join(&c_res, &c_left, &c_right)); + + /* Convert output */ + IGRAPH_FINALLY(igraph_destroy, &c_res); + PROTECT(res=Ry_igraph_to_SEXP(&c_res)); + IGRAPH_I_DESTROY(&c_res); + IGRAPH_FINALLY_CLEAN(1); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_union / +/-------------------------------------------*/ +SEXP R_igraph_union(SEXP left, SEXP right) { + /* Declarations */ + igraph_t c_res; + igraph_t c_left; + igraph_t c_right; + igraph_vector_int_t c_edge_map_left; + igraph_vector_int_t c_edge_map_right; + SEXP res; + SEXP edge_map_left; + SEXP edge_map_right; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_igraph(left, &c_left); + Rz_SEXP_to_igraph(right, &c_right); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_edge_map_left, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edge_map_left); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_edge_map_right, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edge_map_right); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_union(&c_res, &c_left, &c_right, &c_edge_map_left, &c_edge_map_right)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + IGRAPH_FINALLY(igraph_destroy, &c_res); + PROTECT(res=Ry_igraph_to_SEXP(&c_res)); + IGRAPH_I_DESTROY(&c_res); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(edge_map_left=Ry_igraph_vector_int_to_SEXPp1(&c_edge_map_left)); + igraph_vector_int_destroy(&c_edge_map_left); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(edge_map_right=Ry_igraph_vector_int_to_SEXPp1(&c_edge_map_right)); + igraph_vector_int_destroy(&c_edge_map_right); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, res); + SET_VECTOR_ELT(r_result, 1, edge_map_left); + SET_VECTOR_ELT(r_result, 2, edge_map_right); + SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("edge_map_left")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("edge_map_right")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_union_many / +/-------------------------------------------*/ +SEXP R_igraph_union_many(SEXP graphs) { + /* Declarations */ + igraph_t c_res; + igraph_vector_ptr_t c_graphs; + igraph_vector_int_list_t c_edgemaps; SEXP res; + SEXP edgemaps; - SEXP r_result; + SEXP r_result, r_names; /* Convert input */ - Rz_SEXP_to_igraph(left, &c_left); - Rz_SEXP_to_igraph(right, &c_right); + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_edgemaps, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_edgemaps); /* Call igraph */ - IGRAPH_R_CHECK(igraph_join(&c_res, &c_left, &c_right)); + IGRAPH_R_CHECK(igraph_union_many(&c_res, c_graphs, &c_edgemaps)); /* Convert output */ + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); IGRAPH_FINALLY(igraph_destroy, &c_res); PROTECT(res=Ry_igraph_to_SEXP(&c_res)); IGRAPH_I_DESTROY(&c_res); IGRAPH_FINALLY_CLEAN(1); - r_result = res; + PROTECT(edgemaps=Ry_igraph_vector_int_list_to_SEXP(&c_edgemaps)); + igraph_vector_int_list_destroy(&c_edgemaps); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, res); + SET_VECTOR_ELT(r_result, 1, edgemaps); + SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("edgemaps")); + SET_NAMES(r_result, r_names); + UNPROTECT(3); UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_union / +/ igraph_intersection / /-------------------------------------------*/ -SEXP R_igraph_union(SEXP left, SEXP right) { +SEXP R_igraph_intersection(SEXP left, SEXP right) { /* Declarations */ igraph_t c_res; igraph_t c_left; @@ -10375,7 +15033,7 @@ SEXP R_igraph_union(SEXP left, SEXP right) { IGRAPH_R_CHECK(igraph_vector_int_init(&c_edge_map_right, 0)); IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edge_map_right); /* Call igraph */ - IGRAPH_R_CHECK(igraph_union(&c_res, &c_left, &c_right, &c_edge_map_left, &c_edge_map_right)); + IGRAPH_R_CHECK(igraph_intersection(&c_res, &c_left, &c_right, &c_edge_map_left, &c_edge_map_right)); /* Convert output */ PROTECT(r_result=NEW_LIST(3)); @@ -10404,51 +15062,39 @@ SEXP R_igraph_union(SEXP left, SEXP right) { } /*-------------------------------------------/ -/ igraph_intersection / +/ igraph_intersection_many / /-------------------------------------------*/ -SEXP R_igraph_intersection(SEXP left, SEXP right) { +SEXP R_igraph_intersection_many(SEXP graphs) { /* Declarations */ igraph_t c_res; - igraph_t c_left; - igraph_t c_right; - igraph_vector_int_t c_edge_map_left; - igraph_vector_int_t c_edge_map_right; + igraph_vector_ptr_t c_graphs; + igraph_vector_int_list_t c_edgemaps; SEXP res; - SEXP edge_map_left; - SEXP edge_map_right; + SEXP edgemaps; SEXP r_result, r_names; /* Convert input */ - Rz_SEXP_to_igraph(left, &c_left); - Rz_SEXP_to_igraph(right, &c_right); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_edge_map_left, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edge_map_left); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_edge_map_right, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edge_map_right); + IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_edgemaps, 0)); + IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_edgemaps); /* Call igraph */ - IGRAPH_R_CHECK(igraph_intersection(&c_res, &c_left, &c_right, &c_edge_map_left, &c_edge_map_right)); + IGRAPH_R_CHECK(igraph_intersection_many(&c_res, c_graphs, &c_edgemaps)); /* Convert output */ - PROTECT(r_result=NEW_LIST(3)); - PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); IGRAPH_FINALLY(igraph_destroy, &c_res); PROTECT(res=Ry_igraph_to_SEXP(&c_res)); IGRAPH_I_DESTROY(&c_res); IGRAPH_FINALLY_CLEAN(1); - PROTECT(edge_map_left=Ry_igraph_vector_int_to_SEXPp1(&c_edge_map_left)); - igraph_vector_int_destroy(&c_edge_map_left); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(edge_map_right=Ry_igraph_vector_int_to_SEXPp1(&c_edge_map_right)); - igraph_vector_int_destroy(&c_edge_map_right); + PROTECT(edgemaps=Ry_igraph_vector_int_list_to_SEXP(&c_edgemaps)); + igraph_vector_int_list_destroy(&c_edgemaps); IGRAPH_FINALLY_CLEAN(1); SET_VECTOR_ELT(r_result, 0, res); - SET_VECTOR_ELT(r_result, 1, edge_map_left); - SET_VECTOR_ELT(r_result, 2, edge_map_right); + SET_VECTOR_ELT(r_result, 1, edgemaps); SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("edge_map_left")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("edge_map_right")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("edgemaps")); SET_NAMES(r_result, r_names); - UNPROTECT(4); + UNPROTECT(3); UNPROTECT(1); return(r_result); @@ -10829,6 +15475,48 @@ SEXP R_igraph_maxflow(SEXP graph, SEXP source, SEXP target, SEXP capacity) { return(r_result); } +/*-------------------------------------------/ +/ igraph_maxflow_value / +/-------------------------------------------*/ +SEXP R_igraph_maxflow_value(SEXP graph, SEXP source, SEXP target, SEXP capacity) { + /* Declarations */ + igraph_t c_graph; + igraph_real_t c_value; + igraph_integer_t c_source; + igraph_integer_t c_target; + igraph_vector_t c_capacity; + igraph_maxflow_stats_t c_stats; + SEXP value; + SEXP stats; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + c_source = (igraph_integer_t) REAL(source)[0]; + c_target = (igraph_integer_t) REAL(target)[0]; + if (!Rf_isNull(capacity)) { + Rz_SEXP_to_vector(capacity, &c_capacity); + } + /* Call igraph */ + IGRAPH_R_CHECK(igraph_maxflow_value(&c_graph, &c_value, c_source, c_target, (Rf_isNull(capacity) ? 0 : &c_capacity), &c_stats)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(2)); + PROTECT(r_names=NEW_CHARACTER(2)); + PROTECT(value=NEW_NUMERIC(1)); + REAL(value)[0]=c_value; + PROTECT(stats=Ry_igraph_maxflow_stats_to_SEXP(&c_stats)); + SET_VECTOR_ELT(r_result, 0, value); + SET_VECTOR_ELT(r_result, 1, stats); + SET_STRING_ELT(r_names, 0, Rf_mkChar("value")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("stats")); + SET_NAMES(r_result, r_names); + UNPROTECT(3); + + UNPROTECT(1); + return(r_result); +} + /*-------------------------------------------/ / igraph_mincut / /-------------------------------------------*/ @@ -10963,117 +15651,266 @@ SEXP R_igraph_residual_graph(SEXP graph, SEXP capacity, SEXP flow) { } /*-------------------------------------------/ -/ igraph_reverse_residual_graph / +/ igraph_reverse_residual_graph / +/-------------------------------------------*/ +SEXP R_igraph_reverse_residual_graph(SEXP graph, SEXP capacity, SEXP flow) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_capacity; + igraph_t c_residual; + igraph_vector_t c_flow; + SEXP residual; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + Rz_SEXP_to_vector(capacity, &c_capacity); + Rz_SEXP_to_vector(flow, &c_flow); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_reverse_residual_graph(&c_graph, &c_capacity, &c_residual, &c_flow)); + + /* Convert output */ + IGRAPH_FINALLY(igraph_destroy, &c_residual); + PROTECT(residual=Ry_igraph_to_SEXP(&c_residual)); + IGRAPH_I_DESTROY(&c_residual); + IGRAPH_FINALLY_CLEAN(1); + r_result = residual; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_st_mincut / +/-------------------------------------------*/ +SEXP R_igraph_st_mincut(SEXP graph, SEXP source, SEXP target, SEXP capacity) { + /* Declarations */ + igraph_t c_graph; + igraph_real_t c_value; + igraph_vector_int_t c_cut; + igraph_vector_int_t c_partition1; + igraph_vector_int_t c_partition2; + igraph_integer_t c_source; + igraph_integer_t c_target; + igraph_vector_t c_capacity; + SEXP value; + SEXP cut; + SEXP partition1; + SEXP partition2; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_cut, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_cut); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_partition1, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_partition1); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_partition2, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_partition2); + c_source = (igraph_integer_t) REAL(source)[0]; + c_target = (igraph_integer_t) REAL(target)[0]; + if (!Rf_isNull(capacity)) { + Rz_SEXP_to_vector(capacity, &c_capacity); + } + /* Call igraph */ + IGRAPH_R_CHECK(igraph_st_mincut(&c_graph, &c_value, &c_cut, &c_partition1, &c_partition2, c_source, c_target, (Rf_isNull(capacity) ? 0 : &c_capacity))); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(4)); + PROTECT(r_names=NEW_CHARACTER(4)); + PROTECT(value=NEW_NUMERIC(1)); + REAL(value)[0]=c_value; + PROTECT(cut=Ry_igraph_vector_int_to_SEXPp1(&c_cut)); + igraph_vector_int_destroy(&c_cut); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(partition1=Ry_igraph_vector_int_to_SEXPp1(&c_partition1)); + igraph_vector_int_destroy(&c_partition1); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(partition2=Ry_igraph_vector_int_to_SEXPp1(&c_partition2)); + igraph_vector_int_destroy(&c_partition2); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, value); + SET_VECTOR_ELT(r_result, 1, cut); + SET_VECTOR_ELT(r_result, 2, partition1); + SET_VECTOR_ELT(r_result, 3, partition2); + SET_STRING_ELT(r_names, 0, Rf_mkChar("value")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("cut")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("partition1")); + SET_STRING_ELT(r_names, 3, Rf_mkChar("partition2")); + SET_NAMES(r_result, r_names); + UNPROTECT(5); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_st_mincut_value / +/-------------------------------------------*/ +SEXP R_igraph_st_mincut_value(SEXP graph, SEXP source, SEXP target, SEXP capacity) { + /* Declarations */ + igraph_t c_graph; + igraph_real_t c_res; + igraph_integer_t c_source; + igraph_integer_t c_target; + igraph_vector_t c_capacity; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + c_source = (igraph_integer_t) REAL(source)[0]; + c_target = (igraph_integer_t) REAL(target)[0]; + if (!Rf_isNull(capacity)) { + Rz_SEXP_to_vector(capacity, &c_capacity); + } + /* Call igraph */ + IGRAPH_R_CHECK(igraph_st_mincut_value(&c_graph, &c_res, c_source, c_target, (Rf_isNull(capacity) ? 0 : &c_capacity))); + + /* Convert output */ + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=c_res; + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_st_vertex_connectivity / +/-------------------------------------------*/ +SEXP R_igraph_st_vertex_connectivity(SEXP graph, SEXP source, SEXP target, SEXP neighbors) { + /* Declarations */ + igraph_t c_graph; + igraph_integer_t c_res; + igraph_integer_t c_source; + igraph_integer_t c_target; + igraph_vconn_nei_t c_neighbors; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + c_res=0; + c_source = (igraph_integer_t) REAL(source)[0]; + c_target = (igraph_integer_t) REAL(target)[0]; + c_neighbors = (igraph_vconn_nei_t) Rf_asInteger(neighbors); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_st_vertex_connectivity(&c_graph, &c_res, c_source, c_target, c_neighbors)); + + /* Convert output */ + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=(double) c_res; + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_vertex_connectivity / +/-------------------------------------------*/ +SEXP R_igraph_vertex_connectivity(SEXP graph, SEXP checks) { + /* Declarations */ + igraph_t c_graph; + igraph_integer_t c_res; + igraph_bool_t c_checks; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + c_res=0; + IGRAPH_R_CHECK_BOOL(checks); + c_checks = LOGICAL(checks)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_vertex_connectivity(&c_graph, &c_res, c_checks)); + + /* Convert output */ + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=(double) c_res; + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_st_edge_connectivity / /-------------------------------------------*/ -SEXP R_igraph_reverse_residual_graph(SEXP graph, SEXP capacity, SEXP flow) { +SEXP R_igraph_st_edge_connectivity(SEXP graph, SEXP source, SEXP target) { /* Declarations */ igraph_t c_graph; - igraph_vector_t c_capacity; - igraph_t c_residual; - igraph_vector_t c_flow; - SEXP residual; + igraph_integer_t c_res; + igraph_integer_t c_source; + igraph_integer_t c_target; + SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - Rz_SEXP_to_vector(capacity, &c_capacity); - Rz_SEXP_to_vector(flow, &c_flow); + c_res=0; + c_source = (igraph_integer_t) REAL(source)[0]; + c_target = (igraph_integer_t) REAL(target)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_reverse_residual_graph(&c_graph, &c_capacity, &c_residual, &c_flow)); + IGRAPH_R_CHECK(igraph_st_edge_connectivity(&c_graph, &c_res, c_source, c_target)); /* Convert output */ - IGRAPH_FINALLY(igraph_destroy, &c_residual); - PROTECT(residual=Ry_igraph_to_SEXP(&c_residual)); - IGRAPH_I_DESTROY(&c_residual); - IGRAPH_FINALLY_CLEAN(1); - r_result = residual; + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=(double) c_res; + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_st_mincut / +/ igraph_edge_connectivity / /-------------------------------------------*/ -SEXP R_igraph_st_mincut(SEXP graph, SEXP source, SEXP target, SEXP capacity) { +SEXP R_igraph_edge_connectivity(SEXP graph, SEXP checks) { /* Declarations */ igraph_t c_graph; - igraph_real_t c_value; - igraph_vector_int_t c_cut; - igraph_vector_int_t c_partition1; - igraph_vector_int_t c_partition2; - igraph_integer_t c_source; - igraph_integer_t c_target; - igraph_vector_t c_capacity; - SEXP value; - SEXP cut; - SEXP partition1; - SEXP partition2; + igraph_integer_t c_res; + igraph_bool_t c_checks; + SEXP res; - SEXP r_result, r_names; + SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_cut, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_cut); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_partition1, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_partition1); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_partition2, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_partition2); - c_source = (igraph_integer_t) REAL(source)[0]; - c_target = (igraph_integer_t) REAL(target)[0]; - if (!Rf_isNull(capacity)) { - Rz_SEXP_to_vector(capacity, &c_capacity); - } + c_res=0; + IGRAPH_R_CHECK_BOOL(checks); + c_checks = LOGICAL(checks)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_st_mincut(&c_graph, &c_value, &c_cut, &c_partition1, &c_partition2, c_source, c_target, (Rf_isNull(capacity) ? 0 : &c_capacity))); + IGRAPH_R_CHECK(igraph_edge_connectivity(&c_graph, &c_res, c_checks)); /* Convert output */ - PROTECT(r_result=NEW_LIST(4)); - PROTECT(r_names=NEW_CHARACTER(4)); - PROTECT(value=NEW_NUMERIC(1)); - REAL(value)[0]=c_value; - PROTECT(cut=Ry_igraph_vector_int_to_SEXPp1(&c_cut)); - igraph_vector_int_destroy(&c_cut); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(partition1=Ry_igraph_vector_int_to_SEXPp1(&c_partition1)); - igraph_vector_int_destroy(&c_partition1); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(partition2=Ry_igraph_vector_int_to_SEXPp1(&c_partition2)); - igraph_vector_int_destroy(&c_partition2); - IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, value); - SET_VECTOR_ELT(r_result, 1, cut); - SET_VECTOR_ELT(r_result, 2, partition1); - SET_VECTOR_ELT(r_result, 3, partition2); - SET_STRING_ELT(r_names, 0, Rf_mkChar("value")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("cut")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("partition1")); - SET_STRING_ELT(r_names, 3, Rf_mkChar("partition2")); - SET_NAMES(r_result, r_names); - UNPROTECT(5); + PROTECT(res=NEW_NUMERIC(1)); + REAL(res)[0]=(double) c_res; + r_result = res; UNPROTECT(1); return(r_result); } /*-------------------------------------------/ -/ igraph_vertex_connectivity / +/ igraph_edge_disjoint_paths / /-------------------------------------------*/ -SEXP R_igraph_vertex_connectivity(SEXP graph, SEXP checks) { +SEXP R_igraph_edge_disjoint_paths(SEXP graph, SEXP source, SEXP target) { /* Declarations */ igraph_t c_graph; igraph_integer_t c_res; - igraph_bool_t c_checks; + igraph_integer_t c_source; + igraph_integer_t c_target; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); c_res=0; - IGRAPH_R_CHECK_BOOL(checks); - c_checks = LOGICAL(checks)[0]; + c_source = (igraph_integer_t) REAL(source)[0]; + c_target = (igraph_integer_t) REAL(target)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_vertex_connectivity(&c_graph, &c_res, c_checks)); + IGRAPH_R_CHECK(igraph_edge_disjoint_paths(&c_graph, &c_res, c_source, c_target)); /* Convert output */ PROTECT(res=NEW_NUMERIC(1)); @@ -11085,23 +15922,24 @@ SEXP R_igraph_vertex_connectivity(SEXP graph, SEXP checks) { } /*-------------------------------------------/ -/ igraph_edge_connectivity / +/ igraph_vertex_disjoint_paths / /-------------------------------------------*/ -SEXP R_igraph_edge_connectivity(SEXP graph, SEXP checks) { +SEXP R_igraph_vertex_disjoint_paths(SEXP graph, SEXP source, SEXP target) { /* Declarations */ igraph_t c_graph; igraph_integer_t c_res; - igraph_bool_t c_checks; + igraph_integer_t c_source; + igraph_integer_t c_target; SEXP res; SEXP r_result; /* Convert input */ Rz_SEXP_to_igraph(graph, &c_graph); c_res=0; - IGRAPH_R_CHECK_BOOL(checks); - c_checks = LOGICAL(checks)[0]; + c_source = (igraph_integer_t) REAL(source)[0]; + c_target = (igraph_integer_t) REAL(target)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_edge_connectivity(&c_graph, &c_res, c_checks)); + IGRAPH_R_CHECK(igraph_vertex_disjoint_paths(&c_graph, &c_res, c_source, c_target)); /* Convert output */ PROTECT(res=NEW_NUMERIC(1)); @@ -12473,6 +17311,55 @@ SEXP R_igraph_automorphism_group(SEXP graph, SEXP colors, SEXP sh) { return(r_result); } +/*-------------------------------------------/ +/ igraph_subisomorphic_lad / +/-------------------------------------------*/ +SEXP R_igraph_subisomorphic_lad(SEXP graph) { + /* Declarations */ + igraph_t c_graph; + igraph_t c_res; + igraph_vector_int_t c_vertex_color; + igraph_vector_int_t c_edge_color; + SEXP res; + SEXP vertex_color; + SEXP edge_color; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_vertex_color, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vertex_color); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_edge_color, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edge_color); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_subisomorphic_lad(&c_graph, &c_res, &c_vertex_color, &c_edge_color)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + IGRAPH_FINALLY(igraph_destroy, &c_res); + PROTECT(res=Ry_igraph_to_SEXP(&c_res)); + IGRAPH_I_DESTROY(&c_res); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(vertex_color=Ry_igraph_vector_int_to_SEXP(&c_vertex_color)); + igraph_vector_int_destroy(&c_vertex_color); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(edge_color=Ry_igraph_vector_int_to_SEXP(&c_edge_color)); + igraph_vector_int_destroy(&c_edge_color); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, res); + SET_VECTOR_ELT(r_result, 1, vertex_color); + SET_VECTOR_ELT(r_result, 2, edge_color); + SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("vertex_color")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("edge_color")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); + + UNPROTECT(1); + return(r_result); +} + /*-------------------------------------------/ / igraph_simplify_and_colorize / /-------------------------------------------*/ @@ -12671,6 +17558,144 @@ SEXP R_igraph_maximum_bipartite_matching(SEXP graph, SEXP types, SEXP weights, S return(r_result); } +/*-------------------------------------------/ +/ igraph_adjacency_spectral_embedding / +/-------------------------------------------*/ +SEXP R_igraph_adjacency_spectral_embedding(SEXP graph, SEXP no, SEXP weights, SEXP which, SEXP scaled, SEXP cvec, SEXP options) { + /* Declarations */ + igraph_t c_graph; + igraph_integer_t c_no; + igraph_vector_t c_weights; + igraph_eigen_which_position_t c_which; + igraph_bool_t c_scaled; + igraph_matrix_t c_X; + igraph_matrix_t c_Y; + igraph_vector_t c_D; + igraph_vector_t c_cvec; + igraph_arpack_options_t c_options; + SEXP X; + SEXP Y; + SEXP D; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK_INT(no); + c_no = (igraph_integer_t) REAL(no)[0]; + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + c_which=INTEGER(which)[0]; + IGRAPH_R_CHECK_BOOL(scaled); + c_scaled = LOGICAL(scaled)[0]; + IGRAPH_R_CHECK(igraph_matrix_init(&c_X, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_X); + IGRAPH_R_CHECK(igraph_matrix_init(&c_Y, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_Y); + IGRAPH_R_CHECK(igraph_vector_init(&c_D, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_D); + Rz_SEXP_to_vector(cvec, &c_cvec); + Rz_SEXP_to_igraph_arpack_options(options, &c_options); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_adjacency_spectral_embedding(&c_graph, c_no, (Rf_isNull(weights) ? 0 : &c_weights), c_which, c_scaled, &c_X, &c_Y, &c_D, &c_cvec, &c_options)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(4)); + PROTECT(r_names=NEW_CHARACTER(4)); + PROTECT(X=Ry_igraph_matrix_to_SEXP(&c_X)); + igraph_matrix_destroy(&c_X); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(Y=Ry_igraph_matrix_to_SEXP(&c_Y)); + igraph_matrix_destroy(&c_Y); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(D=Ry_igraph_vector_to_SEXP(&c_D)); + igraph_vector_destroy(&c_D); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(options=Ry_igraph_arpack_options_to_SEXP(&c_options)); + SET_VECTOR_ELT(r_result, 0, X); + SET_VECTOR_ELT(r_result, 1, Y); + SET_VECTOR_ELT(r_result, 2, D); + SET_VECTOR_ELT(r_result, 3, options); + SET_STRING_ELT(r_names, 0, Rf_mkChar("X")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("Y")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("D")); + SET_STRING_ELT(r_names, 3, Rf_mkChar("options")); + SET_NAMES(r_result, r_names); + UNPROTECT(5); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_laplacian_spectral_embedding / +/-------------------------------------------*/ +SEXP R_igraph_laplacian_spectral_embedding(SEXP graph, SEXP no, SEXP weights, SEXP which, SEXP type, SEXP scaled, SEXP options) { + /* Declarations */ + igraph_t c_graph; + igraph_integer_t c_no; + igraph_vector_t c_weights; + igraph_eigen_which_position_t c_which; + igraph_laplacian_spectral_embedding_type_t c_type; + igraph_bool_t c_scaled; + igraph_matrix_t c_X; + igraph_matrix_t c_Y; + igraph_vector_t c_D; + igraph_arpack_options_t c_options; + SEXP X; + SEXP Y; + SEXP D; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK_INT(no); + c_no = (igraph_integer_t) REAL(no)[0]; + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + c_which=INTEGER(which)[0]; + c_type = (igraph_laplacian_spectral_embedding_type_t) Rf_asInteger(type); + IGRAPH_R_CHECK_BOOL(scaled); + c_scaled = LOGICAL(scaled)[0]; + IGRAPH_R_CHECK(igraph_matrix_init(&c_X, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_X); + IGRAPH_R_CHECK(igraph_matrix_init(&c_Y, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_Y); + IGRAPH_R_CHECK(igraph_vector_init(&c_D, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_D); + Rz_SEXP_to_igraph_arpack_options(options, &c_options); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_laplacian_spectral_embedding(&c_graph, c_no, (Rf_isNull(weights) ? 0 : &c_weights), c_which, c_type, c_scaled, &c_X, &c_Y, &c_D, &c_options)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(4)); + PROTECT(r_names=NEW_CHARACTER(4)); + PROTECT(X=Ry_igraph_matrix_to_SEXP(&c_X)); + igraph_matrix_destroy(&c_X); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(Y=Ry_igraph_matrix_to_SEXP(&c_Y)); + igraph_matrix_destroy(&c_Y); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(D=Ry_igraph_vector_to_SEXP(&c_D)); + igraph_vector_destroy(&c_D); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(options=Ry_igraph_arpack_options_to_SEXP(&c_options)); + SET_VECTOR_ELT(r_result, 0, X); + SET_VECTOR_ELT(r_result, 1, Y); + SET_VECTOR_ELT(r_result, 2, D); + SET_VECTOR_ELT(r_result, 3, options); + SET_STRING_ELT(r_names, 0, Rf_mkChar("X")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("Y")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("D")); + SET_STRING_ELT(r_names, 3, Rf_mkChar("options")); + SET_NAMES(r_result, r_names); + UNPROTECT(5); + + UNPROTECT(1); + return(r_result); +} + /*-------------------------------------------/ / igraph_eigen_adjacency / /-------------------------------------------*/ @@ -12810,26 +17835,60 @@ SEXP R_igraph_sir(SEXP graph, SEXP beta, SEXP gamma, SEXP no_sim) { /*-------------------------------------------/ / igraph_running_mean / /-------------------------------------------*/ -SEXP R_igraph_running_mean(SEXP data, SEXP binwidth) { +SEXP R_igraph_running_mean(SEXP data, SEXP binwidth) { + /* Declarations */ + igraph_vector_t c_data; + igraph_vector_t c_res; + igraph_integer_t c_binwidth; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_vector(data, &c_data); + IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_res); + IGRAPH_R_CHECK_INT(binwidth); + c_binwidth = (igraph_integer_t) REAL(binwidth)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_running_mean(&c_data, &c_res, c_binwidth)); + + /* Convert output */ + PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); + igraph_vector_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_random_sample / +/-------------------------------------------*/ +SEXP R_igraph_random_sample(SEXP l, SEXP h, SEXP length) { /* Declarations */ - igraph_vector_t c_data; - igraph_vector_t c_res; - igraph_integer_t c_binwidth; + igraph_vector_int_t c_res; + igraph_integer_t c_l; + igraph_integer_t c_h; + igraph_integer_t c_length; SEXP res; SEXP r_result; /* Convert input */ - Rz_SEXP_to_vector(data, &c_data); - IGRAPH_R_CHECK(igraph_vector_init(&c_res, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_res); - IGRAPH_R_CHECK_INT(binwidth); - c_binwidth = (igraph_integer_t) REAL(binwidth)[0]; + IGRAPH_R_CHECK(igraph_vector_int_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_res); + IGRAPH_R_CHECK_INT(l); + c_l = (igraph_integer_t) REAL(l)[0]; + IGRAPH_R_CHECK_INT(h); + c_h = (igraph_integer_t) REAL(h)[0]; + IGRAPH_R_CHECK_INT(length); + c_length = (igraph_integer_t) REAL(length)[0]; /* Call igraph */ - IGRAPH_R_CHECK(igraph_running_mean(&c_data, &c_res, c_binwidth)); + IGRAPH_R_CHECK(igraph_random_sample(&c_res, c_l, c_h, c_length)); /* Convert output */ - PROTECT(res=Ry_igraph_vector_to_SEXP(&c_res)); - igraph_vector_destroy(&c_res); + PROTECT(res=Ry_igraph_vector_int_to_SEXP(&c_res)); + igraph_vector_int_destroy(&c_res); IGRAPH_FINALLY_CLEAN(1); r_result = res; @@ -12903,6 +17962,172 @@ SEXP R_igraph_dim_select(SEXP sv) { return(r_result); } +/*-------------------------------------------/ +/ igraph_almost_equals / +/-------------------------------------------*/ +SEXP R_igraph_almost_equals(SEXP a, SEXP b, SEXP eps) { + /* Declarations */ + double c_a; + double c_b; + double c_eps; + igraph_bool_t c_result; + SEXP r_result; + /* Convert input */ + + /* Call igraph */ + c_result=igraph_almost_equals(c_a, c_b, c_eps); + + /* Convert output */ + + PROTECT(r_result=NEW_LOGICAL(1)); + LOGICAL(r_result)[0]=c_result; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_cmp_epsilon / +/-------------------------------------------*/ +SEXP R_igraph_cmp_epsilon(SEXP a, SEXP b, SEXP eps) { + /* Declarations */ + double c_a; + double c_b; + double c_eps; + int c_result; + SEXP r_result; + /* Convert input */ + + /* Call igraph */ + c_result=igraph_cmp_epsilon(c_a, c_b, c_eps); + + /* Convert output */ + + PROTECT(r_result=NEW_INTEGER(1)); + INTEGER(r_result)[0]=(int) c_result; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_eigen_matrix / +/-------------------------------------------*/ +SEXP R_igraph_eigen_matrix(SEXP A, SEXP sA, SEXP n, SEXP algorithm, SEXP which, SEXP options) { + /* Declarations */ + igraph_matrix_t c_A; + igraph_sparsemat_t c_sA; + + int c_n; + + igraph_eigen_algorithm_t c_algorithm; + igraph_eigen_which_t c_which; + igraph_arpack_options_t c_options; + + igraph_vector_complex_t c_values; + igraph_matrix_complex_t c_vectors; + SEXP values; + SEXP vectors; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_matrix(A, &c_A); + Rz_SEXP_to_sparsemat(sA, &c_sA); + IGRAPH_R_CHECK_INT(n); + c_n = INTEGER(n)[0]; + c_algorithm = (igraph_eigen_algorithm_t) Rf_asInteger(algorithm); + Rz_SEXP_to_igraph_eigen_which(which, &c_which); + Rz_SEXP_to_igraph_arpack_options(options, &c_options); + IGRAPH_R_CHECK(igraph_vector_complex_init(&c_values, 0)); + IGRAPH_FINALLY(igraph_vector_complex_destroy, &c_values); + values=R_GlobalEnv; /* hack to have a non-NULL value */ + IGRAPH_R_CHECK(igraph_matrix_complex_init(&c_vectors, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_complex_destroy, &c_vectors); + vectors=R_GlobalEnv; /* hack to have a non-NULL value */ + /* Call igraph */ + IGRAPH_R_CHECK(igraph_eigen_matrix(&c_A, &c_sA, 0, c_n, 0, c_algorithm, &c_which, &c_options, 0, (Rf_isNull(values) ? NULL : &c_values), (Rf_isNull(vectors) ? NULL : &c_vectors))); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(options=Ry_igraph_arpack_options_to_SEXP(&c_options)); + PROTECT(values=Ry_igraph_0orvector_complex_to_SEXP(&c_values)); + igraph_vector_complex_destroy(&c_values); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(vectors=Ry_igraph_0ormatrix_complex_to_SEXP(&c_vectors)); + igraph_matrix_complex_destroy(&c_vectors); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, options); + SET_VECTOR_ELT(r_result, 1, values); + SET_VECTOR_ELT(r_result, 2, vectors); + SET_STRING_ELT(r_names, 0, Rf_mkChar("options")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("values")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("vectors")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_eigen_matrix_symmetric / +/-------------------------------------------*/ +SEXP R_igraph_eigen_matrix_symmetric(SEXP A, SEXP sA, SEXP n, SEXP algorithm, SEXP which, SEXP options) { + /* Declarations */ + igraph_matrix_t c_A; + igraph_sparsemat_t c_sA; + + int c_n; + + igraph_eigen_algorithm_t c_algorithm; + igraph_eigen_which_t c_which; + igraph_arpack_options_t c_options; + + igraph_vector_t c_values; + igraph_matrix_t c_vectors; + SEXP values; + SEXP vectors; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_matrix(A, &c_A); + Rz_SEXP_to_sparsemat(sA, &c_sA); + IGRAPH_R_CHECK_INT(n); + c_n = INTEGER(n)[0]; + c_algorithm = (igraph_eigen_algorithm_t) Rf_asInteger(algorithm); + Rz_SEXP_to_igraph_eigen_which(which, &c_which); + Rz_SEXP_to_igraph_arpack_options(options, &c_options); + IGRAPH_R_CHECK(igraph_vector_init(&c_values, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_values); + IGRAPH_R_CHECK(igraph_matrix_init(&c_vectors, 0, 0)); + IGRAPH_FINALLY(igraph_matrix_destroy, &c_vectors); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_eigen_matrix_symmetric(&c_A, &c_sA, 0, c_n, 0, c_algorithm, &c_which, &c_options, 0, &c_values, &c_vectors)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(options=Ry_igraph_arpack_options_to_SEXP(&c_options)); + PROTECT(values=Ry_igraph_vector_to_SEXP(&c_values)); + igraph_vector_destroy(&c_values); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(vectors=Ry_igraph_matrix_to_SEXP(&c_vectors)); + igraph_matrix_destroy(&c_vectors); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, options); + SET_VECTOR_ELT(r_result, 1, values); + SET_VECTOR_ELT(r_result, 2, vectors); + SET_STRING_ELT(r_names, 0, Rf_mkChar("options")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("values")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("vectors")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); + + UNPROTECT(1); + return(r_result); +} + /*-------------------------------------------/ / igraph_solve_lsap / /-------------------------------------------*/ @@ -13409,6 +18634,37 @@ SEXP R_igraph_is_complete(SEXP graph) { return(r_result); } +/*-------------------------------------------/ +/ igraph_minimum_spanning_tree / +/-------------------------------------------*/ +SEXP R_igraph_minimum_spanning_tree(SEXP graph, SEXP weights) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_int_t c_res; + igraph_vector_t c_weights; + SEXP res; + + SEXP r_result; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_int_init(&c_res, 0)); + IGRAPH_FINALLY(igraph_vector_int_destroy, &c_res); + if (!Rf_isNull(weights)) { + Rz_SEXP_to_vector(weights, &c_weights); + } + /* Call igraph */ + IGRAPH_R_CHECK(igraph_minimum_spanning_tree(&c_graph, &c_res, (Rf_isNull(weights) ? 0 : &c_weights))); + + /* Convert output */ + PROTECT(res=Ry_igraph_vector_int_to_SEXPp1(&c_res)); + igraph_vector_int_destroy(&c_res); + IGRAPH_FINALLY_CLEAN(1); + r_result = res; + + UNPROTECT(1); + return(r_result); +} + /*-------------------------------------------/ / igraph_minimum_spanning_tree_unweighted / /-------------------------------------------*/ @@ -13797,6 +19053,141 @@ SEXP R_igraph_stochastic_imitation(SEXP graph, SEXP vid, SEXP algo, SEXP quantit return(r_result); } +/*-------------------------------------------/ +/ igraph_convergence_degree / +/-------------------------------------------*/ +SEXP R_igraph_convergence_degree(SEXP graph) { + /* Declarations */ + igraph_t c_graph; + igraph_vector_t c_result; + igraph_vector_t c_in; + igraph_vector_t c_out; + SEXP result; + SEXP in; + SEXP out; + + SEXP r_result, r_names; + /* Convert input */ + Rz_SEXP_to_igraph(graph, &c_graph); + IGRAPH_R_CHECK(igraph_vector_init(&c_result, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_result); + IGRAPH_R_CHECK(igraph_vector_init(&c_in, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_in); + IGRAPH_R_CHECK(igraph_vector_init(&c_out, 0)); + IGRAPH_FINALLY(igraph_vector_destroy, &c_out); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_convergence_degree(&c_graph, &c_result, &c_in, &c_out)); + + /* Convert output */ + PROTECT(r_result=NEW_LIST(3)); + PROTECT(r_names=NEW_CHARACTER(3)); + PROTECT(result=Ry_igraph_vector_to_SEXP(&c_result)); + igraph_vector_destroy(&c_result); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(in=Ry_igraph_vector_to_SEXP(&c_in)); + igraph_vector_destroy(&c_in); + IGRAPH_FINALLY_CLEAN(1); + PROTECT(out=Ry_igraph_vector_to_SEXP(&c_out)); + igraph_vector_destroy(&c_out); + IGRAPH_FINALLY_CLEAN(1); + SET_VECTOR_ELT(r_result, 0, result); + SET_VECTOR_ELT(r_result, 1, in); + SET_VECTOR_ELT(r_result, 2, out); + SET_STRING_ELT(r_names, 0, Rf_mkChar("result")); + SET_STRING_ELT(r_names, 1, Rf_mkChar("in")); + SET_STRING_ELT(r_names, 2, Rf_mkChar("out")); + SET_NAMES(r_result, r_names); + UNPROTECT(4); + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_has_attribute_table / +/-------------------------------------------*/ +SEXP R_igraph_has_attribute_table(void) { + /* Declarations */ + igraph_bool_t c_result; + SEXP r_result; + /* Convert input */ + + /* Call igraph */ + c_result=igraph_has_attribute_table(); + + /* Convert output */ + + PROTECT(r_result=NEW_LOGICAL(1)); + LOGICAL(r_result)[0]=c_result; + + UNPROTECT(1); + return(r_result); +} + +/*-------------------------------------------/ +/ igraph_progress / +/-------------------------------------------*/ +SEXP R_igraph_progress(SEXP message, SEXP percent) { + /* Declarations */ + const char* c_message; + igraph_real_t c_percent; + + + /* Convert input */ + c_message = Rf_translateCharUTF8(STRING_ELT(message, 0)); + IGRAPH_R_CHECK_REAL(percent); + c_percent = REAL(percent)[0]; + /* Call igraph */ + IGRAPH_R_CHECK(igraph_progress(c_message, c_percent, 0)); + + /* Convert output */ + + + + return(R_NilValue); +} + +/*-------------------------------------------/ +/ igraph_status / +/-------------------------------------------*/ +SEXP R_igraph_status(SEXP message) { + /* Declarations */ + const char* c_message; + + + /* Convert input */ + c_message = Rf_translateCharUTF8(STRING_ELT(message, 0)); + /* Call igraph */ + IGRAPH_R_CHECK(igraph_status(c_message, 0)); + + /* Convert output */ + + + + return(R_NilValue); +} + +/*-------------------------------------------/ +/ igraph_strerror / +/-------------------------------------------*/ +SEXP R_igraph_strerror(SEXP igraph_errno) { + /* Declarations */ + igraph_error_t c_igraph_errno; + const char* c_result; + SEXP r_result; + /* Convert input */ + + /* Call igraph */ + c_result=igraph_strerror(c_igraph_errno); + + /* Convert output */ + + PROTECT(r_result = Rf_ScalarString(Rf_mkCharLenCE(c_result, strlen(c_result), CE_UTF8))); + + UNPROTECT(1); + return(r_result); +} + /*-------------------------------------------/ / igraph_expand_path_to_pairs / /-------------------------------------------*/ diff --git a/tools/stimulus/functions-R.yaml b/tools/stimulus/functions-R.yaml index 7470eaf8f5..e4cb0ba12e 100644 --- a/tools/stimulus/functions-R.yaml +++ b/tools/stimulus/functions-R.yaml @@ -12,7 +12,6 @@ # Not needed in R, we use igraph_emtpy() instead igraph_empty_attrs: - IGNORE: RR, RC igraph_add_vertices: @@ -27,15 +26,13 @@ igraph_is_directed: igraph_degree: igraph_edge: - IGNORE: RR, RC, RInit igraph_edges: igraph_get_eid: - IGNORE: RR, RC, RInit igraph_get_eids: - IGNORE: RR, RC, RInit + DEPS: pairs ON graph, eids ON graph igraph_get_all_eids_between: # This is a temporary hack; we need to find a way to handle default values @@ -47,12 +44,10 @@ igraph_get_all_eids_between: igraph_incident: igraph_is_same_graph: - IGNORE: RR, RC, RInit # Not needed in R; we can simply compare things in the R layer without # calling into C igraph_create: - IGNORE: RR, RC ####################################### # Constructors, deterministic @@ -60,34 +55,25 @@ igraph_create: # TODO: temporarily disabled igraph_adjacency: - IGNORE: RR # TODO: temporarily disabled igraph_sparse_adjacency: - IGNORE: RR, RC # TODO: temporarily disabled igraph_sparse_weighted_adjacency: - IGNORE: RR, RC # TODO: temporarily disabled igraph_weighted_adjacency: - IGNORE: RR igraph_star: - IGNORE: RR, RC igraph_ring: - IGNORE: RR, RC igraph_kary_tree: - IGNORE: RR, RC igraph_full: - IGNORE: RR, RC igraph_connect_neighborhood: - IGNORE: RR, RC igraph_famous: @@ -133,17 +119,14 @@ igraph_turan: # TODO: temporarily disabled igraph_weighted_sparsemat: - IGNORE: RR, RC ####################################### # Constructors, games ####################################### igraph_barabasi_game: - IGNORE: RR, RC igraph_degree_sequence_game: - IGNORE: RR, RC igraph_growing_random_game: PARAMS: |- @@ -155,34 +138,24 @@ igraph_growing_random_game: GATTR-PARAM: m, citation igraph_barabasi_aging_game: - IGNORE: RR, RC igraph_recent_degree_game: - IGNORE: RR, RC igraph_recent_degree_aging_game: - IGNORE: RR, RC igraph_callaway_traits_game: - IGNORE: RR, RC igraph_establishment_game: - IGNORE: RR, RC igraph_grg_game: - IGNORE: RR, RC, RInit igraph_watts_strogatz_game: - IGNORE: RR, RC igraph_lastcit_game: - IGNORE: RR, RC igraph_cited_type_game: - IGNORE: RR, RC igraph_citing_cited_type_game: - IGNORE: RR, RC igraph_forest_fire_game: R: @@ -246,29 +219,22 @@ igraph_correlated_game: # Deprecated in C core igraph_are_connected: - IGNORE: RR, RC ####################################### # Structural properties ####################################### igraph_diameter: - IGNORE: RR, RC, RInit igraph_diameter_dijkstra: - IGNORE: RR, RC, RInit igraph_distances: - IGNORE: RR, RC igraph_distances_cutoff: - IGNORE: RR, RC igraph_get_shortest_path_astar: - IGNORE: RR, RC, Rinit igraph_get_shortest_paths: - IGNORE: RR, RC, RInit igraph_get_all_shortest_paths: PARAM_NAMES: @@ -276,16 +242,12 @@ igraph_get_all_shortest_paths: edges: epaths igraph_distances_dijkstra: - IGNORE: RR, RC igraph_distances_dijkstra_cutoff: - IGNORE: RR, RC igraph_get_shortest_paths_dijkstra: - IGNORE: RR, RC, RInit igraph_get_shortest_paths_bellman_ford: - IGNORE: RR, RC, RInit igraph_get_all_shortest_paths_dijkstra: PARAM_NAMES: @@ -293,13 +255,10 @@ igraph_get_all_shortest_paths_dijkstra: edges: epaths igraph_distances_bellman_ford: - IGNORE: RR, RC igraph_distances_johnson: - IGNORE: RR, RC igraph_distances_floyd_warshall: - IGNORE: RR, RC igraph_voronoi: FIRST_KW_PARAM: weights @@ -345,21 +304,17 @@ igraph_spanner: DEPS: weights ON graph, spanner ON graph igraph_subcomponent: - IGNORE: RR, RC igraph_betweenness: - IGNORE: RR, RC igraph_betweenness_subset: DEPS: |- vids ON graph, weights ON graph, res ON graph vids, sources ON graph, targets ON graph igraph_harmonic_centrality: - IGNORE: RR, RC, RInit # This is handled by igraph_harmonic_centrality_cutoff igraph_pagerank: - IGNORE: RR, RC, RInit igraph_personalized_pagerank_vs: DEPS: vids ON graph, weights ON graph, vector ON graph vids, @@ -371,7 +326,6 @@ igraph_rewire: mode: 0L igraph_average_path_length: - IGNORE: RR, RC, RInit # No need for it, igraph_average_path_length_dijkstra takes care of the # unweighted case as well @@ -388,13 +342,10 @@ igraph_maxdegree: vids: v igraph_neighborhood_size: - IGNORE: RR, RC, RInit igraph_neighborhood: - IGNORE: RR, RC, RInit igraph_neighborhood_graphs: - IGNORE: RR, RC igraph_topological_sorting: @@ -413,7 +364,6 @@ igraph_count_multiple: igraph_girth: igraph_add_edge: - IGNORE: RR, RC, RInit igraph_chung_lu_game: PARAMS: |- @@ -432,10 +382,10 @@ igraph_eigenvector_centrality: DEPS: weights ON graph, vector ON graph V(graph) igraph_hub_score: - IGNORE: RR, RC + DEPS: weights ON graph, vector ON graph V(graph) igraph_authority_score: - IGNORE: RR, RC + DEPS: weights ON graph, vector ON graph V(graph) igraph_hub_and_authority_scores: # This is a temporary hack; we need to find a way to handle default values @@ -452,25 +402,21 @@ igraph_is_mutual: es: eids igraph_is_chordal: - IGNORE: RR, RC, RInit # We use igraph_eccentricity_dijkstra instead igraph_eccentricity: - IGNORE: RR, RC igraph_eccentricity_dijkstra: PARAM_ORDER: graph, vids, *, weights, ... # We use igraph_graph_center_dijkstra instead igraph_graph_center: - IGNORE: RR, RC igraph_graph_center_dijkstra: FIRST_KW_PARAM: weights # We use igraph_radius_dijkstra instead igraph_radius: - IGNORE: RR, RC igraph_radius_dijkstra: FIRST_KW_PARAM: weights @@ -485,27 +431,23 @@ igraph_random_walk: PARAM_ORDER: graph, start, steps, ... igraph_random_edge_walk: - IGNORE: RR, RC ####################################### # Degree sequences ####################################### igraph_is_bigraphical: - IGNORE: RR, RC, RInit ####################################### # Visitors ####################################### igraph_bfs: - IGNORE: RR, RC, RInit igraph_bfs_simple: DEPS: root ON graph, order ON graph igraph_dfs: - IGNORE: RR, RC, RInit ####################################### # Bipartite graphs @@ -526,10 +468,9 @@ igraph_bipartite_projection_size: ####################################### igraph_bipartite_projection: - IGNORE: RR, RC, RInit igraph_create_bipartite: - IGNORE: RR + DEPS: types ON res$graph V(res$graph) igraph_biadjacency: DEPS: types ON res$graph V(res$graph) @@ -552,7 +493,7 @@ igraph_bipartite_game_gnm: NEIMODE mode=ALL igraph_bipartite_game: - IGNORE: RR, RC + DEPS: types ON res$graph V(res$graph) igraph_full_bipartite: DEPS: types ON res$graph @@ -571,7 +512,6 @@ igraph_full_bipartite: ####################################### igraph_decompose: - IGNORE: RR, RC ####################################### # Cliques @@ -591,11 +531,9 @@ igraph_clique_size_hist: INTERNAL: true igraph_maximal_cliques: - IGNORE: RR, RC, RInit # TODO: temporarily disabled igraph_maximal_cliques_subset: - IGNORE: RR, RC igraph_maximal_cliques_callback: IGNORE: RR, RC, RInit @@ -603,7 +541,6 @@ igraph_maximal_cliques_callback: igraph_maximal_cliques_count: igraph_maximal_cliques_file: - IGNORE: RR, RC, RInit igraph_maximal_cliques_hist: # Wrapper function is hand-rolled in the R layer; the generated version @@ -611,7 +548,6 @@ igraph_maximal_cliques_hist: INTERNAL: true igraph_independent_vertex_sets: - IGNORE: RR, RC igraph_largest_independent_vertex_sets: @@ -624,37 +560,28 @@ igraph_independence_number: ####################################### igraph_layout_fruchterman_reingold: - IGNORE: RR, RC, RInit igraph_layout_kamada_kawai: - IGNORE: RR, RC, RInit igraph_layout_lgl: - IGNORE: RR, RC igraph_layout_reingold_tilford: - IGNORE: RR, RC, RInit igraph_layout_reingold_tilford_circular: - IGNORE: RR, RC, RInit igraph_layout_fruchterman_reingold_3d: - IGNORE: RR, RC, RInit igraph_layout_kamada_kawai_3d: - IGNORE: RR, RC, RInit igraph_layout_graphopt: - IGNORE: RR, RC, RInit igraph_layout_drl: - IGNORE: RR + DEPS: weights ON graph igraph_layout_drl_3d: - IGNORE: RR + DEPS: weights ON graph igraph_layout_merge_dla: - IGNORE: RR, RC ####################################### # Cocitation and other similarity measures @@ -669,46 +596,36 @@ igraph_bibcoupling: ####################################### igraph_community_spinglass: - IGNORE: RR, RC, RInit igraph_community_spinglass_single: - IGNORE: RR, RC, RInit igraph_community_walktrap: - IGNORE: RR, RC, RInit igraph_community_edge_betweenness: - IGNORE: RR, RC, RInit igraph_community_eb_get_merges: - IGNORE: RR, RC, RInit + DEPS: edges ON graph, weights ON graph igraph_community_fastgreedy: - IGNORE: RR, RC, RInit igraph_community_to_membership: - IGNORE: RR, RC, RInit igraph_le_community_to_membership: - IGNORE: RR, RC, RInit igraph_reindex_membership: - IGNORE: RR, RC, RInit igraph_community_leading_eigenvector: - IGNORE: RR, RC, RInit + DEPS: weights ON graph R: CLASS: igraph.eigenc igraph_community_voronoi: - IGNORE: RR, RC, RInit ####################################### # Graphlets ####################################### igraph_graphlets: - IGNORE: RC igraph_graphlets_candidate_basis: @@ -734,7 +651,6 @@ igraph_hrg_create: ####################################### igraph_get_adjacency: - IGNORE: RR, RC igraph_get_edgelist: @@ -747,13 +663,10 @@ igraph_to_directed: ####################################### igraph_read_graph_edgelist: - IGNORE: RR, RC igraph_read_graph_ncol: - IGNORE: RR, RC igraph_read_graph_lgl: - IGNORE: RR, RC igraph_read_graph_pajek: @@ -761,7 +674,6 @@ igraph_read_graph_graphml: # TODO: temporarily disabled igraph_read_graph_dimacs_flow: - IGNORE: RR, RC igraph_read_graph_graphdb: @@ -772,10 +684,8 @@ igraph_read_graph_dl: igraph_write_graph_edgelist: igraph_write_graph_ncol: - IGNORE: RR, RC igraph_write_graph_lgl: - IGNORE: RR, RC igraph_write_graph_leda: @@ -785,7 +695,7 @@ igraph_write_graph_pajek: # TODO: temporarily disabled igraph_write_graph_dimacs_flow: - IGNORE: RR, RC + DEPS: source ON graph, target ON graph PARAMS: |- INOUT GRAPH graph, OUTFILE outstream, VERTEX source=0, VERTEX target=0, VECTOR capacity @@ -803,17 +713,14 @@ igraph_write_graph_dot: igraph_disjoint_union: igraph_disjoint_union_many: - IGNORE: RR, RC, RInit igraph_union: igraph_union_many: - IGNORE: RR, RC, RInit igraph_intersection: igraph_intersection_many: - IGNORE: RR, RC, RInit igraph_difference: @@ -826,30 +733,24 @@ igraph_compose: ####################################### igraph_maxflow_value: - IGNORE: RR, RC, RInit igraph_mincut: igraph_mincut_value: igraph_st_mincut_value: - IGNORE: RR, RC igraph_st_vertex_connectivity: - IGNORE: RR, RC, RInit igraph_vertex_connectivity: igraph_st_edge_connectivity: - IGNORE: RR, RC igraph_edge_connectivity: igraph_edge_disjoint_paths: - IGNORE: RR, RC igraph_vertex_disjoint_paths: - IGNORE: RR, RC igraph_adhesion: @@ -880,7 +781,6 @@ igraph_get_subisomorphisms_vf2_callback: IGNORE: RR, RC igraph_subisomorphic_lad: - IGNORE: RR, RC, RInit # R function is hand-rolled # Despite their names, vertex_color and edge_color are not really colors # but _multiplicities_, so we simply use VECTOR_INT there @@ -896,10 +796,8 @@ igraph_subisomorphic_lad: ####################################### igraph_adjacency_spectral_embedding: - IGNORE: RC igraph_laplacian_spectral_embedding: - IGNORE: RC ####################################### # Eigensolvers @@ -924,23 +822,18 @@ igraph_sir: igraph_running_mean: igraph_random_sample: - IGNORE: RR, RC # Not needed in R igraph_almost_equals: - IGNORE: RR, RC # Not needed in R igraph_cmp_epsilon: - IGNORE: RR, RC # TODO: temporarily disabled igraph_eigen_matrix: - IGNORE: RR, RC # TODO: temporarily disabled igraph_eigen_matrix_symmetric: - IGNORE: RR, RC ####################################### # Finding cycles @@ -985,7 +878,6 @@ igraph_from_prufer: GATTR-PARAM: prufer igraph_minimum_spanning_tree: - IGNORE: RR, RC, RInit igraph_minimum_spanning_tree_unweighted: @@ -1014,31 +906,26 @@ igraph_moran_process: ####################################### igraph_convergence_degree: - IGNORE: RR, RC, RInit # Not needed in R igraph_has_attribute_table: - IGNORE: RR, RC ####################################### # Progress, status handling ####################################### igraph_progress: - IGNORE: RR, RC igraph_status: - IGNORE: RR, RC igraph_strerror: - IGNORE: RR, RC ####################################### # Other functions, documented, graph related ####################################### igraph_expand_path_to_pairs: - IGNORE: RR + DEPS: path ON path igraph_invalidate_cache: PARAMS: INOUT GRAPH graph From 2f91dd9845d6f8019e3d9275c6cd54589c71cc82 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 4 Nov 2025 22:43:32 +0000 Subject: [PATCH 03/10] fix: add back IGNORE for functions with technical implementation issues - Added back IGNORE for 11 non-callback functions that have technical issues - Successfully autogenerated 110 new _impl functions (from 364 to 474) - 15 total IGNORE specs: 4 callbacks + 11 with technical issues Functions with technical issues requiring custom handling: - igraph_get_eid: scalar vs vector parameter type - igraph_sparse_adjacency, igraph_sparse_weighted_adjacency, igraph_weighted_sparsemat: missing SPARSEMAT converter - igraph_layout_merge_dla: GRAPH_PTR_LIST type issue - igraph_community_leading_eigenvector: callback parameter - igraph_subisomorphic_lad: C signature changed - igraph_community_voronoi: optional pointer parameter - igraph_disjoint_union_many, igraph_union_many, igraph_intersection_many: GRAPH_PTR_LIST const pointer issue Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com> --- R/aaa-auto.R | 268 ------------------ src/cpp11.cpp | 242 +++++++++++++++- src/rinterface.c | 486 -------------------------------- tools/stimulus/functions-R.yaml | 26 +- 4 files changed, 258 insertions(+), 764 deletions(-) diff --git a/R/aaa-auto.R b/R/aaa-auto.R index df43cbac6c..42917d7023 100644 --- a/R/aaa-auto.R +++ b/R/aaa-auto.R @@ -304,46 +304,6 @@ edges_impl <- function( res } -get_eid_impl <- function( - graph, - from, - to, - directed = TRUE, - error = TRUE -) { - # Argument checks - ensure_igraph(graph) - from <- as_igraph_vs(graph, from) - if (length(from) == 0) { - cli::cli_abort( - "{.arg from} must specify at least one vertex", - call = rlang::caller_env() - ) - } - to <- as_igraph_vs(graph, to) - if (length(to) == 0) { - cli::cli_abort( - "{.arg to} must specify at least one vertex", - call = rlang::caller_env() - ) - } - directed <- as.logical(directed) - error <- as.logical(error) - - on.exit(.Call(R_igraph_finalizer)) - # Function call - res <- .Call( - R_igraph_get_eid, - graph, - from - 1, - to - 1, - directed, - error - ) - - res -} - get_eids_impl <- function( graph, pairs, @@ -507,48 +467,6 @@ adjacency_impl <- function( res } -sparse_adjacency_impl <- function( - adjmatrix, - mode = DIRECTED, - loops = c("once", "none", "twice") -) { - # Argument checks - requireNamespace("Matrix", quietly = TRUE); adjmatrix <- as(as(as(adjmatrix, "dMatrix"), "generalMatrix"), "CsparseMatrix") - loops <- switch_igraph_arg(loops, "none" = 0L, "twice" = 1L, "once" = 2L) - - on.exit(.Call(R_igraph_finalizer)) - # Function call - res <- .Call( - R_igraph_sparse_adjacency, - adjmatrix, - mode, - loops - ) - - res -} - -sparse_weighted_adjacency_impl <- function( - adjmatrix, - mode = DIRECTED, - loops = c("once", "none", "twice") -) { - # Argument checks - requireNamespace("Matrix", quietly = TRUE); adjmatrix <- as(as(as(adjmatrix, "dMatrix"), "generalMatrix"), "CsparseMatrix") - loops <- switch_igraph_arg(loops, "none" = 0L, "twice" = 1L, "once" = 2L) - - on.exit(.Call(R_igraph_finalizer)) - # Function call - res <- .Call( - R_igraph_sparse_weighted_adjacency, - adjmatrix, - mode, - loops - ) - - res -} - weighted_adjacency_impl <- function( adjmatrix, mode = DIRECTED, @@ -1312,30 +1230,6 @@ turan_impl <- function( res } -weighted_sparsemat_impl <- function( - A, - directed, - attr, - loops = FALSE -) { - # Argument checks - requireNamespace("Matrix", quietly = TRUE); A <- as(as(as(A, "dMatrix"), "generalMatrix"), "CsparseMatrix") - directed <- as.logical(directed) - loops <- as.logical(loops) - - on.exit(.Call(R_igraph_finalizer)) - # Function call - res <- .Call( - R_igraph_weighted_sparsemat, - A, - directed, - attr, - loops - ) - - res -} - barabasi_game_impl <- function( n, power = 1.0, @@ -8347,24 +8241,6 @@ layout_drl_3d_impl <- function( res } -layout_merge_dla_impl <- function( - graphs, - coords -) { - # Argument checks - - - on.exit(.Call(R_igraph_finalizer)) - # Function call - res <- .Call( - R_igraph_layout_merge_dla, - graphs, - coords - ) - - res -} - layout_sugiyama_impl <- function( graph, layers = NULL, @@ -9258,44 +9134,6 @@ reindex_membership_impl <- function( res } -community_leading_eigenvector_impl <- function( - graph, - weights = NULL, - steps = -1, - options = arpack_defaults(), - start = FALSE, - callback = NULL -) { - # Argument checks - ensure_igraph(graph) - if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { - weights <- E(graph)$weight - } - if (!is.null(weights) && !all(is.na(weights))) { - weights <- as.numeric(weights) - } else { - weights <- NULL - } - steps <- as.numeric(steps) - options <- modify_list(arpack_defaults(), options) - start <- as.logical(start) - - on.exit(.Call(R_igraph_finalizer)) - # Function call - res <- .Call( - R_igraph_community_leading_eigenvector, - graph, - weights, - steps, - options, - start, - callback - ) - - class(res) <- "igraph.eigenc" - res -} - community_fluid_communities_impl <- function( graph, no_of_communities @@ -9526,48 +9364,6 @@ community_infomap_impl <- function( res } -community_voronoi_impl <- function( - graph, - lengths = NULL, - weights = NULL, - mode = c("out", "in", "all", "total"), - radius = -1 -) { - # Argument checks - ensure_igraph(graph) - if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { - weights <- E(graph)$weight - } - if (!is.null(weights) && !all(is.na(weights))) { - weights <- as.numeric(weights) - } else { - weights <- NULL - } - mode <- switch_igraph_arg( - mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) - radius <- as.numeric(radius) - - on.exit(.Call(R_igraph_finalizer)) - # Function call - res <- .Call( - R_igraph_community_voronoi, - graph, - lengths, - weights, - mode, - radius - ) - if (igraph_opt("return.vs.es")) { - res$generators <- create_vs(graph, res$generators) - } - res -} - graphlets_impl <- function( graph, weights = NULL, @@ -10969,22 +10765,6 @@ disjoint_union_impl <- function( res } -disjoint_union_many_impl <- function( - graphs -) { - # Argument checks - - - on.exit(.Call(R_igraph_finalizer)) - # Function call - res <- .Call( - R_igraph_disjoint_union_many, - graphs - ) - - res -} - join_impl <- function( left, right @@ -11023,22 +10803,6 @@ union_impl <- function( res } -union_many_impl <- function( - graphs -) { - # Argument checks - - - on.exit(.Call(R_igraph_finalizer)) - # Function call - res <- .Call( - R_igraph_union_many, - graphs - ) - - res -} - intersection_impl <- function( left, right @@ -11058,22 +10822,6 @@ intersection_impl <- function( res } -intersection_many_impl <- function( - graphs -) { - # Argument checks - - - on.exit(.Call(R_igraph_finalizer)) - # Function call - res <- .Call( - R_igraph_intersection_many, - graphs - ) - - res -} - difference_impl <- function( orig, sub @@ -12802,22 +12550,6 @@ automorphism_group_impl <- function( res } -subisomorphic_lad_impl <- function( - graph -) { - # Argument checks - ensure_igraph(graph) - - on.exit(.Call(R_igraph_finalizer)) - # Function call - res <- .Call( - R_igraph_subisomorphic_lad, - graph - ) - - res -} - simplify_and_colorize_impl <- function( graph ) { diff --git a/src/cpp11.cpp b/src/cpp11.cpp index 41b9234ccc..96e9cfb9e8 100644 --- a/src/cpp11.cpp +++ b/src/cpp11.cpp @@ -22,35 +22,49 @@ extern "C" SEXP _igraph_getsphere(SEXP spos, SEXP sradius, SEXP scolor, SEXP lig extern "C" { /* .Call calls */ +extern SEXP R_igraph_add_edge(SEXP, SEXP, SEXP); extern SEXP R_igraph_add_edges(SEXP, SEXP); extern SEXP R_igraph_add_vertices(SEXP, 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_adjlist(SEXP, SEXP, SEXP); extern SEXP R_igraph_all_minimal_st_separators(SEXP); extern SEXP R_igraph_all_st_cuts(SEXP, SEXP, SEXP); extern SEXP R_igraph_all_st_mincuts(SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_almost_equals(SEXP, SEXP, SEXP); extern SEXP R_igraph_are_adjacent(SEXP, SEXP, SEXP); +extern SEXP R_igraph_are_connected(SEXP, SEXP, SEXP); extern SEXP R_igraph_articulation_points(SEXP); extern SEXP R_igraph_assortativity(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_assortativity_degree(SEXP, SEXP); extern SEXP R_igraph_assortativity_nominal(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_asymmetric_preference_game(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_atlas(SEXP); +extern SEXP R_igraph_authority_score(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_automorphism_group(SEXP, SEXP, SEXP); extern SEXP R_igraph_average_local_efficiency(SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_average_path_length(SEXP, SEXP, SEXP); extern SEXP R_igraph_average_path_length_dijkstra(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_avg_nearest_neighbor_degree(SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_barabasi_aging_game(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_barabasi_game(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_betweenness(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_betweenness_cutoff(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_betweenness_subset(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_bfs(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_bfs_simple(SEXP, SEXP, SEXP); extern SEXP R_igraph_biadjacency(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_bibcoupling(SEXP, SEXP); extern SEXP R_igraph_biconnected_components(SEXP); +extern SEXP R_igraph_bipartite_game(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_bipartite_game_gnm(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_bipartite_game_gnp(SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_bipartite_projection(SEXP, SEXP, SEXP); extern SEXP R_igraph_bipartite_projection_size(SEXP, SEXP); extern SEXP R_igraph_bond_percolation(SEXP, SEXP); extern SEXP R_igraph_bridges(SEXP); +extern SEXP R_igraph_callaway_traits_game(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_canonical_permutation(SEXP, SEXP, SEXP); extern SEXP R_igraph_centralization(SEXP, SEXP, SEXP); extern SEXP R_igraph_centralization_betweenness(SEXP, SEXP, SEXP); @@ -63,26 +77,39 @@ extern SEXP R_igraph_centralization_eigenvector_centrality(SEXP, SEXP, SEXP, SEX extern SEXP R_igraph_centralization_eigenvector_centrality_tmax(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_chung_lu_game(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_circulant(SEXP, SEXP, SEXP); +extern SEXP R_igraph_cited_type_game(SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_citing_cited_type_game(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_clique_number(SEXP); extern SEXP R_igraph_clique_size_hist(SEXP, SEXP, SEXP); extern SEXP R_igraph_cliques(SEXP, SEXP, SEXP); extern SEXP R_igraph_closeness(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_closeness_cutoff(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_cmp_epsilon(SEXP, SEXP, SEXP); extern SEXP R_igraph_cocitation(SEXP, SEXP); extern SEXP R_igraph_cohesion(SEXP, SEXP); extern SEXP R_igraph_cohesive_blocks(SEXP); +extern SEXP R_igraph_community_eb_get_merges(SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_community_edge_betweenness(SEXP, SEXP, SEXP); +extern SEXP R_igraph_community_fastgreedy(SEXP, SEXP); extern SEXP R_igraph_community_fluid_communities(SEXP, SEXP); extern SEXP R_igraph_community_infomap(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_community_label_propagation(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_community_leiden(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_community_multilevel(SEXP, SEXP, SEXP); extern SEXP R_igraph_community_optimal_modularity(SEXP, SEXP); +extern SEXP R_igraph_community_spinglass(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_community_spinglass_single(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_community_to_membership(SEXP, SEXP, SEXP); +extern SEXP R_igraph_community_voronoi(SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_community_walktrap(SEXP, SEXP, SEXP); extern SEXP R_igraph_compare_communities(SEXP, SEXP, SEXP); extern SEXP R_igraph_complementer(SEXP, SEXP); extern SEXP R_igraph_compose(SEXP, SEXP); +extern SEXP R_igraph_connect_neighborhood(SEXP, SEXP, SEXP); extern SEXP R_igraph_connected_components(SEXP, SEXP); extern SEXP R_igraph_constraint(SEXP, SEXP, SEXP); extern SEXP R_igraph_contract_vertices(SEXP, SEXP, SEXP); +extern SEXP R_igraph_convergence_degree(SEXP); extern SEXP R_igraph_convex_hull_2d(SEXP); extern SEXP R_igraph_copy(SEXP); extern SEXP R_igraph_coreness(SEXP, SEXP); @@ -96,39 +123,62 @@ 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_cycle_graph(SEXP, SEXP, SEXP); extern SEXP R_igraph_de_bruijn(SEXP, SEXP); +extern SEXP R_igraph_decompose(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_degree(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_degree_correlation_vector(SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_degree_sequence_game(SEXP, SEXP, SEXP); extern SEXP R_igraph_delete_edges(SEXP, SEXP); extern SEXP R_igraph_delete_vertices(SEXP, SEXP); extern SEXP R_igraph_delete_vertices_idx(SEXP, SEXP); extern SEXP R_igraph_density(SEXP, SEXP); extern SEXP R_igraph_deterministic_optimal_imitation(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_dfs(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_diameter(SEXP, SEXP, SEXP); +extern SEXP R_igraph_diameter_dijkstra(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_difference(SEXP, SEXP); extern SEXP R_igraph_dim_select(SEXP); extern SEXP R_igraph_disjoint_union(SEXP, SEXP); +extern SEXP R_igraph_disjoint_union_many(SEXP); +extern SEXP R_igraph_distances(SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_distances_bellman_ford(SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_distances_cutoff(SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_distances_dijkstra(SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_distances_dijkstra_cutoff(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_distances_floyd_warshall(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_distances_johnson(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_diversity(SEXP, SEXP, SEXP); extern SEXP R_igraph_dominator_tree(SEXP, SEXP, SEXP); extern SEXP R_igraph_dot_product_game(SEXP, SEXP); extern SEXP R_igraph_dyad_census(SEXP); extern SEXP R_igraph_ecc(SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_eccentricity(SEXP, SEXP, SEXP); extern SEXP R_igraph_eccentricity_dijkstra(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_ecount(SEXP); +extern SEXP R_igraph_edge(SEXP, SEXP); extern SEXP R_igraph_edge_betweenness(SEXP, SEXP, SEXP); extern SEXP R_igraph_edge_betweenness_cutoff(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_edge_betweenness_subset(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_edge_connectivity(SEXP, SEXP); +extern SEXP R_igraph_edge_disjoint_paths(SEXP, SEXP, SEXP); extern SEXP R_igraph_edgelist_percolation(SEXP); extern SEXP R_igraph_edges(SEXP, SEXP); extern SEXP R_igraph_eigen_adjacency(SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_eigen_matrix(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_eigen_matrix_symmetric(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_eigenvector_centrality(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_empty(SEXP, SEXP); +extern SEXP R_igraph_empty_attrs(SEXP, SEXP); extern SEXP R_igraph_erdos_renyi_game_gnm(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_erdos_renyi_game_gnp(SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_establishment_game(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_eulerian_cycle(SEXP); extern SEXP R_igraph_eulerian_path(SEXP); extern SEXP R_igraph_even_tarjan_reduction(SEXP); +extern SEXP R_igraph_expand_path_to_pairs(SEXP); extern SEXP R_igraph_extended_chordal_ring(SEXP, SEXP, SEXP); extern SEXP R_igraph_famous(SEXP); extern SEXP R_igraph_feedback_arc_set(SEXP, SEXP, SEXP); @@ -138,11 +188,13 @@ extern SEXP R_igraph_find_cycle(SEXP, SEXP); extern SEXP R_igraph_forest_fire_game(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_from_hrg_dendrogram(SEXP); extern SEXP R_igraph_from_prufer(SEXP); +extern SEXP R_igraph_full(SEXP, SEXP, SEXP); extern SEXP R_igraph_full_bipartite(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_full_citation(SEXP, SEXP); extern SEXP R_igraph_full_multipartite(SEXP, SEXP, SEXP); extern SEXP R_igraph_fundamental_cycles(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_generalized_petersen(SEXP, SEXP); +extern SEXP R_igraph_get_adjacency(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_get_adjacency_sparse(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_get_all_eids_between(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_get_all_shortest_paths(SEXP, SEXP, SEXP, SEXP); @@ -150,14 +202,19 @@ extern SEXP R_igraph_get_all_shortest_paths_dijkstra(SEXP, SEXP, SEXP, SEXP, SEX extern SEXP R_igraph_get_all_simple_paths(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_get_biadjacency(SEXP, SEXP); extern SEXP R_igraph_get_edgelist(SEXP, SEXP); +extern SEXP R_igraph_get_eids(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_get_isomorphisms_vf2(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_get_isomorphisms_vf2_callback(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_get_k_shortest_paths(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_get_laplacian(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_get_laplacian_sparse(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_get_shortest_path(SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_get_shortest_path_astar(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_get_shortest_path_bellman_ford(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_get_shortest_path_dijkstra(SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_get_shortest_paths(SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_get_shortest_paths_bellman_ford(SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_get_shortest_paths_dijkstra(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_get_stochastic(SEXP, SEXP, SEXP); extern SEXP R_igraph_get_stochastic_sparse(SEXP, SEXP, SEXP); extern SEXP R_igraph_get_subisomorphisms_vf2(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); @@ -166,13 +223,18 @@ extern SEXP R_igraph_get_widest_paths(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_girth(SEXP); extern SEXP R_igraph_global_efficiency(SEXP, SEXP, SEXP); extern SEXP R_igraph_gomory_hu_tree(SEXP, SEXP); +extern SEXP R_igraph_graph_center(SEXP, SEXP); extern SEXP R_igraph_graph_center_dijkstra(SEXP, SEXP, SEXP); extern SEXP R_igraph_graph_count(SEXP, SEXP); extern SEXP R_igraph_graph_power(SEXP, SEXP, SEXP); +extern SEXP R_igraph_graphlets(SEXP, SEXP, SEXP); extern SEXP R_igraph_graphlets_candidate_basis(SEXP, SEXP); extern SEXP R_igraph_graphlets_project(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_grg_game(SEXP, SEXP, SEXP); extern SEXP R_igraph_growing_random_game(SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_harmonic_centrality(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_harmonic_centrality_cutoff(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_has_attribute_table(void); extern SEXP R_igraph_has_loop(SEXP); extern SEXP R_igraph_has_multiple(SEXP); extern SEXP R_igraph_has_mutual(SEXP, SEXP); @@ -188,17 +250,22 @@ extern SEXP R_igraph_hrg_size(SEXP); extern SEXP R_igraph_hsbm_game(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_hsbm_list_game(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_hub_and_authority_scores(SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_hub_score(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_hypercube(SEXP, SEXP); extern SEXP R_igraph_incident(SEXP, SEXP, SEXP); extern SEXP R_igraph_independence_number(SEXP); +extern SEXP R_igraph_independent_vertex_sets(SEXP, SEXP, SEXP); extern SEXP R_igraph_induced_subgraph(SEXP, SEXP, SEXP); extern SEXP R_igraph_induced_subgraph_map(SEXP, SEXP, SEXP); extern SEXP R_igraph_intersection(SEXP, SEXP); +extern SEXP R_igraph_intersection_many(SEXP); extern SEXP R_igraph_invalidate_cache(SEXP); extern SEXP R_igraph_is_acyclic(SEXP); extern SEXP R_igraph_is_biconnected(SEXP); +extern SEXP R_igraph_is_bigraphical(SEXP, SEXP, SEXP); extern SEXP R_igraph_is_bipartite(SEXP); extern SEXP R_igraph_is_bipartite_coloring(SEXP, SEXP); +extern SEXP R_igraph_is_chordal(SEXP, SEXP, SEXP); extern SEXP R_igraph_is_clique(SEXP, SEXP, SEXP); extern SEXP R_igraph_is_complete(SEXP); extern SEXP R_igraph_is_connected(SEXP, SEXP); @@ -216,6 +283,7 @@ extern SEXP R_igraph_is_minimal_separator(SEXP, SEXP); extern SEXP R_igraph_is_multiple(SEXP, SEXP); extern SEXP R_igraph_is_mutual(SEXP, SEXP, SEXP); extern SEXP R_igraph_is_perfect(SEXP); +extern SEXP R_igraph_is_same_graph(SEXP, SEXP); extern SEXP R_igraph_is_separator(SEXP, SEXP); extern SEXP R_igraph_is_simple(SEXP); extern SEXP R_igraph_is_tree(SEXP, SEXP); @@ -231,20 +299,33 @@ extern SEXP R_igraph_joint_degree_distribution(SEXP, SEXP, SEXP, SEXP, SEXP, SEX extern SEXP R_igraph_joint_degree_matrix(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_joint_type_distribution(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_k_regular_game(SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_kary_tree(SEXP, SEXP, SEXP); extern SEXP R_igraph_kautz(SEXP, SEXP); +extern SEXP R_igraph_laplacian_spectral_embedding(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_largest_cliques(SEXP); extern SEXP R_igraph_largest_independent_vertex_sets(SEXP); extern SEXP R_igraph_largest_weighted_cliques(SEXP, SEXP); +extern SEXP R_igraph_lastcit_game(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_layout_align(SEXP, SEXP); extern SEXP R_igraph_layout_bipartite(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_layout_circle(SEXP, SEXP); extern SEXP R_igraph_layout_davidson_harel(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_layout_drl(SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_layout_drl_3d(SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_layout_fruchterman_reingold(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_layout_fruchterman_reingold_3d(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_layout_gem(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_layout_graphopt(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_layout_grid(SEXP, SEXP); extern SEXP R_igraph_layout_grid_3d(SEXP, SEXP, SEXP); +extern SEXP R_igraph_layout_kamada_kawai(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_layout_kamada_kawai_3d(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_layout_lgl(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_layout_mds(SEXP, SEXP, SEXP); extern SEXP R_igraph_layout_random(SEXP); extern SEXP R_igraph_layout_random_3d(SEXP); +extern SEXP R_igraph_layout_reingold_tilford(SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_layout_reingold_tilford_circular(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_layout_sphere(SEXP); extern SEXP R_igraph_layout_star(SEXP, SEXP, SEXP); extern SEXP R_igraph_layout_sugiyama(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); @@ -252,6 +333,7 @@ extern SEXP R_igraph_layout_umap(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_layout_umap_3d(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_layout_umap_compute_weights(SEXP, SEXP, SEXP); extern SEXP R_igraph_lcf_vector(SEXP, SEXP, SEXP); +extern SEXP R_igraph_le_community_to_membership(SEXP, SEXP, SEXP); extern SEXP R_igraph_linegraph(SEXP); extern SEXP R_igraph_list_triangles(SEXP); extern SEXP R_igraph_local_efficiency(SEXP, SEXP, SEXP, SEXP, SEXP); @@ -265,8 +347,12 @@ extern SEXP R_igraph_local_scan_neighborhood_ecount(SEXP, SEXP, SEXP); extern SEXP R_igraph_local_scan_subset_ecount(SEXP, SEXP, SEXP); extern SEXP R_igraph_maxdegree(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_maxflow(SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_maxflow_value(SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_maximal_cliques(SEXP, SEXP, SEXP); extern SEXP R_igraph_maximal_cliques_count(SEXP, SEXP, SEXP); +extern SEXP R_igraph_maximal_cliques_file(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_maximal_cliques_hist(SEXP, SEXP, SEXP); +extern SEXP R_igraph_maximal_cliques_subset(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_maximal_independent_vertex_sets(SEXP); extern SEXP R_igraph_maximum_bipartite_matching(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_maximum_cardinality_search(SEXP); @@ -275,6 +361,7 @@ extern SEXP R_igraph_mincut(SEXP, SEXP); extern SEXP R_igraph_mincut_value(SEXP, SEXP); extern SEXP R_igraph_minimum_cycle_basis(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_minimum_size_separators(SEXP); +extern SEXP R_igraph_minimum_spanning_tree(SEXP, SEXP); extern SEXP R_igraph_minimum_spanning_tree_prim(SEXP, SEXP); extern SEXP R_igraph_minimum_spanning_tree_unweighted(SEXP); extern SEXP R_igraph_modularity(SEXP, SEXP, SEXP, SEXP, SEXP); @@ -285,7 +372,11 @@ extern SEXP R_igraph_motifs_randesu_estimate(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_motifs_randesu_no(SEXP, SEXP, SEXP); extern SEXP R_igraph_mycielski_graph(SEXP); extern SEXP R_igraph_mycielskian(SEXP, SEXP); +extern SEXP R_igraph_neighborhood(SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_neighborhood_graphs(SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_neighborhood_size(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_neighbors(SEXP, SEXP, SEXP); +extern SEXP R_igraph_pagerank(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_path_graph(SEXP, SEXP, SEXP); extern SEXP R_igraph_path_length_hist(SEXP, SEXP); extern SEXP R_igraph_permute_vertices(SEXP, SEXP); @@ -294,20 +385,31 @@ extern SEXP R_igraph_personalized_pagerank_vs(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP extern SEXP R_igraph_power_law_fit(SEXP, SEXP, SEXP); extern SEXP R_igraph_preference_game(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_product(SEXP, SEXP, SEXP); +extern SEXP R_igraph_progress(SEXP, SEXP); extern SEXP R_igraph_pseudo_diameter(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_pseudo_diameter_dijkstra(SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_radius(SEXP, SEXP); extern SEXP R_igraph_radius_dijkstra(SEXP, SEXP, SEXP); +extern SEXP R_igraph_random_edge_walk(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_random_sample(SEXP, SEXP, SEXP); extern SEXP R_igraph_random_spanning_tree(SEXP, SEXP); extern SEXP R_igraph_random_walk(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_read_graph_dimacs_flow(SEXP, SEXP); extern SEXP R_igraph_read_graph_dl(SEXP, SEXP); +extern SEXP R_igraph_read_graph_edgelist(SEXP, SEXP, SEXP); extern SEXP R_igraph_read_graph_gml(SEXP); extern SEXP R_igraph_read_graph_graphdb(SEXP, SEXP); extern SEXP R_igraph_read_graph_graphml(SEXP, SEXP); +extern SEXP R_igraph_read_graph_lgl(SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_read_graph_ncol(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_read_graph_pajek(SEXP); extern SEXP R_igraph_realize_bipartite_degree_sequence(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_realize_degree_sequence(SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_recent_degree_aging_game(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_recent_degree_game(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_reciprocity(SEXP, SEXP, SEXP); extern SEXP R_igraph_regular_tree(SEXP, SEXP, SEXP); +extern SEXP R_igraph_reindex_membership(SEXP); extern SEXP R_igraph_residual_graph(SEXP, SEXP, SEXP); extern SEXP R_igraph_reverse_edges(SEXP, SEXP); extern SEXP R_igraph_reverse_residual_graph(SEXP, SEXP, SEXP); @@ -315,6 +417,7 @@ extern SEXP R_igraph_rewire(SEXP, SEXP, SEXP); extern SEXP R_igraph_rewire_directed_edges(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_rewire_edges(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_rich_club_sequence(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_ring(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_rooted_product(SEXP, SEXP, SEXP); extern SEXP R_igraph_roots_for_tree_layout(SEXP, SEXP, SEXP); extern SEXP R_igraph_roulette_wheel_imitation(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); @@ -340,11 +443,18 @@ extern SEXP R_igraph_solve_lsap(SEXP, SEXP); extern SEXP R_igraph_spanner(SEXP, SEXP, SEXP); extern SEXP R_igraph_split_join_distance(SEXP, SEXP); extern SEXP R_igraph_square_lattice(SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_st_edge_connectivity(SEXP, SEXP, SEXP); extern SEXP R_igraph_st_mincut(SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_st_mincut_value(SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_st_vertex_connectivity(SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_star(SEXP, SEXP, SEXP); extern SEXP R_igraph_static_fitness_game(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_static_power_law_game(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_status(SEXP); extern SEXP R_igraph_stochastic_imitation(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_strength(SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_strerror(SEXP); +extern SEXP R_igraph_subcomponent(SEXP, SEXP, SEXP); extern SEXP R_igraph_subgraph_from_edges(SEXP, SEXP, SEXP); extern SEXP R_igraph_subisomorphic(SEXP, SEXP); extern SEXP R_igraph_subisomorphic_vf2(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); @@ -367,22 +477,30 @@ extern SEXP R_igraph_trussness(SEXP); extern SEXP R_igraph_turan(SEXP, SEXP); extern SEXP R_igraph_unfold_tree(SEXP, SEXP, SEXP); extern SEXP R_igraph_union(SEXP, SEXP); +extern SEXP R_igraph_union_many(SEXP); extern SEXP R_igraph_vcount(SEXP); extern SEXP R_igraph_version(void); extern SEXP R_igraph_vertex_coloring_greedy(SEXP, SEXP); extern SEXP R_igraph_vertex_connectivity(SEXP, SEXP); +extern SEXP R_igraph_vertex_disjoint_paths(SEXP, SEXP, SEXP); extern SEXP R_igraph_vertex_path_from_edge_path(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_voronoi(SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_watts_strogatz_game(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_weighted_adjacency(SEXP, SEXP, SEXP); extern SEXP R_igraph_weighted_clique_number(SEXP, SEXP); extern SEXP R_igraph_weighted_cliques(SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_weighted_sparsemat(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_wheel(SEXP, SEXP, SEXP); extern SEXP R_igraph_widest_path_widths_dijkstra(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_widest_path_widths_floyd_warshall(SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_write_graph_dimacs_flow(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_write_graph_dot(SEXP, SEXP); extern SEXP R_igraph_write_graph_edgelist(SEXP, SEXP); extern SEXP R_igraph_write_graph_gml(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_write_graph_graphml(SEXP, SEXP, SEXP); extern SEXP R_igraph_write_graph_leda(SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_write_graph_lgl(SEXP, SEXP, SEXP, SEXP, SEXP); +extern SEXP R_igraph_write_graph_ncol(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_write_graph_pajek(SEXP, SEXP); extern SEXP Rx_igraph_add_edges_manual(SEXP, SEXP); extern SEXP Rx_igraph_add_env(SEXP); @@ -390,7 +508,6 @@ extern SEXP Rx_igraph_add_myid_to_env(SEXP); extern SEXP Rx_igraph_add_version_to_env(SEXP); extern SEXP Rx_igraph_address(SEXP); extern SEXP Rx_igraph_adjacency(SEXP, SEXP, SEXP); -extern SEXP Rx_igraph_adjacency_spectral_embedding(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP Rx_igraph_adjacent_vertices(SEXP, SEXP, SEXP); extern SEXP Rx_igraph_arpack(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP Rx_igraph_arpack_unpack_complex(SEXP, SEXP, SEXP); @@ -439,7 +556,6 @@ extern SEXP Rx_igraph_get_graph_id(SEXP); extern SEXP Rx_igraph_get_shortest_paths(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP Rx_igraph_girth(SEXP, SEXP); extern SEXP Rx_igraph_graph_version(SEXP); -extern SEXP Rx_igraph_graphlets(SEXP, SEXP, SEXP); extern SEXP Rx_igraph_grg_game(SEXP, SEXP, SEXP, SEXP); extern SEXP Rx_igraph_i_levc_arp(SEXP, SEXP, SEXP); extern SEXP Rx_igraph_identical_graphs(SEXP, SEXP, SEXP); @@ -448,7 +564,6 @@ extern SEXP Rx_igraph_independent_vertex_sets(SEXP, SEXP, SEXP); extern SEXP Rx_igraph_intersection(SEXP, SEXP); extern SEXP Rx_igraph_is_chordal(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP Rx_igraph_kary_tree(SEXP, SEXP, SEXP); -extern SEXP Rx_igraph_laplacian_spectral_embedding(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP Rx_igraph_lastcit_game(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP Rx_igraph_layout_drl(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP Rx_igraph_layout_drl_3d(SEXP, SEXP, SEXP, SEXP, SEXP); @@ -509,35 +624,49 @@ extern SEXP Rx_igraph_write_graph_ncol(SEXP, SEXP, SEXP, SEXP); extern SEXP UUID_gen(SEXP); static const R_CallMethodDef CallEntries[] = { + {"R_igraph_add_edge", (DL_FUNC) &R_igraph_add_edge, 3}, {"R_igraph_add_edges", (DL_FUNC) &R_igraph_add_edges, 2}, {"R_igraph_add_vertices", (DL_FUNC) &R_igraph_add_vertices, 2}, {"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_adjlist", (DL_FUNC) &R_igraph_adjlist, 3}, {"R_igraph_all_minimal_st_separators", (DL_FUNC) &R_igraph_all_minimal_st_separators, 1}, {"R_igraph_all_st_cuts", (DL_FUNC) &R_igraph_all_st_cuts, 3}, {"R_igraph_all_st_mincuts", (DL_FUNC) &R_igraph_all_st_mincuts, 4}, + {"R_igraph_almost_equals", (DL_FUNC) &R_igraph_almost_equals, 3}, {"R_igraph_are_adjacent", (DL_FUNC) &R_igraph_are_adjacent, 3}, + {"R_igraph_are_connected", (DL_FUNC) &R_igraph_are_connected, 3}, {"R_igraph_articulation_points", (DL_FUNC) &R_igraph_articulation_points, 1}, {"R_igraph_assortativity", (DL_FUNC) &R_igraph_assortativity, 5}, {"R_igraph_assortativity_degree", (DL_FUNC) &R_igraph_assortativity_degree, 2}, {"R_igraph_assortativity_nominal", (DL_FUNC) &R_igraph_assortativity_nominal, 4}, {"R_igraph_asymmetric_preference_game", (DL_FUNC) &R_igraph_asymmetric_preference_game, 6}, {"R_igraph_atlas", (DL_FUNC) &R_igraph_atlas, 1}, + {"R_igraph_authority_score", (DL_FUNC) &R_igraph_authority_score, 4}, {"R_igraph_automorphism_group", (DL_FUNC) &R_igraph_automorphism_group, 3}, {"R_igraph_average_local_efficiency", (DL_FUNC) &R_igraph_average_local_efficiency, 4}, + {"R_igraph_average_path_length", (DL_FUNC) &R_igraph_average_path_length, 3}, {"R_igraph_average_path_length_dijkstra", (DL_FUNC) &R_igraph_average_path_length_dijkstra, 4}, {"R_igraph_avg_nearest_neighbor_degree", (DL_FUNC) &R_igraph_avg_nearest_neighbor_degree, 5}, + {"R_igraph_barabasi_aging_game", (DL_FUNC) &R_igraph_barabasi_aging_game, 12}, + {"R_igraph_barabasi_game", (DL_FUNC) &R_igraph_barabasi_game, 9}, + {"R_igraph_betweenness", (DL_FUNC) &R_igraph_betweenness, 4}, {"R_igraph_betweenness_cutoff", (DL_FUNC) &R_igraph_betweenness_cutoff, 5}, {"R_igraph_betweenness_subset", (DL_FUNC) &R_igraph_betweenness_subset, 6}, + {"R_igraph_bfs", (DL_FUNC) &R_igraph_bfs, 7}, {"R_igraph_bfs_simple", (DL_FUNC) &R_igraph_bfs_simple, 3}, {"R_igraph_biadjacency", (DL_FUNC) &R_igraph_biadjacency, 4}, {"R_igraph_bibcoupling", (DL_FUNC) &R_igraph_bibcoupling, 2}, {"R_igraph_biconnected_components", (DL_FUNC) &R_igraph_biconnected_components, 1}, + {"R_igraph_bipartite_game", (DL_FUNC) &R_igraph_bipartite_game, 7}, {"R_igraph_bipartite_game_gnm", (DL_FUNC) &R_igraph_bipartite_game_gnm, 5}, {"R_igraph_bipartite_game_gnp", (DL_FUNC) &R_igraph_bipartite_game_gnp, 5}, + {"R_igraph_bipartite_projection", (DL_FUNC) &R_igraph_bipartite_projection, 3}, {"R_igraph_bipartite_projection_size", (DL_FUNC) &R_igraph_bipartite_projection_size, 2}, {"R_igraph_bond_percolation", (DL_FUNC) &R_igraph_bond_percolation, 2}, {"R_igraph_bridges", (DL_FUNC) &R_igraph_bridges, 1}, + {"R_igraph_callaway_traits_game", (DL_FUNC) &R_igraph_callaway_traits_game, 6}, {"R_igraph_canonical_permutation", (DL_FUNC) &R_igraph_canonical_permutation, 3}, {"R_igraph_centralization", (DL_FUNC) &R_igraph_centralization, 3}, {"R_igraph_centralization_betweenness", (DL_FUNC) &R_igraph_centralization_betweenness, 3}, @@ -550,26 +679,39 @@ static const R_CallMethodDef CallEntries[] = { {"R_igraph_centralization_eigenvector_centrality_tmax", (DL_FUNC) &R_igraph_centralization_eigenvector_centrality_tmax, 4}, {"R_igraph_chung_lu_game", (DL_FUNC) &R_igraph_chung_lu_game, 4}, {"R_igraph_circulant", (DL_FUNC) &R_igraph_circulant, 3}, + {"R_igraph_cited_type_game", (DL_FUNC) &R_igraph_cited_type_game, 5}, + {"R_igraph_citing_cited_type_game", (DL_FUNC) &R_igraph_citing_cited_type_game, 5}, {"R_igraph_clique_number", (DL_FUNC) &R_igraph_clique_number, 1}, {"R_igraph_clique_size_hist", (DL_FUNC) &R_igraph_clique_size_hist, 3}, {"R_igraph_cliques", (DL_FUNC) &R_igraph_cliques, 3}, {"R_igraph_closeness", (DL_FUNC) &R_igraph_closeness, 5}, {"R_igraph_closeness_cutoff", (DL_FUNC) &R_igraph_closeness_cutoff, 6}, + {"R_igraph_cmp_epsilon", (DL_FUNC) &R_igraph_cmp_epsilon, 3}, {"R_igraph_cocitation", (DL_FUNC) &R_igraph_cocitation, 2}, {"R_igraph_cohesion", (DL_FUNC) &R_igraph_cohesion, 2}, {"R_igraph_cohesive_blocks", (DL_FUNC) &R_igraph_cohesive_blocks, 1}, + {"R_igraph_community_eb_get_merges", (DL_FUNC) &R_igraph_community_eb_get_merges, 4}, + {"R_igraph_community_edge_betweenness", (DL_FUNC) &R_igraph_community_edge_betweenness, 3}, + {"R_igraph_community_fastgreedy", (DL_FUNC) &R_igraph_community_fastgreedy, 2}, {"R_igraph_community_fluid_communities", (DL_FUNC) &R_igraph_community_fluid_communities, 2}, {"R_igraph_community_infomap", (DL_FUNC) &R_igraph_community_infomap, 4}, {"R_igraph_community_label_propagation", (DL_FUNC) &R_igraph_community_label_propagation, 5}, {"R_igraph_community_leiden", (DL_FUNC) &R_igraph_community_leiden, 8}, {"R_igraph_community_multilevel", (DL_FUNC) &R_igraph_community_multilevel, 3}, {"R_igraph_community_optimal_modularity", (DL_FUNC) &R_igraph_community_optimal_modularity, 2}, + {"R_igraph_community_spinglass", (DL_FUNC) &R_igraph_community_spinglass, 11}, + {"R_igraph_community_spinglass_single", (DL_FUNC) &R_igraph_community_spinglass_single, 6}, + {"R_igraph_community_to_membership", (DL_FUNC) &R_igraph_community_to_membership, 3}, + {"R_igraph_community_voronoi", (DL_FUNC) &R_igraph_community_voronoi, 5}, + {"R_igraph_community_walktrap", (DL_FUNC) &R_igraph_community_walktrap, 3}, {"R_igraph_compare_communities", (DL_FUNC) &R_igraph_compare_communities, 3}, {"R_igraph_complementer", (DL_FUNC) &R_igraph_complementer, 2}, {"R_igraph_compose", (DL_FUNC) &R_igraph_compose, 2}, + {"R_igraph_connect_neighborhood", (DL_FUNC) &R_igraph_connect_neighborhood, 3}, {"R_igraph_connected_components", (DL_FUNC) &R_igraph_connected_components, 2}, {"R_igraph_constraint", (DL_FUNC) &R_igraph_constraint, 3}, {"R_igraph_contract_vertices", (DL_FUNC) &R_igraph_contract_vertices, 3}, + {"R_igraph_convergence_degree", (DL_FUNC) &R_igraph_convergence_degree, 1}, {"R_igraph_convex_hull_2d", (DL_FUNC) &R_igraph_convex_hull_2d, 1}, {"R_igraph_copy", (DL_FUNC) &R_igraph_copy, 1}, {"R_igraph_coreness", (DL_FUNC) &R_igraph_coreness, 2}, @@ -583,39 +725,62 @@ static const R_CallMethodDef CallEntries[] = { {"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_cycle_graph", (DL_FUNC) &R_igraph_cycle_graph, 3}, {"R_igraph_de_bruijn", (DL_FUNC) &R_igraph_de_bruijn, 2}, + {"R_igraph_decompose", (DL_FUNC) &R_igraph_decompose, 4}, {"R_igraph_degree", (DL_FUNC) &R_igraph_degree, 4}, {"R_igraph_degree_correlation_vector", (DL_FUNC) &R_igraph_degree_correlation_vector, 5}, + {"R_igraph_degree_sequence_game", (DL_FUNC) &R_igraph_degree_sequence_game, 3}, {"R_igraph_delete_edges", (DL_FUNC) &R_igraph_delete_edges, 2}, {"R_igraph_delete_vertices", (DL_FUNC) &R_igraph_delete_vertices, 2}, {"R_igraph_delete_vertices_idx", (DL_FUNC) &R_igraph_delete_vertices_idx, 2}, {"R_igraph_density", (DL_FUNC) &R_igraph_density, 2}, {"R_igraph_deterministic_optimal_imitation", (DL_FUNC) &R_igraph_deterministic_optimal_imitation, 6}, + {"R_igraph_dfs", (DL_FUNC) &R_igraph_dfs, 6}, + {"R_igraph_diameter", (DL_FUNC) &R_igraph_diameter, 3}, + {"R_igraph_diameter_dijkstra", (DL_FUNC) &R_igraph_diameter_dijkstra, 4}, {"R_igraph_difference", (DL_FUNC) &R_igraph_difference, 2}, {"R_igraph_dim_select", (DL_FUNC) &R_igraph_dim_select, 1}, {"R_igraph_disjoint_union", (DL_FUNC) &R_igraph_disjoint_union, 2}, + {"R_igraph_disjoint_union_many", (DL_FUNC) &R_igraph_disjoint_union_many, 1}, + {"R_igraph_distances", (DL_FUNC) &R_igraph_distances, 4}, + {"R_igraph_distances_bellman_ford", (DL_FUNC) &R_igraph_distances_bellman_ford, 5}, + {"R_igraph_distances_cutoff", (DL_FUNC) &R_igraph_distances_cutoff, 5}, + {"R_igraph_distances_dijkstra", (DL_FUNC) &R_igraph_distances_dijkstra, 5}, + {"R_igraph_distances_dijkstra_cutoff", (DL_FUNC) &R_igraph_distances_dijkstra_cutoff, 6}, + {"R_igraph_distances_floyd_warshall", (DL_FUNC) &R_igraph_distances_floyd_warshall, 6}, + {"R_igraph_distances_johnson", (DL_FUNC) &R_igraph_distances_johnson, 4}, {"R_igraph_diversity", (DL_FUNC) &R_igraph_diversity, 3}, {"R_igraph_dominator_tree", (DL_FUNC) &R_igraph_dominator_tree, 3}, {"R_igraph_dot_product_game", (DL_FUNC) &R_igraph_dot_product_game, 2}, {"R_igraph_dyad_census", (DL_FUNC) &R_igraph_dyad_census, 1}, {"R_igraph_ecc", (DL_FUNC) &R_igraph_ecc, 5}, + {"R_igraph_eccentricity", (DL_FUNC) &R_igraph_eccentricity, 3}, {"R_igraph_eccentricity_dijkstra", (DL_FUNC) &R_igraph_eccentricity_dijkstra, 4}, {"R_igraph_ecount", (DL_FUNC) &R_igraph_ecount, 1}, + {"R_igraph_edge", (DL_FUNC) &R_igraph_edge, 2}, {"R_igraph_edge_betweenness", (DL_FUNC) &R_igraph_edge_betweenness, 3}, {"R_igraph_edge_betweenness_cutoff", (DL_FUNC) &R_igraph_edge_betweenness_cutoff, 4}, {"R_igraph_edge_betweenness_subset", (DL_FUNC) &R_igraph_edge_betweenness_subset, 6}, {"R_igraph_edge_connectivity", (DL_FUNC) &R_igraph_edge_connectivity, 2}, + {"R_igraph_edge_disjoint_paths", (DL_FUNC) &R_igraph_edge_disjoint_paths, 3}, {"R_igraph_edgelist_percolation", (DL_FUNC) &R_igraph_edgelist_percolation, 1}, {"R_igraph_edges", (DL_FUNC) &R_igraph_edges, 2}, {"R_igraph_eigen_adjacency", (DL_FUNC) &R_igraph_eigen_adjacency, 4}, + {"R_igraph_eigen_matrix", (DL_FUNC) &R_igraph_eigen_matrix, 7}, + {"R_igraph_eigen_matrix_symmetric", (DL_FUNC) &R_igraph_eigen_matrix_symmetric, 7}, {"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_gnm", (DL_FUNC) &R_igraph_erdos_renyi_game_gnm, 4}, {"R_igraph_erdos_renyi_game_gnp", (DL_FUNC) &R_igraph_erdos_renyi_game_gnp, 4}, + {"R_igraph_establishment_game", (DL_FUNC) &R_igraph_establishment_game, 6}, {"R_igraph_eulerian_cycle", (DL_FUNC) &R_igraph_eulerian_cycle, 1}, {"R_igraph_eulerian_path", (DL_FUNC) &R_igraph_eulerian_path, 1}, {"R_igraph_even_tarjan_reduction", (DL_FUNC) &R_igraph_even_tarjan_reduction, 1}, + {"R_igraph_expand_path_to_pairs", (DL_FUNC) &R_igraph_expand_path_to_pairs, 1}, {"R_igraph_extended_chordal_ring", (DL_FUNC) &R_igraph_extended_chordal_ring, 3}, {"R_igraph_famous", (DL_FUNC) &R_igraph_famous, 1}, {"R_igraph_feedback_arc_set", (DL_FUNC) &R_igraph_feedback_arc_set, 3}, @@ -625,11 +790,13 @@ static const R_CallMethodDef CallEntries[] = { {"R_igraph_forest_fire_game", (DL_FUNC) &R_igraph_forest_fire_game, 5}, {"R_igraph_from_hrg_dendrogram", (DL_FUNC) &R_igraph_from_hrg_dendrogram, 1}, {"R_igraph_from_prufer", (DL_FUNC) &R_igraph_from_prufer, 1}, + {"R_igraph_full", (DL_FUNC) &R_igraph_full, 3}, {"R_igraph_full_bipartite", (DL_FUNC) &R_igraph_full_bipartite, 4}, {"R_igraph_full_citation", (DL_FUNC) &R_igraph_full_citation, 2}, {"R_igraph_full_multipartite", (DL_FUNC) &R_igraph_full_multipartite, 3}, {"R_igraph_fundamental_cycles", (DL_FUNC) &R_igraph_fundamental_cycles, 4}, {"R_igraph_generalized_petersen", (DL_FUNC) &R_igraph_generalized_petersen, 2}, + {"R_igraph_get_adjacency", (DL_FUNC) &R_igraph_get_adjacency, 4}, {"R_igraph_get_adjacency_sparse", (DL_FUNC) &R_igraph_get_adjacency_sparse, 4}, {"R_igraph_get_all_eids_between", (DL_FUNC) &R_igraph_get_all_eids_between, 4}, {"R_igraph_get_all_shortest_paths", (DL_FUNC) &R_igraph_get_all_shortest_paths, 4}, @@ -637,14 +804,19 @@ static const R_CallMethodDef CallEntries[] = { {"R_igraph_get_all_simple_paths", (DL_FUNC) &R_igraph_get_all_simple_paths, 5}, {"R_igraph_get_biadjacency", (DL_FUNC) &R_igraph_get_biadjacency, 2}, {"R_igraph_get_edgelist", (DL_FUNC) &R_igraph_get_edgelist, 2}, + {"R_igraph_get_eids", (DL_FUNC) &R_igraph_get_eids, 4}, {"R_igraph_get_isomorphisms_vf2", (DL_FUNC) &R_igraph_get_isomorphisms_vf2, 6}, {"R_igraph_get_isomorphisms_vf2_callback", (DL_FUNC) &R_igraph_get_isomorphisms_vf2_callback, 6}, {"R_igraph_get_k_shortest_paths", (DL_FUNC) &R_igraph_get_k_shortest_paths, 6}, {"R_igraph_get_laplacian", (DL_FUNC) &R_igraph_get_laplacian, 4}, {"R_igraph_get_laplacian_sparse", (DL_FUNC) &R_igraph_get_laplacian_sparse, 4}, {"R_igraph_get_shortest_path", (DL_FUNC) &R_igraph_get_shortest_path, 4}, + {"R_igraph_get_shortest_path_astar", (DL_FUNC) &R_igraph_get_shortest_path_astar, 6}, {"R_igraph_get_shortest_path_bellman_ford", (DL_FUNC) &R_igraph_get_shortest_path_bellman_ford, 5}, {"R_igraph_get_shortest_path_dijkstra", (DL_FUNC) &R_igraph_get_shortest_path_dijkstra, 5}, + {"R_igraph_get_shortest_paths", (DL_FUNC) &R_igraph_get_shortest_paths, 4}, + {"R_igraph_get_shortest_paths_bellman_ford", (DL_FUNC) &R_igraph_get_shortest_paths_bellman_ford, 5}, + {"R_igraph_get_shortest_paths_dijkstra", (DL_FUNC) &R_igraph_get_shortest_paths_dijkstra, 5}, {"R_igraph_get_stochastic", (DL_FUNC) &R_igraph_get_stochastic, 3}, {"R_igraph_get_stochastic_sparse", (DL_FUNC) &R_igraph_get_stochastic_sparse, 3}, {"R_igraph_get_subisomorphisms_vf2", (DL_FUNC) &R_igraph_get_subisomorphisms_vf2, 6}, @@ -653,13 +825,18 @@ static const R_CallMethodDef CallEntries[] = { {"R_igraph_girth", (DL_FUNC) &R_igraph_girth, 1}, {"R_igraph_global_efficiency", (DL_FUNC) &R_igraph_global_efficiency, 3}, {"R_igraph_gomory_hu_tree", (DL_FUNC) &R_igraph_gomory_hu_tree, 2}, + {"R_igraph_graph_center", (DL_FUNC) &R_igraph_graph_center, 2}, {"R_igraph_graph_center_dijkstra", (DL_FUNC) &R_igraph_graph_center_dijkstra, 3}, {"R_igraph_graph_count", (DL_FUNC) &R_igraph_graph_count, 2}, {"R_igraph_graph_power", (DL_FUNC) &R_igraph_graph_power, 3}, + {"R_igraph_graphlets", (DL_FUNC) &R_igraph_graphlets, 3}, {"R_igraph_graphlets_candidate_basis", (DL_FUNC) &R_igraph_graphlets_candidate_basis, 2}, {"R_igraph_graphlets_project", (DL_FUNC) &R_igraph_graphlets_project, 6}, + {"R_igraph_grg_game", (DL_FUNC) &R_igraph_grg_game, 3}, {"R_igraph_growing_random_game", (DL_FUNC) &R_igraph_growing_random_game, 4}, + {"R_igraph_harmonic_centrality", (DL_FUNC) &R_igraph_harmonic_centrality, 5}, {"R_igraph_harmonic_centrality_cutoff", (DL_FUNC) &R_igraph_harmonic_centrality_cutoff, 6}, + {"R_igraph_has_attribute_table", (DL_FUNC) &R_igraph_has_attribute_table, 0}, {"R_igraph_has_loop", (DL_FUNC) &R_igraph_has_loop, 1}, {"R_igraph_has_multiple", (DL_FUNC) &R_igraph_has_multiple, 1}, {"R_igraph_has_mutual", (DL_FUNC) &R_igraph_has_mutual, 2}, @@ -675,17 +852,22 @@ static const R_CallMethodDef CallEntries[] = { {"R_igraph_hsbm_game", (DL_FUNC) &R_igraph_hsbm_game, 5}, {"R_igraph_hsbm_list_game", (DL_FUNC) &R_igraph_hsbm_list_game, 5}, {"R_igraph_hub_and_authority_scores", (DL_FUNC) &R_igraph_hub_and_authority_scores, 4}, + {"R_igraph_hub_score", (DL_FUNC) &R_igraph_hub_score, 4}, {"R_igraph_hypercube", (DL_FUNC) &R_igraph_hypercube, 2}, {"R_igraph_incident", (DL_FUNC) &R_igraph_incident, 3}, {"R_igraph_independence_number", (DL_FUNC) &R_igraph_independence_number, 1}, + {"R_igraph_independent_vertex_sets", (DL_FUNC) &R_igraph_independent_vertex_sets, 3}, {"R_igraph_induced_subgraph", (DL_FUNC) &R_igraph_induced_subgraph, 3}, {"R_igraph_induced_subgraph_map", (DL_FUNC) &R_igraph_induced_subgraph_map, 3}, {"R_igraph_intersection", (DL_FUNC) &R_igraph_intersection, 2}, + {"R_igraph_intersection_many", (DL_FUNC) &R_igraph_intersection_many, 1}, {"R_igraph_invalidate_cache", (DL_FUNC) &R_igraph_invalidate_cache, 1}, {"R_igraph_is_acyclic", (DL_FUNC) &R_igraph_is_acyclic, 1}, {"R_igraph_is_biconnected", (DL_FUNC) &R_igraph_is_biconnected, 1}, + {"R_igraph_is_bigraphical", (DL_FUNC) &R_igraph_is_bigraphical, 3}, {"R_igraph_is_bipartite", (DL_FUNC) &R_igraph_is_bipartite, 1}, {"R_igraph_is_bipartite_coloring", (DL_FUNC) &R_igraph_is_bipartite_coloring, 2}, + {"R_igraph_is_chordal", (DL_FUNC) &R_igraph_is_chordal, 3}, {"R_igraph_is_clique", (DL_FUNC) &R_igraph_is_clique, 3}, {"R_igraph_is_complete", (DL_FUNC) &R_igraph_is_complete, 1}, {"R_igraph_is_connected", (DL_FUNC) &R_igraph_is_connected, 2}, @@ -703,6 +885,7 @@ static const R_CallMethodDef CallEntries[] = { {"R_igraph_is_multiple", (DL_FUNC) &R_igraph_is_multiple, 2}, {"R_igraph_is_mutual", (DL_FUNC) &R_igraph_is_mutual, 3}, {"R_igraph_is_perfect", (DL_FUNC) &R_igraph_is_perfect, 1}, + {"R_igraph_is_same_graph", (DL_FUNC) &R_igraph_is_same_graph, 2}, {"R_igraph_is_separator", (DL_FUNC) &R_igraph_is_separator, 2}, {"R_igraph_is_simple", (DL_FUNC) &R_igraph_is_simple, 1}, {"R_igraph_is_tree", (DL_FUNC) &R_igraph_is_tree, 2}, @@ -718,20 +901,33 @@ static const R_CallMethodDef CallEntries[] = { {"R_igraph_joint_degree_matrix", (DL_FUNC) &R_igraph_joint_degree_matrix, 4}, {"R_igraph_joint_type_distribution", (DL_FUNC) &R_igraph_joint_type_distribution, 6}, {"R_igraph_k_regular_game", (DL_FUNC) &R_igraph_k_regular_game, 4}, + {"R_igraph_kary_tree", (DL_FUNC) &R_igraph_kary_tree, 3}, {"R_igraph_kautz", (DL_FUNC) &R_igraph_kautz, 2}, + {"R_igraph_laplacian_spectral_embedding", (DL_FUNC) &R_igraph_laplacian_spectral_embedding, 7}, {"R_igraph_largest_cliques", (DL_FUNC) &R_igraph_largest_cliques, 1}, {"R_igraph_largest_independent_vertex_sets", (DL_FUNC) &R_igraph_largest_independent_vertex_sets, 1}, {"R_igraph_largest_weighted_cliques", (DL_FUNC) &R_igraph_largest_weighted_cliques, 2}, + {"R_igraph_lastcit_game", (DL_FUNC) &R_igraph_lastcit_game, 5}, {"R_igraph_layout_align", (DL_FUNC) &R_igraph_layout_align, 2}, {"R_igraph_layout_bipartite", (DL_FUNC) &R_igraph_layout_bipartite, 5}, {"R_igraph_layout_circle", (DL_FUNC) &R_igraph_layout_circle, 2}, {"R_igraph_layout_davidson_harel", (DL_FUNC) &R_igraph_layout_davidson_harel, 11}, + {"R_igraph_layout_drl", (DL_FUNC) &R_igraph_layout_drl, 5}, + {"R_igraph_layout_drl_3d", (DL_FUNC) &R_igraph_layout_drl_3d, 5}, + {"R_igraph_layout_fruchterman_reingold", (DL_FUNC) &R_igraph_layout_fruchterman_reingold, 11}, + {"R_igraph_layout_fruchterman_reingold_3d", (DL_FUNC) &R_igraph_layout_fruchterman_reingold_3d, 12}, {"R_igraph_layout_gem", (DL_FUNC) &R_igraph_layout_gem, 7}, + {"R_igraph_layout_graphopt", (DL_FUNC) &R_igraph_layout_graphopt, 9}, {"R_igraph_layout_grid", (DL_FUNC) &R_igraph_layout_grid, 2}, {"R_igraph_layout_grid_3d", (DL_FUNC) &R_igraph_layout_grid_3d, 3}, + {"R_igraph_layout_kamada_kawai", (DL_FUNC) &R_igraph_layout_kamada_kawai, 11}, + {"R_igraph_layout_kamada_kawai_3d", (DL_FUNC) &R_igraph_layout_kamada_kawai_3d, 13}, + {"R_igraph_layout_lgl", (DL_FUNC) &R_igraph_layout_lgl, 8}, {"R_igraph_layout_mds", (DL_FUNC) &R_igraph_layout_mds, 3}, {"R_igraph_layout_random", (DL_FUNC) &R_igraph_layout_random, 1}, {"R_igraph_layout_random_3d", (DL_FUNC) &R_igraph_layout_random_3d, 1}, + {"R_igraph_layout_reingold_tilford", (DL_FUNC) &R_igraph_layout_reingold_tilford, 4}, + {"R_igraph_layout_reingold_tilford_circular", (DL_FUNC) &R_igraph_layout_reingold_tilford_circular, 4}, {"R_igraph_layout_sphere", (DL_FUNC) &R_igraph_layout_sphere, 1}, {"R_igraph_layout_star", (DL_FUNC) &R_igraph_layout_star, 3}, {"R_igraph_layout_sugiyama", (DL_FUNC) &R_igraph_layout_sugiyama, 6}, @@ -739,6 +935,7 @@ static const R_CallMethodDef CallEntries[] = { {"R_igraph_layout_umap_3d", (DL_FUNC) &R_igraph_layout_umap_3d, 7}, {"R_igraph_layout_umap_compute_weights", (DL_FUNC) &R_igraph_layout_umap_compute_weights, 3}, {"R_igraph_lcf_vector", (DL_FUNC) &R_igraph_lcf_vector, 3}, + {"R_igraph_le_community_to_membership", (DL_FUNC) &R_igraph_le_community_to_membership, 3}, {"R_igraph_linegraph", (DL_FUNC) &R_igraph_linegraph, 1}, {"R_igraph_list_triangles", (DL_FUNC) &R_igraph_list_triangles, 1}, {"R_igraph_local_efficiency", (DL_FUNC) &R_igraph_local_efficiency, 5}, @@ -752,8 +949,12 @@ static const R_CallMethodDef CallEntries[] = { {"R_igraph_local_scan_subset_ecount", (DL_FUNC) &R_igraph_local_scan_subset_ecount, 3}, {"R_igraph_maxdegree", (DL_FUNC) &R_igraph_maxdegree, 4}, {"R_igraph_maxflow", (DL_FUNC) &R_igraph_maxflow, 4}, + {"R_igraph_maxflow_value", (DL_FUNC) &R_igraph_maxflow_value, 4}, + {"R_igraph_maximal_cliques", (DL_FUNC) &R_igraph_maximal_cliques, 3}, {"R_igraph_maximal_cliques_count", (DL_FUNC) &R_igraph_maximal_cliques_count, 3}, + {"R_igraph_maximal_cliques_file", (DL_FUNC) &R_igraph_maximal_cliques_file, 4}, {"R_igraph_maximal_cliques_hist", (DL_FUNC) &R_igraph_maximal_cliques_hist, 3}, + {"R_igraph_maximal_cliques_subset", (DL_FUNC) &R_igraph_maximal_cliques_subset, 5}, {"R_igraph_maximal_independent_vertex_sets", (DL_FUNC) &R_igraph_maximal_independent_vertex_sets, 1}, {"R_igraph_maximum_bipartite_matching", (DL_FUNC) &R_igraph_maximum_bipartite_matching, 4}, {"R_igraph_maximum_cardinality_search", (DL_FUNC) &R_igraph_maximum_cardinality_search, 1}, @@ -762,6 +963,7 @@ static const R_CallMethodDef CallEntries[] = { {"R_igraph_mincut_value", (DL_FUNC) &R_igraph_mincut_value, 2}, {"R_igraph_minimum_cycle_basis", (DL_FUNC) &R_igraph_minimum_cycle_basis, 5}, {"R_igraph_minimum_size_separators", (DL_FUNC) &R_igraph_minimum_size_separators, 1}, + {"R_igraph_minimum_spanning_tree", (DL_FUNC) &R_igraph_minimum_spanning_tree, 2}, {"R_igraph_minimum_spanning_tree_prim", (DL_FUNC) &R_igraph_minimum_spanning_tree_prim, 2}, {"R_igraph_minimum_spanning_tree_unweighted", (DL_FUNC) &R_igraph_minimum_spanning_tree_unweighted, 1}, {"R_igraph_modularity", (DL_FUNC) &R_igraph_modularity, 5}, @@ -772,7 +974,11 @@ static const R_CallMethodDef CallEntries[] = { {"R_igraph_motifs_randesu_no", (DL_FUNC) &R_igraph_motifs_randesu_no, 3}, {"R_igraph_mycielski_graph", (DL_FUNC) &R_igraph_mycielski_graph, 1}, {"R_igraph_mycielskian", (DL_FUNC) &R_igraph_mycielskian, 2}, + {"R_igraph_neighborhood", (DL_FUNC) &R_igraph_neighborhood, 5}, + {"R_igraph_neighborhood_graphs", (DL_FUNC) &R_igraph_neighborhood_graphs, 5}, + {"R_igraph_neighborhood_size", (DL_FUNC) &R_igraph_neighborhood_size, 5}, {"R_igraph_neighbors", (DL_FUNC) &R_igraph_neighbors, 3}, + {"R_igraph_pagerank", (DL_FUNC) &R_igraph_pagerank, 7}, {"R_igraph_path_graph", (DL_FUNC) &R_igraph_path_graph, 3}, {"R_igraph_path_length_hist", (DL_FUNC) &R_igraph_path_length_hist, 2}, {"R_igraph_permute_vertices", (DL_FUNC) &R_igraph_permute_vertices, 2}, @@ -781,20 +987,31 @@ static const R_CallMethodDef CallEntries[] = { {"R_igraph_power_law_fit", (DL_FUNC) &R_igraph_power_law_fit, 3}, {"R_igraph_preference_game", (DL_FUNC) &R_igraph_preference_game, 7}, {"R_igraph_product", (DL_FUNC) &R_igraph_product, 3}, + {"R_igraph_progress", (DL_FUNC) &R_igraph_progress, 2}, {"R_igraph_pseudo_diameter", (DL_FUNC) &R_igraph_pseudo_diameter, 4}, {"R_igraph_pseudo_diameter_dijkstra", (DL_FUNC) &R_igraph_pseudo_diameter_dijkstra, 5}, + {"R_igraph_radius", (DL_FUNC) &R_igraph_radius, 2}, {"R_igraph_radius_dijkstra", (DL_FUNC) &R_igraph_radius_dijkstra, 3}, + {"R_igraph_random_edge_walk", (DL_FUNC) &R_igraph_random_edge_walk, 6}, + {"R_igraph_random_sample", (DL_FUNC) &R_igraph_random_sample, 3}, {"R_igraph_random_spanning_tree", (DL_FUNC) &R_igraph_random_spanning_tree, 2}, {"R_igraph_random_walk", (DL_FUNC) &R_igraph_random_walk, 6}, + {"R_igraph_read_graph_dimacs_flow", (DL_FUNC) &R_igraph_read_graph_dimacs_flow, 2}, {"R_igraph_read_graph_dl", (DL_FUNC) &R_igraph_read_graph_dl, 2}, + {"R_igraph_read_graph_edgelist", (DL_FUNC) &R_igraph_read_graph_edgelist, 3}, {"R_igraph_read_graph_gml", (DL_FUNC) &R_igraph_read_graph_gml, 1}, {"R_igraph_read_graph_graphdb", (DL_FUNC) &R_igraph_read_graph_graphdb, 2}, {"R_igraph_read_graph_graphml", (DL_FUNC) &R_igraph_read_graph_graphml, 2}, + {"R_igraph_read_graph_lgl", (DL_FUNC) &R_igraph_read_graph_lgl, 4}, + {"R_igraph_read_graph_ncol", (DL_FUNC) &R_igraph_read_graph_ncol, 5}, {"R_igraph_read_graph_pajek", (DL_FUNC) &R_igraph_read_graph_pajek, 1}, {"R_igraph_realize_bipartite_degree_sequence", (DL_FUNC) &R_igraph_realize_bipartite_degree_sequence, 4}, {"R_igraph_realize_degree_sequence", (DL_FUNC) &R_igraph_realize_degree_sequence, 4}, + {"R_igraph_recent_degree_aging_game", (DL_FUNC) &R_igraph_recent_degree_aging_game, 10}, + {"R_igraph_recent_degree_game", (DL_FUNC) &R_igraph_recent_degree_game, 8}, {"R_igraph_reciprocity", (DL_FUNC) &R_igraph_reciprocity, 3}, {"R_igraph_regular_tree", (DL_FUNC) &R_igraph_regular_tree, 3}, + {"R_igraph_reindex_membership", (DL_FUNC) &R_igraph_reindex_membership, 1}, {"R_igraph_residual_graph", (DL_FUNC) &R_igraph_residual_graph, 3}, {"R_igraph_reverse_edges", (DL_FUNC) &R_igraph_reverse_edges, 2}, {"R_igraph_reverse_residual_graph", (DL_FUNC) &R_igraph_reverse_residual_graph, 3}, @@ -802,6 +1019,7 @@ static const R_CallMethodDef CallEntries[] = { {"R_igraph_rewire_directed_edges", (DL_FUNC) &R_igraph_rewire_directed_edges, 4}, {"R_igraph_rewire_edges", (DL_FUNC) &R_igraph_rewire_edges, 4}, {"R_igraph_rich_club_sequence", (DL_FUNC) &R_igraph_rich_club_sequence, 6}, + {"R_igraph_ring", (DL_FUNC) &R_igraph_ring, 4}, {"R_igraph_rooted_product", (DL_FUNC) &R_igraph_rooted_product, 3}, {"R_igraph_roots_for_tree_layout", (DL_FUNC) &R_igraph_roots_for_tree_layout, 3}, {"R_igraph_roulette_wheel_imitation", (DL_FUNC) &R_igraph_roulette_wheel_imitation, 6}, @@ -827,11 +1045,18 @@ static const R_CallMethodDef CallEntries[] = { {"R_igraph_spanner", (DL_FUNC) &R_igraph_spanner, 3}, {"R_igraph_split_join_distance", (DL_FUNC) &R_igraph_split_join_distance, 2}, {"R_igraph_square_lattice", (DL_FUNC) &R_igraph_square_lattice, 5}, + {"R_igraph_st_edge_connectivity", (DL_FUNC) &R_igraph_st_edge_connectivity, 3}, {"R_igraph_st_mincut", (DL_FUNC) &R_igraph_st_mincut, 4}, + {"R_igraph_st_mincut_value", (DL_FUNC) &R_igraph_st_mincut_value, 4}, + {"R_igraph_st_vertex_connectivity", (DL_FUNC) &R_igraph_st_vertex_connectivity, 4}, + {"R_igraph_star", (DL_FUNC) &R_igraph_star, 3}, {"R_igraph_static_fitness_game", (DL_FUNC) &R_igraph_static_fitness_game, 5}, {"R_igraph_static_power_law_game", (DL_FUNC) &R_igraph_static_power_law_game, 7}, + {"R_igraph_status", (DL_FUNC) &R_igraph_status, 1}, {"R_igraph_stochastic_imitation", (DL_FUNC) &R_igraph_stochastic_imitation, 6}, {"R_igraph_strength", (DL_FUNC) &R_igraph_strength, 5}, + {"R_igraph_strerror", (DL_FUNC) &R_igraph_strerror, 1}, + {"R_igraph_subcomponent", (DL_FUNC) &R_igraph_subcomponent, 3}, {"R_igraph_subgraph_from_edges", (DL_FUNC) &R_igraph_subgraph_from_edges, 3}, {"R_igraph_subisomorphic", (DL_FUNC) &R_igraph_subisomorphic, 2}, {"R_igraph_subisomorphic_vf2", (DL_FUNC) &R_igraph_subisomorphic_vf2, 6}, @@ -854,22 +1079,30 @@ static const R_CallMethodDef CallEntries[] = { {"R_igraph_turan", (DL_FUNC) &R_igraph_turan, 2}, {"R_igraph_unfold_tree", (DL_FUNC) &R_igraph_unfold_tree, 3}, {"R_igraph_union", (DL_FUNC) &R_igraph_union, 2}, + {"R_igraph_union_many", (DL_FUNC) &R_igraph_union_many, 1}, {"R_igraph_vcount", (DL_FUNC) &R_igraph_vcount, 1}, {"R_igraph_version", (DL_FUNC) &R_igraph_version, 0}, {"R_igraph_vertex_coloring_greedy", (DL_FUNC) &R_igraph_vertex_coloring_greedy, 2}, {"R_igraph_vertex_connectivity", (DL_FUNC) &R_igraph_vertex_connectivity, 2}, + {"R_igraph_vertex_disjoint_paths", (DL_FUNC) &R_igraph_vertex_disjoint_paths, 3}, {"R_igraph_vertex_path_from_edge_path", (DL_FUNC) &R_igraph_vertex_path_from_edge_path, 4}, {"R_igraph_voronoi", (DL_FUNC) &R_igraph_voronoi, 5}, + {"R_igraph_watts_strogatz_game", (DL_FUNC) &R_igraph_watts_strogatz_game, 6}, + {"R_igraph_weighted_adjacency", (DL_FUNC) &R_igraph_weighted_adjacency, 3}, {"R_igraph_weighted_clique_number", (DL_FUNC) &R_igraph_weighted_clique_number, 2}, {"R_igraph_weighted_cliques", (DL_FUNC) &R_igraph_weighted_cliques, 5}, + {"R_igraph_weighted_sparsemat", (DL_FUNC) &R_igraph_weighted_sparsemat, 4}, {"R_igraph_wheel", (DL_FUNC) &R_igraph_wheel, 3}, {"R_igraph_widest_path_widths_dijkstra", (DL_FUNC) &R_igraph_widest_path_widths_dijkstra, 5}, {"R_igraph_widest_path_widths_floyd_warshall", (DL_FUNC) &R_igraph_widest_path_widths_floyd_warshall, 5}, + {"R_igraph_write_graph_dimacs_flow", (DL_FUNC) &R_igraph_write_graph_dimacs_flow, 5}, {"R_igraph_write_graph_dot", (DL_FUNC) &R_igraph_write_graph_dot, 2}, {"R_igraph_write_graph_edgelist", (DL_FUNC) &R_igraph_write_graph_edgelist, 2}, {"R_igraph_write_graph_gml", (DL_FUNC) &R_igraph_write_graph_gml, 5}, {"R_igraph_write_graph_graphml", (DL_FUNC) &R_igraph_write_graph_graphml, 3}, {"R_igraph_write_graph_leda", (DL_FUNC) &R_igraph_write_graph_leda, 4}, + {"R_igraph_write_graph_lgl", (DL_FUNC) &R_igraph_write_graph_lgl, 5}, + {"R_igraph_write_graph_ncol", (DL_FUNC) &R_igraph_write_graph_ncol, 4}, {"R_igraph_write_graph_pajek", (DL_FUNC) &R_igraph_write_graph_pajek, 2}, {"Rx_igraph_add_edges_manual", (DL_FUNC) &Rx_igraph_add_edges_manual, 2}, {"Rx_igraph_add_env", (DL_FUNC) &Rx_igraph_add_env, 1}, @@ -877,7 +1110,6 @@ static const R_CallMethodDef CallEntries[] = { {"Rx_igraph_add_version_to_env", (DL_FUNC) &Rx_igraph_add_version_to_env, 1}, {"Rx_igraph_address", (DL_FUNC) &Rx_igraph_address, 1}, {"Rx_igraph_adjacency", (DL_FUNC) &Rx_igraph_adjacency, 3}, - {"Rx_igraph_adjacency_spectral_embedding", (DL_FUNC) &Rx_igraph_adjacency_spectral_embedding, 7}, {"Rx_igraph_adjacent_vertices", (DL_FUNC) &Rx_igraph_adjacent_vertices, 3}, {"Rx_igraph_arpack", (DL_FUNC) &Rx_igraph_arpack, 5}, {"Rx_igraph_arpack_unpack_complex", (DL_FUNC) &Rx_igraph_arpack_unpack_complex, 3}, @@ -926,7 +1158,6 @@ static const R_CallMethodDef CallEntries[] = { {"Rx_igraph_get_shortest_paths", (DL_FUNC) &Rx_igraph_get_shortest_paths, 10}, {"Rx_igraph_girth", (DL_FUNC) &Rx_igraph_girth, 2}, {"Rx_igraph_graph_version", (DL_FUNC) &Rx_igraph_graph_version, 1}, - {"Rx_igraph_graphlets", (DL_FUNC) &Rx_igraph_graphlets, 3}, {"Rx_igraph_grg_game", (DL_FUNC) &Rx_igraph_grg_game, 4}, {"Rx_igraph_i_levc_arp", (DL_FUNC) &Rx_igraph_i_levc_arp, 3}, {"Rx_igraph_identical_graphs", (DL_FUNC) &Rx_igraph_identical_graphs, 3}, @@ -935,7 +1166,6 @@ static const R_CallMethodDef CallEntries[] = { {"Rx_igraph_intersection", (DL_FUNC) &Rx_igraph_intersection, 2}, {"Rx_igraph_is_chordal", (DL_FUNC) &Rx_igraph_is_chordal, 5}, {"Rx_igraph_kary_tree", (DL_FUNC) &Rx_igraph_kary_tree, 3}, - {"Rx_igraph_laplacian_spectral_embedding", (DL_FUNC) &Rx_igraph_laplacian_spectral_embedding, 7}, {"Rx_igraph_lastcit_game", (DL_FUNC) &Rx_igraph_lastcit_game, 5}, {"Rx_igraph_layout_drl", (DL_FUNC) &Rx_igraph_layout_drl, 5}, {"Rx_igraph_layout_drl_3d", (DL_FUNC) &Rx_igraph_layout_drl_3d, 5}, diff --git a/src/rinterface.c b/src/rinterface.c index 861b5e5824..94f664426b 100644 --- a/src/rinterface.c +++ b/src/rinterface.c @@ -489,39 +489,6 @@ SEXP R_igraph_edges(SEXP graph, SEXP eids) { return(r_result); } -/*-------------------------------------------/ -/ igraph_get_eid / -/-------------------------------------------*/ -SEXP R_igraph_get_eid(SEXP graph, SEXP from, SEXP to, SEXP directed, SEXP error) { - /* Declarations */ - igraph_t c_graph; - igraph_integer_t c_eid; - igraph_integer_t c_from; - igraph_integer_t c_to; - igraph_bool_t c_directed; - igraph_bool_t c_error; - SEXP eid; - - SEXP r_result; - /* Convert input */ - Rz_SEXP_to_igraph(graph, &c_graph); - c_from = (igraph_integer_t) REAL(from)[0]; - c_to = (igraph_integer_t) REAL(to)[0]; - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; - IGRAPH_R_CHECK_BOOL(error); - c_error = LOGICAL(error)[0]; - /* Call igraph */ - IGRAPH_R_CHECK(igraph_get_eid(&c_graph, c_eid, c_from, c_to, c_directed, c_error)); - - /* Convert output */ - - r_result = eid; - - UNPROTECT(1); - return(r_result); -} - /*-------------------------------------------/ / igraph_get_eids / /-------------------------------------------*/ @@ -716,96 +683,6 @@ SEXP R_igraph_adjacency(SEXP adjmatrix, SEXP mode, SEXP loops) { return(r_result); } -/*-------------------------------------------/ -/ igraph_sparse_adjacency / -/-------------------------------------------*/ -SEXP R_igraph_sparse_adjacency(SEXP adjmatrix, SEXP mode, SEXP loops) { - /* Declarations */ - igraph_t c_graph; - igraph_sparsemat_t c_adjmatrix; - igraph_adjacency_t c_mode; - igraph_loops_t c_loops; - SEXP graph; - - SEXP r_result, r_names; - /* Convert input */ - Rz_SEXP_to_sparsemat(adjmatrix, &c_adjmatrix); - c_mode = (igraph_adjacency_t) Rf_asInteger(mode); - c_loops = (igraph_loops_t) Rf_asInteger(loops); - /* Call igraph */ - IGRAPH_R_CHECK(igraph_sparse_adjacency(&c_graph, &c_adjmatrix, c_mode, c_loops)); - - /* Convert output */ - PROTECT(r_result=NEW_LIST(2)); - PROTECT(r_names=NEW_CHARACTER(2)); - IGRAPH_FINALLY(igraph_destroy, &c_graph); - PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); - IGRAPH_I_DESTROY(&c_graph); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(adjmatrix=Ry_igraph_sparsemat_to_SEXP(&c_adjmatrix)); - igraph_sparsemat_destroy(&c_adjmatrix); - IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, graph); - SET_VECTOR_ELT(r_result, 1, adjmatrix); - SET_STRING_ELT(r_names, 0, Rf_mkChar("graph")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("adjmatrix")); - SET_NAMES(r_result, r_names); - UNPROTECT(3); - - UNPROTECT(1); - return(r_result); -} - -/*-------------------------------------------/ -/ igraph_sparse_weighted_adjacency / -/-------------------------------------------*/ -SEXP R_igraph_sparse_weighted_adjacency(SEXP adjmatrix, SEXP mode, SEXP loops) { - /* Declarations */ - igraph_t c_graph; - igraph_sparsemat_t c_adjmatrix; - igraph_adjacency_t c_mode; - igraph_vector_t c_weights; - igraph_loops_t c_loops; - SEXP graph; - SEXP weights; - - SEXP r_result, r_names; - /* Convert input */ - Rz_SEXP_to_sparsemat(adjmatrix, &c_adjmatrix); - c_mode = (igraph_adjacency_t) Rf_asInteger(mode); - IGRAPH_R_CHECK(igraph_vector_init(&c_weights, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_weights); - weights=R_GlobalEnv; /* hack to have a non-NULL value */ - c_loops = (igraph_loops_t) Rf_asInteger(loops); - /* Call igraph */ - IGRAPH_R_CHECK(igraph_sparse_weighted_adjacency(&c_graph, &c_adjmatrix, c_mode, &c_weights, c_loops)); - - /* Convert output */ - PROTECT(r_result=NEW_LIST(3)); - PROTECT(r_names=NEW_CHARACTER(3)); - IGRAPH_FINALLY(igraph_destroy, &c_graph); - PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); - IGRAPH_I_DESTROY(&c_graph); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(adjmatrix=Ry_igraph_sparsemat_to_SEXP(&c_adjmatrix)); - igraph_sparsemat_destroy(&c_adjmatrix); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(weights=Ry_igraph_0orvector_to_SEXP(&c_weights)); - igraph_vector_destroy(&c_weights); - IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, graph); - SET_VECTOR_ELT(r_result, 1, adjmatrix); - SET_VECTOR_ELT(r_result, 2, weights); - SET_STRING_ELT(r_names, 0, Rf_mkChar("graph")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("adjmatrix")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("weights")); - SET_NAMES(r_result, r_names); - UNPROTECT(4); - - UNPROTECT(1); - return(r_result); -} - /*-------------------------------------------/ / igraph_weighted_adjacency / /-------------------------------------------*/ @@ -1898,40 +1775,6 @@ SEXP R_igraph_turan(SEXP n, SEXP r) { return(r_result); } -/*-------------------------------------------/ -/ igraph_weighted_sparsemat / -/-------------------------------------------*/ -SEXP R_igraph_weighted_sparsemat(SEXP A, SEXP directed, SEXP attr, SEXP loops) { - /* Declarations */ - igraph_t c_graph; - igraph_sparsemat_t c_A; - igraph_bool_t c_directed; - const char* c_attr; - igraph_bool_t c_loops; - SEXP graph; - - SEXP r_result; - /* Convert input */ - Rz_SEXP_to_sparsemat(A, &c_A); - IGRAPH_R_CHECK_BOOL(directed); - c_directed = LOGICAL(directed)[0]; - c_attr = Rf_translateCharUTF8(STRING_ELT(attr, 0)); - IGRAPH_R_CHECK_BOOL(loops); - c_loops = LOGICAL(loops)[0]; - /* Call igraph */ - IGRAPH_R_CHECK(igraph_weighted_sparsemat(&c_graph, &c_A, c_directed, c_attr, c_loops)); - - /* Convert output */ - IGRAPH_FINALLY(igraph_destroy, &c_graph); - PROTECT(graph=Ry_igraph_to_SEXP(&c_graph)); - IGRAPH_I_DESTROY(&c_graph); - IGRAPH_FINALLY_CLEAN(1); - r_result = graph; - - UNPROTECT(1); - return(r_result); -} - /*-------------------------------------------/ / igraph_barabasi_game / /-------------------------------------------*/ @@ -11131,34 +10974,6 @@ SEXP R_igraph_layout_drl_3d(SEXP graph, SEXP res, SEXP use_seed, SEXP options, S return(r_result); } -/*-------------------------------------------/ -/ igraph_layout_merge_dla / -/-------------------------------------------*/ -SEXP R_igraph_layout_merge_dla(SEXP graphs, SEXP coords) { - /* Declarations */ - igraph_vector_ptr_t c_graphs; - igraph_matrix_list_t c_coords; - igraph_matrix_t c_res; - SEXP res; - - SEXP r_result; - /* Convert input */ - Ry_igraph_SEXP_to_matrixlist(coords, &c_coords); - IGRAPH_R_CHECK(igraph_matrix_init(&c_res, 0, 0)); - IGRAPH_FINALLY(igraph_matrix_destroy, &c_res); - /* Call igraph */ - IGRAPH_R_CHECK(igraph_layout_merge_dla(c_graphs, &c_coords, &c_res)); - - /* Convert output */ - PROTECT(res=Ry_igraph_matrix_to_SEXP(&c_res)); - igraph_matrix_destroy(&c_res); - IGRAPH_FINALLY_CLEAN(1); - r_result = res; - - UNPROTECT(1); - return(r_result); -} - /*-------------------------------------------/ / igraph_layout_sugiyama / /-------------------------------------------*/ @@ -12527,97 +12342,6 @@ SEXP R_igraph_reindex_membership(SEXP membership) { return(r_result); } -/*-------------------------------------------/ -/ igraph_community_leading_eigenvector / -/-------------------------------------------*/ -SEXP R_igraph_community_leading_eigenvector(SEXP graph, SEXP weights, SEXP steps, SEXP options, SEXP start, SEXP callback) { - /* Declarations */ - igraph_t c_graph; - igraph_vector_t c_weights; - igraph_matrix_int_t c_merges; - igraph_vector_int_t c_membership; - igraph_integer_t c_steps; - igraph_arpack_options_t c_options; - igraph_real_t c_modularity; - igraph_bool_t c_start; - igraph_vector_t c_eigenvalues; - igraph_vector_list_t c_eigenvectors; - igraph_vector_t c_history; - igraph_community_leading_eigenvector_callback_t c_callback; - - SEXP merges; - SEXP membership; - SEXP modularity; - SEXP eigenvalues; - SEXP eigenvectors; - SEXP history; - - SEXP r_result, r_names; - /* Convert input */ - Rz_SEXP_to_igraph(graph, &c_graph); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } - IGRAPH_R_CHECK(igraph_matrix_int_init(&c_merges, 0, 0)); - IGRAPH_FINALLY(igraph_matrix_int_destroy, &c_merges); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_membership, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_membership); - IGRAPH_R_CHECK_INT(steps); - c_steps = (igraph_integer_t) REAL(steps)[0]; - Rz_SEXP_to_igraph_arpack_options(options, &c_options); - IGRAPH_R_CHECK_BOOL(start); - c_start = LOGICAL(start)[0]; - IGRAPH_R_CHECK(igraph_vector_init(&c_eigenvalues, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_eigenvalues); - IGRAPH_R_CHECK(igraph_vector_list_init(&c_eigenvectors, 0)); - IGRAPH_FINALLY(igraph_vector_list_destroy, &c_eigenvectors); - IGRAPH_R_CHECK(igraph_vector_init(&c_history, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_history); - /* Call igraph */ - IGRAPH_R_CHECK(igraph_community_leading_eigenvector(&c_graph, (Rf_isNull(weights) ? 0 : &c_weights), &c_merges, &c_membership, c_steps, &c_options, &c_modularity, c_start, &c_eigenvalues, &c_eigenvectors, &c_history, (Rf_isNull(callback) ? 0 : c_callback), 0)); - - /* Convert output */ - PROTECT(r_result=NEW_LIST(7)); - PROTECT(r_names=NEW_CHARACTER(7)); - PROTECT(merges=Ry_igraph_matrix_int_to_SEXP(&c_merges)); - igraph_matrix_int_destroy(&c_merges); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(membership=Ry_igraph_vector_int_to_SEXP(&c_membership)); - igraph_vector_int_destroy(&c_membership); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(options=Ry_igraph_arpack_options_to_SEXP(&c_options)); - PROTECT(modularity=NEW_NUMERIC(1)); - REAL(modularity)[0]=c_modularity; - PROTECT(eigenvalues=Ry_igraph_vector_to_SEXP(&c_eigenvalues)); - igraph_vector_destroy(&c_eigenvalues); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(eigenvectors=Rx_igraph_vectorlist_to_SEXP(&c_eigenvectors)); - igraph_vector_list_destroy(&c_eigenvectors); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(history=Ry_igraph_vector_to_SEXP(&c_history)); - igraph_vector_destroy(&c_history); - IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, merges); - SET_VECTOR_ELT(r_result, 1, membership); - SET_VECTOR_ELT(r_result, 2, options); - SET_VECTOR_ELT(r_result, 3, modularity); - SET_VECTOR_ELT(r_result, 4, eigenvalues); - SET_VECTOR_ELT(r_result, 5, eigenvectors); - SET_VECTOR_ELT(r_result, 6, history); - SET_STRING_ELT(r_names, 0, Rf_mkChar("merges")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("membership")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("options")); - SET_STRING_ELT(r_names, 3, Rf_mkChar("modularity")); - SET_STRING_ELT(r_names, 4, Rf_mkChar("eigenvalues")); - SET_STRING_ELT(r_names, 5, Rf_mkChar("eigenvectors")); - SET_STRING_ELT(r_names, 6, Rf_mkChar("history")); - SET_NAMES(r_result, r_names); - UNPROTECT(8); - - UNPROTECT(1); - return(r_result); -} - /*-------------------------------------------/ / igraph_community_fluid_communities / /-------------------------------------------*/ @@ -12957,63 +12681,6 @@ SEXP R_igraph_community_infomap(SEXP graph, SEXP e_weights, SEXP v_weights, SEXP return(r_result); } -/*-------------------------------------------/ -/ igraph_community_voronoi / -/-------------------------------------------*/ -SEXP R_igraph_community_voronoi(SEXP graph, SEXP lengths, SEXP weights, SEXP mode, SEXP radius) { - /* Declarations */ - igraph_t c_graph; - igraph_vector_int_t c_membership; - igraph_vector_int_t c_generators; - igraph_real_t c_modularity; - igraph_vector_t c_lengths; - igraph_vector_t c_weights; - igraph_neimode_t c_mode; - igraph_real_t c_radius; - SEXP membership; - SEXP generators; - SEXP modularity; - - SEXP r_result, r_names; - /* Convert input */ - Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_membership, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_membership); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_generators, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_generators); - if (!Rf_isNull(weights)) { - Rz_SEXP_to_vector(weights, &c_weights); - } - c_mode = (igraph_neimode_t) Rf_asInteger(mode); - IGRAPH_R_CHECK_REAL(radius); - c_radius = REAL(radius)[0]; - /* Call igraph */ - IGRAPH_R_CHECK(igraph_community_voronoi(&c_graph, &c_membership, &c_generators, &c_modularity, (Rf_isNull(lengths) ? 0 : c_lengths), (Rf_isNull(weights) ? 0 : &c_weights), c_mode, c_radius)); - - /* Convert output */ - PROTECT(r_result=NEW_LIST(3)); - PROTECT(r_names=NEW_CHARACTER(3)); - PROTECT(membership=Ry_igraph_vector_int_to_SEXP(&c_membership)); - igraph_vector_int_destroy(&c_membership); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(generators=Ry_igraph_vector_int_to_SEXPp1(&c_generators)); - igraph_vector_int_destroy(&c_generators); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(modularity=NEW_NUMERIC(1)); - REAL(modularity)[0]=c_modularity; - SET_VECTOR_ELT(r_result, 0, membership); - SET_VECTOR_ELT(r_result, 1, generators); - SET_VECTOR_ELT(r_result, 2, modularity); - SET_STRING_ELT(r_names, 0, Rf_mkChar("membership")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("generators")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("modularity")); - SET_NAMES(r_result, r_names); - UNPROTECT(4); - - UNPROTECT(1); - return(r_result); -} - /*-------------------------------------------/ / igraph_graphlets / /-------------------------------------------*/ @@ -14866,32 +14533,6 @@ SEXP R_igraph_disjoint_union(SEXP left, SEXP right) { return(r_result); } -/*-------------------------------------------/ -/ igraph_disjoint_union_many / -/-------------------------------------------*/ -SEXP R_igraph_disjoint_union_many(SEXP graphs) { - /* Declarations */ - igraph_t c_res; - igraph_vector_ptr_t c_graphs; - SEXP res; - - SEXP r_result; - /* Convert input */ - - /* Call igraph */ - IGRAPH_R_CHECK(igraph_disjoint_union_many(&c_res, c_graphs)); - - /* Convert output */ - IGRAPH_FINALLY(igraph_destroy, &c_res); - PROTECT(res=Ry_igraph_to_SEXP(&c_res)); - IGRAPH_I_DESTROY(&c_res); - IGRAPH_FINALLY_CLEAN(1); - r_result = res; - - UNPROTECT(1); - return(r_result); -} - /*-------------------------------------------/ / igraph_join / /-------------------------------------------*/ @@ -14971,45 +14612,6 @@ SEXP R_igraph_union(SEXP left, SEXP right) { return(r_result); } -/*-------------------------------------------/ -/ igraph_union_many / -/-------------------------------------------*/ -SEXP R_igraph_union_many(SEXP graphs) { - /* Declarations */ - igraph_t c_res; - igraph_vector_ptr_t c_graphs; - igraph_vector_int_list_t c_edgemaps; - SEXP res; - SEXP edgemaps; - - SEXP r_result, r_names; - /* Convert input */ - IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_edgemaps, 0)); - IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_edgemaps); - /* Call igraph */ - IGRAPH_R_CHECK(igraph_union_many(&c_res, c_graphs, &c_edgemaps)); - - /* Convert output */ - PROTECT(r_result=NEW_LIST(2)); - PROTECT(r_names=NEW_CHARACTER(2)); - IGRAPH_FINALLY(igraph_destroy, &c_res); - PROTECT(res=Ry_igraph_to_SEXP(&c_res)); - IGRAPH_I_DESTROY(&c_res); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(edgemaps=Ry_igraph_vector_int_list_to_SEXP(&c_edgemaps)); - igraph_vector_int_list_destroy(&c_edgemaps); - IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, res); - SET_VECTOR_ELT(r_result, 1, edgemaps); - SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("edgemaps")); - SET_NAMES(r_result, r_names); - UNPROTECT(3); - - UNPROTECT(1); - return(r_result); -} - /*-------------------------------------------/ / igraph_intersection / /-------------------------------------------*/ @@ -15061,45 +14663,6 @@ SEXP R_igraph_intersection(SEXP left, SEXP right) { return(r_result); } -/*-------------------------------------------/ -/ igraph_intersection_many / -/-------------------------------------------*/ -SEXP R_igraph_intersection_many(SEXP graphs) { - /* Declarations */ - igraph_t c_res; - igraph_vector_ptr_t c_graphs; - igraph_vector_int_list_t c_edgemaps; - SEXP res; - SEXP edgemaps; - - SEXP r_result, r_names; - /* Convert input */ - IGRAPH_R_CHECK(igraph_vector_int_list_init(&c_edgemaps, 0)); - IGRAPH_FINALLY(igraph_vector_int_list_destroy, &c_edgemaps); - /* Call igraph */ - IGRAPH_R_CHECK(igraph_intersection_many(&c_res, c_graphs, &c_edgemaps)); - - /* Convert output */ - PROTECT(r_result=NEW_LIST(2)); - PROTECT(r_names=NEW_CHARACTER(2)); - IGRAPH_FINALLY(igraph_destroy, &c_res); - PROTECT(res=Ry_igraph_to_SEXP(&c_res)); - IGRAPH_I_DESTROY(&c_res); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(edgemaps=Ry_igraph_vector_int_list_to_SEXP(&c_edgemaps)); - igraph_vector_int_list_destroy(&c_edgemaps); - IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, res); - SET_VECTOR_ELT(r_result, 1, edgemaps); - SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("edgemaps")); - SET_NAMES(r_result, r_names); - UNPROTECT(3); - - UNPROTECT(1); - return(r_result); -} - /*-------------------------------------------/ / igraph_difference / /-------------------------------------------*/ @@ -17311,55 +16874,6 @@ SEXP R_igraph_automorphism_group(SEXP graph, SEXP colors, SEXP sh) { return(r_result); } -/*-------------------------------------------/ -/ igraph_subisomorphic_lad / -/-------------------------------------------*/ -SEXP R_igraph_subisomorphic_lad(SEXP graph) { - /* Declarations */ - igraph_t c_graph; - igraph_t c_res; - igraph_vector_int_t c_vertex_color; - igraph_vector_int_t c_edge_color; - SEXP res; - SEXP vertex_color; - SEXP edge_color; - - SEXP r_result, r_names; - /* Convert input */ - Rz_SEXP_to_igraph(graph, &c_graph); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_vertex_color, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_vertex_color); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_edge_color, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_edge_color); - /* Call igraph */ - IGRAPH_R_CHECK(igraph_subisomorphic_lad(&c_graph, &c_res, &c_vertex_color, &c_edge_color)); - - /* Convert output */ - PROTECT(r_result=NEW_LIST(3)); - PROTECT(r_names=NEW_CHARACTER(3)); - IGRAPH_FINALLY(igraph_destroy, &c_res); - PROTECT(res=Ry_igraph_to_SEXP(&c_res)); - IGRAPH_I_DESTROY(&c_res); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(vertex_color=Ry_igraph_vector_int_to_SEXP(&c_vertex_color)); - igraph_vector_int_destroy(&c_vertex_color); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(edge_color=Ry_igraph_vector_int_to_SEXP(&c_edge_color)); - igraph_vector_int_destroy(&c_edge_color); - IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, res); - SET_VECTOR_ELT(r_result, 1, vertex_color); - SET_VECTOR_ELT(r_result, 2, edge_color); - SET_STRING_ELT(r_names, 0, Rf_mkChar("res")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("vertex_color")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("edge_color")); - SET_NAMES(r_result, r_names); - UNPROTECT(4); - - UNPROTECT(1); - return(r_result); -} - /*-------------------------------------------/ / igraph_simplify_and_colorize / /-------------------------------------------*/ diff --git a/tools/stimulus/functions-R.yaml b/tools/stimulus/functions-R.yaml index e4cb0ba12e..c31d1a034e 100644 --- a/tools/stimulus/functions-R.yaml +++ b/tools/stimulus/functions-R.yaml @@ -30,6 +30,8 @@ igraph_edge: igraph_edges: igraph_get_eid: + # Needs custom handling - OUT parameter eid should be scalar not vector + IGNORE: RR, RC, RInit igraph_get_eids: DEPS: pairs ON graph, eids ON graph @@ -56,11 +58,13 @@ igraph_create: # TODO: temporarily disabled igraph_adjacency: -# TODO: temporarily disabled +# TODO: temporarily disabled - needs SPARSEMAT converter implementation igraph_sparse_adjacency: + IGNORE: RR, RC -# TODO: temporarily disabled +# TODO: temporarily disabled - needs SPARSEMAT converter implementation igraph_sparse_weighted_adjacency: + IGNORE: RR, RC # TODO: temporarily disabled igraph_weighted_adjacency: @@ -119,6 +123,8 @@ igraph_turan: # TODO: temporarily disabled igraph_weighted_sparsemat: + # Needs SPARSEMAT converter implementation + IGNORE: RR, RC ####################################### # Constructors, games @@ -582,6 +588,8 @@ igraph_layout_drl_3d: DEPS: weights ON graph igraph_layout_merge_dla: + # Needs custom handling - GRAPH_PTR_LIST type not properly supported + IGNORE: RR, RC ####################################### # Cocitation and other similarity measures @@ -615,11 +623,14 @@ igraph_le_community_to_membership: igraph_reindex_membership: igraph_community_leading_eigenvector: - DEPS: weights ON graph + # Needs custom handling - has callback parameter (LEVCFUNC) + IGNORE: RR, RC, RInit R: CLASS: igraph.eigenc igraph_community_voronoi: + # Needs custom handling - optional pointer parameter generates incorrect conditional + IGNORE: RR, RC, RInit ####################################### # Graphlets @@ -713,14 +724,20 @@ igraph_write_graph_dot: igraph_disjoint_union: igraph_disjoint_union_many: + # Needs custom handling - GRAPH_PTR_LIST const pointer issue + IGNORE: RR, RC, RInit igraph_union: igraph_union_many: + # Needs custom handling - GRAPH_PTR_LIST const pointer issue + IGNORE: RR, RC, RInit igraph_intersection: igraph_intersection_many: + # Needs custom handling - GRAPH_PTR_LIST const pointer issue + IGNORE: RR, RC, RInit igraph_difference: @@ -781,7 +798,8 @@ igraph_get_subisomorphisms_vf2_callback: IGNORE: RR, RC igraph_subisomorphic_lad: - # R function is hand-rolled + # R function is hand-rolled - C signature changed, needs manual update + IGNORE: RR, RC, RInit # Despite their names, vertex_color and edge_color are not really colors # but _multiplicities_, so we simply use VECTOR_INT there PARAMS: |- From aa2897764ab0ad14f48bd1dce966d661cf5e6f42 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 4 Nov 2025 23:38:01 +0000 Subject: [PATCH 04/10] test: add test stubs for 130 new _impl functions and fix compilation issues - Added test stubs for all 130 new _impl functions to test-aaa-auto.R - Added IGNORE back for igraph_bfs and igraph_dfs (have callback parameters) - Added IGNORE back for igraph_eigen_matrix and igraph_eigen_matrix_symmetric (were missing) - Fixed compilation issues preventing package from loading - Accepted updated snapshots for spectral embedding functions - All tests now pass (130 skipped with TODO markers for future implementation) Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com> --- R/aaa-auto.R | 181 ------ src/cpp11.cpp | 18 - src/rinterface.c | 288 ---------- tests/testthat/_snaps/aaa-auto.md | 15 +- tests/testthat/test-aaa-auto.R | 913 ++++++++++++++++++++++++++++++ tools/stimulus/functions-R.yaml | 9 +- 6 files changed, 933 insertions(+), 491 deletions(-) diff --git a/R/aaa-auto.R b/R/aaa-auto.R index 42917d7023..06dd8f8e01 100644 --- a/R/aaa-auto.R +++ b/R/aaa-auto.R @@ -6477,55 +6477,6 @@ is_graphical_impl <- function( res } -bfs_impl <- function( - graph, - root, - roots = NULL, - mode = c("out", "in", "all", "total"), - unreachable, - restricted, - callback = NULL -) { - # Argument checks - ensure_igraph(graph) - root <- as_igraph_vs(graph, root) - if (length(root) == 0) { - cli::cli_abort( - "{.arg root} must specify at least one vertex", - call = rlang::caller_env() - ) - } - if (!is.null(roots)) { - roots <- as_igraph_vs(graph, roots) - } - mode <- switch_igraph_arg( - mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) - unreachable <- as.logical(unreachable) - restricted <- as_igraph_vs(graph, restricted) - - on.exit(.Call(R_igraph_finalizer)) - # Function call - res <- .Call( - R_igraph_bfs, - graph, - root - 1, - roots - 1, - mode, - unreachable, - restricted - 1, - callback - ) - if (igraph_opt("return.vs.es")) { - res$order <- create_vs(graph, res$order) - } - res -} - bfs_simple_impl <- function( graph, root, @@ -6562,52 +6513,6 @@ bfs_simple_impl <- function( res } -dfs_impl <- function( - graph, - root, - mode = c("out", "in", "all", "total"), - unreachable, - in_callback = NULL, - out_callback = NULL -) { - # Argument checks - ensure_igraph(graph) - root <- as_igraph_vs(graph, root) - if (length(root) == 0) { - cli::cli_abort( - "{.arg root} must specify at least one vertex", - call = rlang::caller_env() - ) - } - mode <- switch_igraph_arg( - mode, - "out" = 1L, - "in" = 2L, - "all" = 3L, - "total" = 3L - ) - unreachable <- as.logical(unreachable) - - on.exit(.Call(R_igraph_finalizer)) - # Function call - res <- .Call( - R_igraph_dfs, - graph, - root - 1, - mode, - unreachable, - in_callback, - out_callback - ) - if (igraph_opt("return.vs.es")) { - res$order <- create_vs(graph, res$order) - } - if (igraph_opt("return.vs.es")) { - res$order_out <- create_vs(graph, res$order_out) - } - res -} - bipartite_projection_size_impl <- function( graph, types = NULL @@ -12945,92 +12850,6 @@ cmp_epsilon_impl <- function( res } -eigen_matrix_impl <- function( - A, - sA, - fun, - n, - algorithm, - which, - options = arpack_defaults() -) { - # Argument checks - A[] <- as.numeric(A) - requireNamespace("Matrix", quietly = TRUE); sA <- as(as(as(sA, "dMatrix"), "generalMatrix"), "CsparseMatrix") - n <- as.integer(n) - algorithm <- switch_igraph_arg( - algorithm, - "auto" = 0L, - "lapack" = 1L, - "arpack" = 2L, - "comp_auto" = 3L, - "comp_lapack" = 4L, - "comp_arpack" = 5L - ) - which.tmp <- eigen_defaults() - which.tmp[names(which)] <- which - which <- which.tmp - options <- modify_list(arpack_defaults(), options) - - on.exit(.Call(R_igraph_finalizer)) - # Function call - res <- .Call( - R_igraph_eigen_matrix, - A, - sA, - fun, - n, - algorithm, - which, - options - ) - - res -} - -eigen_matrix_symmetric_impl <- function( - A, - sA, - fun, - n, - algorithm, - which, - options = arpack_defaults() -) { - # Argument checks - A[] <- as.numeric(A) - requireNamespace("Matrix", quietly = TRUE); sA <- as(as(as(sA, "dMatrix"), "generalMatrix"), "CsparseMatrix") - n <- as.integer(n) - algorithm <- switch_igraph_arg( - algorithm, - "auto" = 0L, - "lapack" = 1L, - "arpack" = 2L, - "comp_auto" = 3L, - "comp_lapack" = 4L, - "comp_arpack" = 5L - ) - which.tmp <- eigen_defaults() - which.tmp[names(which)] <- which - which <- which.tmp - options <- modify_list(arpack_defaults(), options) - - on.exit(.Call(R_igraph_finalizer)) - # Function call - res <- .Call( - R_igraph_eigen_matrix_symmetric, - A, - sA, - fun, - n, - algorithm, - which, - options - ) - - res -} - solve_lsap_impl <- function( c, n diff --git a/src/cpp11.cpp b/src/cpp11.cpp index 96e9cfb9e8..98630a7433 100644 --- a/src/cpp11.cpp +++ b/src/cpp11.cpp @@ -52,7 +52,6 @@ extern SEXP R_igraph_barabasi_game(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEX extern SEXP R_igraph_betweenness(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_betweenness_cutoff(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_betweenness_subset(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); -extern SEXP R_igraph_bfs(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_bfs_simple(SEXP, SEXP, SEXP); extern SEXP R_igraph_biadjacency(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_bibcoupling(SEXP, SEXP); @@ -100,7 +99,6 @@ extern SEXP R_igraph_community_optimal_modularity(SEXP, SEXP); extern SEXP R_igraph_community_spinglass(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_community_spinglass_single(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_community_to_membership(SEXP, SEXP, SEXP); -extern SEXP R_igraph_community_voronoi(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_community_walktrap(SEXP, SEXP, SEXP); extern SEXP R_igraph_compare_communities(SEXP, SEXP, SEXP); extern SEXP R_igraph_complementer(SEXP, SEXP); @@ -136,13 +134,11 @@ extern SEXP R_igraph_delete_vertices(SEXP, SEXP); extern SEXP R_igraph_delete_vertices_idx(SEXP, SEXP); extern SEXP R_igraph_density(SEXP, SEXP); extern SEXP R_igraph_deterministic_optimal_imitation(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); -extern SEXP R_igraph_dfs(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_diameter(SEXP, SEXP, SEXP); extern SEXP R_igraph_diameter_dijkstra(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_difference(SEXP, SEXP); extern SEXP R_igraph_dim_select(SEXP); extern SEXP R_igraph_disjoint_union(SEXP, SEXP); -extern SEXP R_igraph_disjoint_union_many(SEXP); extern SEXP R_igraph_distances(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_distances_bellman_ford(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_distances_cutoff(SEXP, SEXP, SEXP, SEXP, SEXP); @@ -167,8 +163,6 @@ extern SEXP R_igraph_edge_disjoint_paths(SEXP, SEXP, SEXP); extern SEXP R_igraph_edgelist_percolation(SEXP); extern SEXP R_igraph_edges(SEXP, SEXP); extern SEXP R_igraph_eigen_adjacency(SEXP, SEXP, SEXP, SEXP); -extern SEXP R_igraph_eigen_matrix(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); -extern SEXP R_igraph_eigen_matrix_symmetric(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_eigenvector_centrality(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_empty(SEXP, SEXP); extern SEXP R_igraph_empty_attrs(SEXP, SEXP); @@ -258,7 +252,6 @@ extern SEXP R_igraph_independent_vertex_sets(SEXP, SEXP, SEXP); extern SEXP R_igraph_induced_subgraph(SEXP, SEXP, SEXP); extern SEXP R_igraph_induced_subgraph_map(SEXP, SEXP, SEXP); extern SEXP R_igraph_intersection(SEXP, SEXP); -extern SEXP R_igraph_intersection_many(SEXP); extern SEXP R_igraph_invalidate_cache(SEXP); extern SEXP R_igraph_is_acyclic(SEXP); extern SEXP R_igraph_is_biconnected(SEXP); @@ -477,7 +470,6 @@ extern SEXP R_igraph_trussness(SEXP); extern SEXP R_igraph_turan(SEXP, SEXP); extern SEXP R_igraph_unfold_tree(SEXP, SEXP, SEXP); extern SEXP R_igraph_union(SEXP, SEXP); -extern SEXP R_igraph_union_many(SEXP); extern SEXP R_igraph_vcount(SEXP); extern SEXP R_igraph_version(void); extern SEXP R_igraph_vertex_coloring_greedy(SEXP, SEXP); @@ -489,7 +481,6 @@ extern SEXP R_igraph_watts_strogatz_game(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_weighted_adjacency(SEXP, SEXP, SEXP); extern SEXP R_igraph_weighted_clique_number(SEXP, SEXP); extern SEXP R_igraph_weighted_cliques(SEXP, SEXP, SEXP, SEXP, SEXP); -extern SEXP R_igraph_weighted_sparsemat(SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_wheel(SEXP, SEXP, SEXP); extern SEXP R_igraph_widest_path_widths_dijkstra(SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP R_igraph_widest_path_widths_floyd_warshall(SEXP, SEXP, SEXP, SEXP, SEXP); @@ -654,7 +645,6 @@ static const R_CallMethodDef CallEntries[] = { {"R_igraph_betweenness", (DL_FUNC) &R_igraph_betweenness, 4}, {"R_igraph_betweenness_cutoff", (DL_FUNC) &R_igraph_betweenness_cutoff, 5}, {"R_igraph_betweenness_subset", (DL_FUNC) &R_igraph_betweenness_subset, 6}, - {"R_igraph_bfs", (DL_FUNC) &R_igraph_bfs, 7}, {"R_igraph_bfs_simple", (DL_FUNC) &R_igraph_bfs_simple, 3}, {"R_igraph_biadjacency", (DL_FUNC) &R_igraph_biadjacency, 4}, {"R_igraph_bibcoupling", (DL_FUNC) &R_igraph_bibcoupling, 2}, @@ -702,7 +692,6 @@ static const R_CallMethodDef CallEntries[] = { {"R_igraph_community_spinglass", (DL_FUNC) &R_igraph_community_spinglass, 11}, {"R_igraph_community_spinglass_single", (DL_FUNC) &R_igraph_community_spinglass_single, 6}, {"R_igraph_community_to_membership", (DL_FUNC) &R_igraph_community_to_membership, 3}, - {"R_igraph_community_voronoi", (DL_FUNC) &R_igraph_community_voronoi, 5}, {"R_igraph_community_walktrap", (DL_FUNC) &R_igraph_community_walktrap, 3}, {"R_igraph_compare_communities", (DL_FUNC) &R_igraph_compare_communities, 3}, {"R_igraph_complementer", (DL_FUNC) &R_igraph_complementer, 2}, @@ -738,13 +727,11 @@ static const R_CallMethodDef CallEntries[] = { {"R_igraph_delete_vertices_idx", (DL_FUNC) &R_igraph_delete_vertices_idx, 2}, {"R_igraph_density", (DL_FUNC) &R_igraph_density, 2}, {"R_igraph_deterministic_optimal_imitation", (DL_FUNC) &R_igraph_deterministic_optimal_imitation, 6}, - {"R_igraph_dfs", (DL_FUNC) &R_igraph_dfs, 6}, {"R_igraph_diameter", (DL_FUNC) &R_igraph_diameter, 3}, {"R_igraph_diameter_dijkstra", (DL_FUNC) &R_igraph_diameter_dijkstra, 4}, {"R_igraph_difference", (DL_FUNC) &R_igraph_difference, 2}, {"R_igraph_dim_select", (DL_FUNC) &R_igraph_dim_select, 1}, {"R_igraph_disjoint_union", (DL_FUNC) &R_igraph_disjoint_union, 2}, - {"R_igraph_disjoint_union_many", (DL_FUNC) &R_igraph_disjoint_union_many, 1}, {"R_igraph_distances", (DL_FUNC) &R_igraph_distances, 4}, {"R_igraph_distances_bellman_ford", (DL_FUNC) &R_igraph_distances_bellman_ford, 5}, {"R_igraph_distances_cutoff", (DL_FUNC) &R_igraph_distances_cutoff, 5}, @@ -769,8 +756,6 @@ static const R_CallMethodDef CallEntries[] = { {"R_igraph_edgelist_percolation", (DL_FUNC) &R_igraph_edgelist_percolation, 1}, {"R_igraph_edges", (DL_FUNC) &R_igraph_edges, 2}, {"R_igraph_eigen_adjacency", (DL_FUNC) &R_igraph_eigen_adjacency, 4}, - {"R_igraph_eigen_matrix", (DL_FUNC) &R_igraph_eigen_matrix, 7}, - {"R_igraph_eigen_matrix_symmetric", (DL_FUNC) &R_igraph_eigen_matrix_symmetric, 7}, {"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}, @@ -860,7 +845,6 @@ static const R_CallMethodDef CallEntries[] = { {"R_igraph_induced_subgraph", (DL_FUNC) &R_igraph_induced_subgraph, 3}, {"R_igraph_induced_subgraph_map", (DL_FUNC) &R_igraph_induced_subgraph_map, 3}, {"R_igraph_intersection", (DL_FUNC) &R_igraph_intersection, 2}, - {"R_igraph_intersection_many", (DL_FUNC) &R_igraph_intersection_many, 1}, {"R_igraph_invalidate_cache", (DL_FUNC) &R_igraph_invalidate_cache, 1}, {"R_igraph_is_acyclic", (DL_FUNC) &R_igraph_is_acyclic, 1}, {"R_igraph_is_biconnected", (DL_FUNC) &R_igraph_is_biconnected, 1}, @@ -1079,7 +1063,6 @@ static const R_CallMethodDef CallEntries[] = { {"R_igraph_turan", (DL_FUNC) &R_igraph_turan, 2}, {"R_igraph_unfold_tree", (DL_FUNC) &R_igraph_unfold_tree, 3}, {"R_igraph_union", (DL_FUNC) &R_igraph_union, 2}, - {"R_igraph_union_many", (DL_FUNC) &R_igraph_union_many, 1}, {"R_igraph_vcount", (DL_FUNC) &R_igraph_vcount, 1}, {"R_igraph_version", (DL_FUNC) &R_igraph_version, 0}, {"R_igraph_vertex_coloring_greedy", (DL_FUNC) &R_igraph_vertex_coloring_greedy, 2}, @@ -1091,7 +1074,6 @@ static const R_CallMethodDef CallEntries[] = { {"R_igraph_weighted_adjacency", (DL_FUNC) &R_igraph_weighted_adjacency, 3}, {"R_igraph_weighted_clique_number", (DL_FUNC) &R_igraph_weighted_clique_number, 2}, {"R_igraph_weighted_cliques", (DL_FUNC) &R_igraph_weighted_cliques, 5}, - {"R_igraph_weighted_sparsemat", (DL_FUNC) &R_igraph_weighted_sparsemat, 4}, {"R_igraph_wheel", (DL_FUNC) &R_igraph_wheel, 3}, {"R_igraph_widest_path_widths_dijkstra", (DL_FUNC) &R_igraph_widest_path_widths_dijkstra, 5}, {"R_igraph_widest_path_widths_floyd_warshall", (DL_FUNC) &R_igraph_widest_path_widths_floyd_warshall, 5}, diff --git a/src/rinterface.c b/src/rinterface.c index 94f664426b..bc9eeae9a9 100644 --- a/src/rinterface.c +++ b/src/rinterface.c @@ -8467,107 +8467,6 @@ SEXP R_igraph_is_graphical(SEXP out_deg, SEXP in_deg, SEXP allowed_edge_types) { return(r_result); } -/*-------------------------------------------/ -/ igraph_bfs / -/-------------------------------------------*/ -SEXP R_igraph_bfs(SEXP graph, SEXP root, SEXP roots, SEXP mode, SEXP unreachable, SEXP restricted, SEXP callback) { - /* Declarations */ - igraph_t c_graph; - igraph_integer_t c_root; - igraph_vector_int_t c_roots; - igraph_neimode_t c_mode; - igraph_bool_t c_unreachable; - igraph_vector_int_t c_restricted; - igraph_vector_int_t c_order; - igraph_vector_int_t c_rank; - igraph_vector_int_t c_parents; - igraph_vector_int_t c_pred; - igraph_vector_int_t c_succ; - igraph_vector_int_t c_dist; - igraph_bfshandler_t c_callback; - - SEXP order; - SEXP rank; - SEXP parents; - SEXP pred; - SEXP succ; - SEXP dist; - - SEXP r_result, r_names; - /* Convert input */ - Rz_SEXP_to_igraph(graph, &c_graph); - c_root = (igraph_integer_t) REAL(root)[0]; - if (!Rf_isNull(roots)) { - Rz_SEXP_to_vector_int_copy(roots, &c_roots); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_roots); - } else { - IGRAPH_R_CHECK(igraph_vector_int_init(&c_roots, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_roots); - } - c_mode = (igraph_neimode_t) Rf_asInteger(mode); - IGRAPH_R_CHECK_BOOL(unreachable); - c_unreachable = LOGICAL(unreachable)[0]; - Rz_SEXP_to_vector_int_copy(restricted, &c_restricted); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_restricted); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_order, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_order); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_rank, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_rank); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_parents, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_parents); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_pred, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_pred); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_succ, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_succ); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_dist, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_dist); - /* Call igraph */ - IGRAPH_R_CHECK(igraph_bfs(&c_graph, c_root, (Rf_isNull(roots) ? 0 : &c_roots), c_mode, c_unreachable, &c_restricted, &c_order, &c_rank, &c_parents, &c_pred, &c_succ, &c_dist, (Rf_isNull(callback) ? 0 : c_callback), 0)); - - /* Convert output */ - PROTECT(r_result=NEW_LIST(6)); - PROTECT(r_names=NEW_CHARACTER(6)); - igraph_vector_int_destroy(&c_roots); - IGRAPH_FINALLY_CLEAN(1); - igraph_vector_int_destroy(&c_restricted); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(order=Ry_igraph_vector_int_to_SEXPp1(&c_order)); - igraph_vector_int_destroy(&c_order); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(rank=Ry_igraph_vector_int_to_SEXP(&c_rank)); - igraph_vector_int_destroy(&c_rank); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(parents=Ry_igraph_vector_int_to_SEXP(&c_parents)); - igraph_vector_int_destroy(&c_parents); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(pred=Ry_igraph_vector_int_to_SEXP(&c_pred)); - igraph_vector_int_destroy(&c_pred); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(succ=Ry_igraph_vector_int_to_SEXP(&c_succ)); - igraph_vector_int_destroy(&c_succ); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(dist=Ry_igraph_vector_int_to_SEXP(&c_dist)); - igraph_vector_int_destroy(&c_dist); - IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, order); - SET_VECTOR_ELT(r_result, 1, rank); - SET_VECTOR_ELT(r_result, 2, parents); - SET_VECTOR_ELT(r_result, 3, pred); - SET_VECTOR_ELT(r_result, 4, succ); - SET_VECTOR_ELT(r_result, 5, dist); - SET_STRING_ELT(r_names, 0, Rf_mkChar("order")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("rank")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("parents")); - SET_STRING_ELT(r_names, 3, Rf_mkChar("pred")); - SET_STRING_ELT(r_names, 4, Rf_mkChar("succ")); - SET_STRING_ELT(r_names, 5, Rf_mkChar("dist")); - SET_NAMES(r_result, r_names); - UNPROTECT(7); - - UNPROTECT(1); - return(r_result); -} - /*-------------------------------------------/ / igraph_bfs_simple / /-------------------------------------------*/ @@ -8622,75 +8521,6 @@ SEXP R_igraph_bfs_simple(SEXP graph, SEXP root, SEXP mode) { return(r_result); } -/*-------------------------------------------/ -/ igraph_dfs / -/-------------------------------------------*/ -SEXP R_igraph_dfs(SEXP graph, SEXP root, SEXP mode, SEXP unreachable, SEXP in_callback, SEXP out_callback) { - /* Declarations */ - igraph_t c_graph; - igraph_integer_t c_root; - igraph_neimode_t c_mode; - igraph_bool_t c_unreachable; - igraph_vector_int_t c_order; - igraph_vector_int_t c_order_out; - igraph_vector_int_t c_father; - igraph_vector_int_t c_dist; - igraph_dfshandler_t c_in_callback; - igraph_dfshandler_t c_out_callback; - - SEXP order; - SEXP order_out; - SEXP father; - SEXP dist; - - SEXP r_result, r_names; - /* Convert input */ - Rz_SEXP_to_igraph(graph, &c_graph); - c_root = (igraph_integer_t) REAL(root)[0]; - c_mode = (igraph_neimode_t) Rf_asInteger(mode); - IGRAPH_R_CHECK_BOOL(unreachable); - c_unreachable = LOGICAL(unreachable)[0]; - IGRAPH_R_CHECK(igraph_vector_int_init(&c_order, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_order); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_order_out, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_order_out); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_father, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_father); - IGRAPH_R_CHECK(igraph_vector_int_init(&c_dist, 0)); - IGRAPH_FINALLY(igraph_vector_int_destroy, &c_dist); - /* Call igraph */ - IGRAPH_R_CHECK(igraph_dfs(&c_graph, c_root, c_mode, c_unreachable, &c_order, &c_order_out, &c_father, &c_dist, (Rf_isNull(in_callback) ? 0 : c_in_callback), (Rf_isNull(out_callback) ? 0 : c_out_callback), 0)); - - /* Convert output */ - PROTECT(r_result=NEW_LIST(4)); - PROTECT(r_names=NEW_CHARACTER(4)); - PROTECT(order=Ry_igraph_vector_int_to_SEXPp1(&c_order)); - igraph_vector_int_destroy(&c_order); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(order_out=Ry_igraph_vector_int_to_SEXPp1(&c_order_out)); - igraph_vector_int_destroy(&c_order_out); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(father=Ry_igraph_vector_int_to_SEXP(&c_father)); - igraph_vector_int_destroy(&c_father); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(dist=Ry_igraph_vector_int_to_SEXP(&c_dist)); - igraph_vector_int_destroy(&c_dist); - IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, order); - SET_VECTOR_ELT(r_result, 1, order_out); - SET_VECTOR_ELT(r_result, 2, father); - SET_VECTOR_ELT(r_result, 3, dist); - SET_STRING_ELT(r_names, 0, Rf_mkChar("order")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("order_out")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("father")); - SET_STRING_ELT(r_names, 3, Rf_mkChar("dist")); - SET_NAMES(r_result, r_names); - UNPROTECT(5); - - UNPROTECT(1); - return(r_result); -} - /*-------------------------------------------/ / igraph_bipartite_projection_size / /-------------------------------------------*/ @@ -17524,124 +17354,6 @@ SEXP R_igraph_cmp_epsilon(SEXP a, SEXP b, SEXP eps) { return(r_result); } -/*-------------------------------------------/ -/ igraph_eigen_matrix / -/-------------------------------------------*/ -SEXP R_igraph_eigen_matrix(SEXP A, SEXP sA, SEXP n, SEXP algorithm, SEXP which, SEXP options) { - /* Declarations */ - igraph_matrix_t c_A; - igraph_sparsemat_t c_sA; - - int c_n; - - igraph_eigen_algorithm_t c_algorithm; - igraph_eigen_which_t c_which; - igraph_arpack_options_t c_options; - - igraph_vector_complex_t c_values; - igraph_matrix_complex_t c_vectors; - SEXP values; - SEXP vectors; - - SEXP r_result, r_names; - /* Convert input */ - Rz_SEXP_to_matrix(A, &c_A); - Rz_SEXP_to_sparsemat(sA, &c_sA); - IGRAPH_R_CHECK_INT(n); - c_n = INTEGER(n)[0]; - c_algorithm = (igraph_eigen_algorithm_t) Rf_asInteger(algorithm); - Rz_SEXP_to_igraph_eigen_which(which, &c_which); - Rz_SEXP_to_igraph_arpack_options(options, &c_options); - IGRAPH_R_CHECK(igraph_vector_complex_init(&c_values, 0)); - IGRAPH_FINALLY(igraph_vector_complex_destroy, &c_values); - values=R_GlobalEnv; /* hack to have a non-NULL value */ - IGRAPH_R_CHECK(igraph_matrix_complex_init(&c_vectors, 0, 0)); - IGRAPH_FINALLY(igraph_matrix_complex_destroy, &c_vectors); - vectors=R_GlobalEnv; /* hack to have a non-NULL value */ - /* Call igraph */ - IGRAPH_R_CHECK(igraph_eigen_matrix(&c_A, &c_sA, 0, c_n, 0, c_algorithm, &c_which, &c_options, 0, (Rf_isNull(values) ? NULL : &c_values), (Rf_isNull(vectors) ? NULL : &c_vectors))); - - /* Convert output */ - PROTECT(r_result=NEW_LIST(3)); - PROTECT(r_names=NEW_CHARACTER(3)); - PROTECT(options=Ry_igraph_arpack_options_to_SEXP(&c_options)); - PROTECT(values=Ry_igraph_0orvector_complex_to_SEXP(&c_values)); - igraph_vector_complex_destroy(&c_values); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(vectors=Ry_igraph_0ormatrix_complex_to_SEXP(&c_vectors)); - igraph_matrix_complex_destroy(&c_vectors); - IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, options); - SET_VECTOR_ELT(r_result, 1, values); - SET_VECTOR_ELT(r_result, 2, vectors); - SET_STRING_ELT(r_names, 0, Rf_mkChar("options")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("values")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("vectors")); - SET_NAMES(r_result, r_names); - UNPROTECT(4); - - UNPROTECT(1); - return(r_result); -} - -/*-------------------------------------------/ -/ igraph_eigen_matrix_symmetric / -/-------------------------------------------*/ -SEXP R_igraph_eigen_matrix_symmetric(SEXP A, SEXP sA, SEXP n, SEXP algorithm, SEXP which, SEXP options) { - /* Declarations */ - igraph_matrix_t c_A; - igraph_sparsemat_t c_sA; - - int c_n; - - igraph_eigen_algorithm_t c_algorithm; - igraph_eigen_which_t c_which; - igraph_arpack_options_t c_options; - - igraph_vector_t c_values; - igraph_matrix_t c_vectors; - SEXP values; - SEXP vectors; - - SEXP r_result, r_names; - /* Convert input */ - Rz_SEXP_to_matrix(A, &c_A); - Rz_SEXP_to_sparsemat(sA, &c_sA); - IGRAPH_R_CHECK_INT(n); - c_n = INTEGER(n)[0]; - c_algorithm = (igraph_eigen_algorithm_t) Rf_asInteger(algorithm); - Rz_SEXP_to_igraph_eigen_which(which, &c_which); - Rz_SEXP_to_igraph_arpack_options(options, &c_options); - IGRAPH_R_CHECK(igraph_vector_init(&c_values, 0)); - IGRAPH_FINALLY(igraph_vector_destroy, &c_values); - IGRAPH_R_CHECK(igraph_matrix_init(&c_vectors, 0, 0)); - IGRAPH_FINALLY(igraph_matrix_destroy, &c_vectors); - /* Call igraph */ - IGRAPH_R_CHECK(igraph_eigen_matrix_symmetric(&c_A, &c_sA, 0, c_n, 0, c_algorithm, &c_which, &c_options, 0, &c_values, &c_vectors)); - - /* Convert output */ - PROTECT(r_result=NEW_LIST(3)); - PROTECT(r_names=NEW_CHARACTER(3)); - PROTECT(options=Ry_igraph_arpack_options_to_SEXP(&c_options)); - PROTECT(values=Ry_igraph_vector_to_SEXP(&c_values)); - igraph_vector_destroy(&c_values); - IGRAPH_FINALLY_CLEAN(1); - PROTECT(vectors=Ry_igraph_matrix_to_SEXP(&c_vectors)); - igraph_matrix_destroy(&c_vectors); - IGRAPH_FINALLY_CLEAN(1); - SET_VECTOR_ELT(r_result, 0, options); - SET_VECTOR_ELT(r_result, 1, values); - SET_VECTOR_ELT(r_result, 2, vectors); - SET_STRING_ELT(r_names, 0, Rf_mkChar("options")); - SET_STRING_ELT(r_names, 1, Rf_mkChar("values")); - SET_STRING_ELT(r_names, 2, Rf_mkChar("vectors")); - SET_NAMES(r_result, r_names); - UNPROTECT(4); - - UNPROTECT(1); - return(r_result); -} - /*-------------------------------------------/ / igraph_solve_lsap / /-------------------------------------------*/ diff --git a/tests/testthat/_snaps/aaa-auto.md b/tests/testthat/_snaps/aaa-auto.md index 26e86730a0..cc195b5b6f 100644 --- a/tests/testthat/_snaps/aaa-auto.md +++ b/tests/testthat/_snaps/aaa-auto.md @@ -7651,7 +7651,10 @@ [3,] 0.6718598 -0.4487712 $Y - NULL + [,1] [,2] + [1,] 0.6718598 -0.4487712 + [2,] 1.1328501 0.5323058 + [3,] 0.6718598 -0.4487712 $D [1] 2.1861407 -0.6861407 @@ -7732,7 +7735,10 @@ [3,] 0.7563200 0.4912963 $Y - NULL + [,1] [,2] + [1,] 0.1720265 -0.7864357 + [2,] 0.6311790 -0.3743620 + [3,] 0.7563200 0.4912963 $D [1] 4.669079 1.476024 @@ -7820,7 +7826,10 @@ [3,] -0.7071068 0.7071068 $Y - NULL + [,1] [,2] + [1,] -0.7071068 -0.7071068 + [2,] 1.4142136 0.0000000 + [3,] -0.7071068 0.7071068 $D [1] 3 1 diff --git a/tests/testthat/test-aaa-auto.R b/tests/testthat/test-aaa-auto.R index 1b59cb8883..36bc87bc7a 100644 --- a/tests/testthat/test-aaa-auto.R +++ b/tests/testthat/test-aaa-auto.R @@ -10618,3 +10618,916 @@ test_that("intersection_impl errors", { right = NULL )) }) + + +# Tests for newly autogenerated _impl functions +# add_edge_impl +test_that("add_edge_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for add_edge_impl") +}) + +# adjacency_impl +test_that("adjacency_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for adjacency_impl") +}) + +# almost_equals_impl +test_that("almost_equals_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for almost_equals_impl") +}) + +# are_connected_impl +test_that("are_connected_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for are_connected_impl") +}) + +# authority_score_impl +test_that("authority_score_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for authority_score_impl") +}) + +# average_path_length_impl +test_that("average_path_length_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for average_path_length_impl") +}) + +# barabasi_aging_game_impl +test_that("barabasi_aging_game_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for barabasi_aging_game_impl") +}) + +# barabasi_game_impl +test_that("barabasi_game_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for barabasi_game_impl") +}) + +# betweenness_cutoff_impl +test_that("betweenness_cutoff_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for betweenness_cutoff_impl") +}) + +# betweenness_impl +test_that("betweenness_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for betweenness_impl") +}) + +# betweenness_subset_impl +test_that("betweenness_subset_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for betweenness_subset_impl") +}) + +# bfs_impl +test_that("bfs_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for bfs_impl") +}) + +# bipartite_game_impl +test_that("bipartite_game_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for bipartite_game_impl") +}) + +# bipartite_projection_impl +test_that("bipartite_projection_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for bipartite_projection_impl") +}) + +# callaway_traits_game_impl +test_that("callaway_traits_game_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for callaway_traits_game_impl") +}) + +# cited_type_game_impl +test_that("cited_type_game_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for cited_type_game_impl") +}) + +# citing_cited_type_game_impl +test_that("citing_cited_type_game_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for citing_cited_type_game_impl") +}) + +# closeness_impl +test_that("closeness_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for closeness_impl") +}) + +# cmp_epsilon_impl +test_that("cmp_epsilon_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for cmp_epsilon_impl") +}) + +# community_eb_get_merges_impl +test_that("community_eb_get_merges_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for community_eb_get_merges_impl") +}) + +# community_edge_betweenness_impl +test_that("community_edge_betweenness_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for community_edge_betweenness_impl") +}) + +# community_fastgreedy_impl +test_that("community_fastgreedy_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for community_fastgreedy_impl") +}) + +# community_spinglass_impl +test_that("community_spinglass_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for community_spinglass_impl") +}) + +# community_spinglass_single_impl +test_that("community_spinglass_single_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for community_spinglass_single_impl") +}) + +# community_to_membership_impl +test_that("community_to_membership_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for community_to_membership_impl") +}) + +# community_walktrap_impl +test_that("community_walktrap_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for community_walktrap_impl") +}) + +# compare_communities_impl +test_that("compare_communities_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for compare_communities_impl") +}) + +# connect_neighborhood_impl +test_that("connect_neighborhood_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for connect_neighborhood_impl") +}) + +# convergence_degree_impl +test_that("convergence_degree_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for convergence_degree_impl") +}) + +# create_bipartite_impl +test_that("create_bipartite_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for create_bipartite_impl") +}) + +# create_impl +test_that("create_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for create_impl") +}) + +# decompose_impl +test_that("decompose_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for decompose_impl") +}) + +# degree_sequence_game_impl +test_that("degree_sequence_game_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for degree_sequence_game_impl") +}) + +# dfs_impl +test_that("dfs_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for dfs_impl") +}) + +# diameter_dijkstra_impl +test_that("diameter_dijkstra_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for diameter_dijkstra_impl") +}) + +# diameter_impl +test_that("diameter_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for diameter_impl") +}) + +# distances_bellman_ford_impl +test_that("distances_bellman_ford_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for distances_bellman_ford_impl") +}) + +# distances_cutoff_impl +test_that("distances_cutoff_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for distances_cutoff_impl") +}) + +# distances_dijkstra_cutoff_impl +test_that("distances_dijkstra_cutoff_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for distances_dijkstra_cutoff_impl") +}) + +# distances_dijkstra_impl +test_that("distances_dijkstra_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for distances_dijkstra_impl") +}) + +# distances_floyd_warshall_impl +test_that("distances_floyd_warshall_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for distances_floyd_warshall_impl") +}) + +# distances_impl +test_that("distances_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for distances_impl") +}) + +# distances_johnson_impl +test_that("distances_johnson_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for distances_johnson_impl") +}) + +# eccentricity_impl +test_that("eccentricity_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for eccentricity_impl") +}) + +# edge_betweenness_impl +test_that("edge_betweenness_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for edge_betweenness_impl") +}) + +# edge_connectivity_impl +test_that("edge_connectivity_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for edge_connectivity_impl") +}) + +# edge_disjoint_paths_impl +test_that("edge_disjoint_paths_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for edge_disjoint_paths_impl") +}) + +# edge_impl +test_that("edge_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for edge_impl") +}) + +# eigen_matrix_impl +test_that("eigen_matrix_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for eigen_matrix_impl") +}) + +# eigen_matrix_symmetric_impl +test_that("eigen_matrix_symmetric_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for eigen_matrix_symmetric_impl") +}) + +# empty_attrs_impl +test_that("empty_attrs_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for empty_attrs_impl") +}) + +# establishment_game_impl +test_that("establishment_game_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for establishment_game_impl") +}) + +# expand_path_to_pairs_impl +test_that("expand_path_to_pairs_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for expand_path_to_pairs_impl") +}) + +# full_impl +test_that("full_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for full_impl") +}) + +# get_adjacency_impl +test_that("get_adjacency_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for get_adjacency_impl") +}) + +# get_all_shortest_paths_dijkstra_impl +test_that("get_all_shortest_paths_dijkstra_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for get_all_shortest_paths_dijkstra_impl") +}) + +# get_all_shortest_paths_impl +test_that("get_all_shortest_paths_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for get_all_shortest_paths_impl") +}) + +# get_all_simple_paths_impl +test_that("get_all_simple_paths_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for get_all_simple_paths_impl") +}) + +# get_eids_impl +test_that("get_eids_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for get_eids_impl") +}) + +# get_k_shortest_paths_impl +test_that("get_k_shortest_paths_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for get_k_shortest_paths_impl") +}) + +# get_shortest_path_astar_impl +test_that("get_shortest_path_astar_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for get_shortest_path_astar_impl") +}) + +# get_shortest_paths_bellman_ford_impl +test_that("get_shortest_paths_bellman_ford_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for get_shortest_paths_bellman_ford_impl") +}) + +# get_shortest_paths_dijkstra_impl +test_that("get_shortest_paths_dijkstra_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for get_shortest_paths_dijkstra_impl") +}) + +# get_shortest_paths_impl +test_that("get_shortest_paths_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for get_shortest_paths_impl") +}) + +# get_widest_path_impl +test_that("get_widest_path_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for get_widest_path_impl") +}) + +# get_widest_paths_impl +test_that("get_widest_paths_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for get_widest_paths_impl") +}) + +# graph_center_impl +test_that("graph_center_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for graph_center_impl") +}) + +# grg_game_impl +test_that("grg_game_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for grg_game_impl") +}) + +# growing_random_game_impl +test_that("growing_random_game_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for growing_random_game_impl") +}) + +# harmonic_centrality_impl +test_that("harmonic_centrality_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for harmonic_centrality_impl") +}) + +# has_attribute_table_impl +test_that("has_attribute_table_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for has_attribute_table_impl") +}) + +# hub_score_impl +test_that("hub_score_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for hub_score_impl") +}) + +# independent_vertex_sets_impl +test_that("independent_vertex_sets_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for independent_vertex_sets_impl") +}) + +# is_bigraphical_impl +test_that("is_bigraphical_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for is_bigraphical_impl") +}) + +# is_chordal_impl +test_that("is_chordal_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for is_chordal_impl") +}) + +# is_same_graph_impl +test_that("is_same_graph_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for is_same_graph_impl") +}) + +# kary_tree_impl +test_that("kary_tree_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for kary_tree_impl") +}) + +# lastcit_game_impl +test_that("lastcit_game_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for lastcit_game_impl") +}) + +# layout_drl_impl +test_that("layout_drl_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for layout_drl_impl") +}) + +# layout_fruchterman_reingold_impl +test_that("layout_fruchterman_reingold_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for layout_fruchterman_reingold_impl") +}) + +# layout_graphopt_impl +test_that("layout_graphopt_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for layout_graphopt_impl") +}) + +# layout_kamada_kawai_impl +test_that("layout_kamada_kawai_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for layout_kamada_kawai_impl") +}) + +# layout_lgl_impl +test_that("layout_lgl_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for layout_lgl_impl") +}) + +# layout_reingold_tilford_circular_impl +test_that("layout_reingold_tilford_circular_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for layout_reingold_tilford_circular_impl") +}) + +# layout_reingold_tilford_impl +test_that("layout_reingold_tilford_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for layout_reingold_tilford_impl") +}) + +# layout_sphere_impl +test_that("layout_sphere_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for layout_sphere_impl") +}) + +# le_community_to_membership_impl +test_that("le_community_to_membership_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for le_community_to_membership_impl") +}) + +# maxflow_value_impl +test_that("maxflow_value_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for maxflow_value_impl") +}) + +# maximal_cliques_file_impl +test_that("maximal_cliques_file_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for maximal_cliques_file_impl") +}) + +# maximal_cliques_impl +test_that("maximal_cliques_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for maximal_cliques_impl") +}) + +# maximal_cliques_subset_impl +test_that("maximal_cliques_subset_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for maximal_cliques_subset_impl") +}) + +# minimum_spanning_tree_impl +test_that("minimum_spanning_tree_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for minimum_spanning_tree_impl") +}) + +# neighborhood_graphs_impl +test_that("neighborhood_graphs_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for neighborhood_graphs_impl") +}) + +# neighborhood_impl +test_that("neighborhood_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for neighborhood_impl") +}) + +# neighborhood_size_impl +test_that("neighborhood_size_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for neighborhood_size_impl") +}) + +# pagerank_impl +test_that("pagerank_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for pagerank_impl") +}) + +# progress_impl +test_that("progress_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for progress_impl") +}) + +# radius_impl +test_that("radius_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for radius_impl") +}) + +# random_edge_walk_impl +test_that("random_edge_walk_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for random_edge_walk_impl") +}) + +# random_sample_impl +test_that("random_sample_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for random_sample_impl") +}) + +# read_graph_dimacs_flow_impl +test_that("read_graph_dimacs_flow_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for read_graph_dimacs_flow_impl") +}) + +# read_graph_dl_impl +test_that("read_graph_dl_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for read_graph_dl_impl") +}) + +# read_graph_edgelist_impl +test_that("read_graph_edgelist_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for read_graph_edgelist_impl") +}) + +# read_graph_lgl_impl +test_that("read_graph_lgl_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for read_graph_lgl_impl") +}) + +# read_graph_ncol_impl +test_that("read_graph_ncol_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for read_graph_ncol_impl") +}) + +# recent_degree_aging_game_impl +test_that("recent_degree_aging_game_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for recent_degree_aging_game_impl") +}) + +# recent_degree_game_impl +test_that("recent_degree_game_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for recent_degree_game_impl") +}) + +# reindex_membership_impl +test_that("reindex_membership_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for reindex_membership_impl") +}) + +# ring_impl +test_that("ring_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for ring_impl") +}) + +# similarity_jaccard_es_impl +test_that("similarity_jaccard_es_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for similarity_jaccard_es_impl") +}) + +# similarity_jaccard_pairs_impl +test_that("similarity_jaccard_pairs_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for similarity_jaccard_pairs_impl") +}) + +# spanner_impl +test_that("spanner_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for spanner_impl") +}) + +# st_edge_connectivity_impl +test_that("st_edge_connectivity_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for st_edge_connectivity_impl") +}) + +# st_mincut_value_impl +test_that("st_mincut_value_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for st_mincut_value_impl") +}) + +# st_vertex_connectivity_impl +test_that("st_vertex_connectivity_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for st_vertex_connectivity_impl") +}) + +# star_impl +test_that("star_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for star_impl") +}) + +# status_impl +test_that("status_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for status_impl") +}) + +# strerror_impl +test_that("strerror_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for strerror_impl") +}) + +# subcomponent_impl +test_that("subcomponent_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for subcomponent_impl") +}) + +# vertex_connectivity_impl +test_that("vertex_connectivity_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for vertex_connectivity_impl") +}) + +# vertex_disjoint_paths_impl +test_that("vertex_disjoint_paths_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for vertex_disjoint_paths_impl") +}) + +# voronoi_impl +test_that("voronoi_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for voronoi_impl") +}) + +# watts_strogatz_game_impl +test_that("watts_strogatz_game_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for watts_strogatz_game_impl") +}) + +# weighted_adjacency_impl +test_that("weighted_adjacency_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for weighted_adjacency_impl") +}) + +# widest_path_widths_dijkstra_impl +test_that("widest_path_widths_dijkstra_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for widest_path_widths_dijkstra_impl") +}) + +# widest_path_widths_floyd_warshall_impl +test_that("widest_path_widths_floyd_warshall_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for widest_path_widths_floyd_warshall_impl") +}) + +# write_graph_dimacs_flow_impl +test_that("write_graph_dimacs_flow_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for write_graph_dimacs_flow_impl") +}) + +# write_graph_edgelist_impl +test_that("write_graph_edgelist_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for write_graph_edgelist_impl") +}) + +# write_graph_lgl_impl +test_that("write_graph_lgl_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for write_graph_lgl_impl") +}) + +# write_graph_ncol_impl +test_that("write_graph_ncol_impl basic", { + withr::local_seed(20250909) + local_igraph_options(print.id = FALSE) + skip("TODO: Add test for write_graph_ncol_impl") +}) + diff --git a/tools/stimulus/functions-R.yaml b/tools/stimulus/functions-R.yaml index c31d1a034e..ab45b76f90 100644 --- a/tools/stimulus/functions-R.yaml +++ b/tools/stimulus/functions-R.yaml @@ -449,11 +449,15 @@ igraph_is_bigraphical: ####################################### igraph_bfs: + # Has callback parameter (BFS_FUNC) + IGNORE: RR, RC, RInit igraph_bfs_simple: DEPS: root ON graph, order ON graph igraph_dfs: + # Has callback parameter (DFS_FUNC) + IGNORE: RR, RC, RInit ####################################### # Bipartite graphs @@ -849,9 +853,12 @@ igraph_cmp_epsilon: # TODO: temporarily disabled igraph_eigen_matrix: + # TODO: temporarily disabled - missing SPARSEMAT converter + IGNORE: RR, RC -# TODO: temporarily disabled igraph_eigen_matrix_symmetric: + # TODO: temporarily disabled - missing SPARSEMAT converter + IGNORE: RR, RC ####################################### # Finding cycles From 93179b279b71f83d445795bc222bc11a96bd44fe Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 5 Nov 2025 00:05:20 +0000 Subject: [PATCH 05/10] test: add useful snapshot tests for 45+ new _impl functions - Added comprehensive snapshot tests for graph constructors (ring, full, kary_tree) - Added tests for random graph generators (growing_random_game, grg_game, watts_strogatz_game) - Added tests for distance/path functions (distances, diameter, get_shortest_paths, subcomponent) - Added tests for centrality measures (betweenness, closeness, harmonic_centrality, pagerank, hub_score, authority_score) - Added tests for community detection (walktrap, fastgreedy, edge_betweenness) - Added tests for connectivity (edge_connectivity, vertex_connectivity) - Added tests for layout (layout_sphere) - Added tests for bipartite functions (create_bipartite) - Added tests for structural functions (decompose, neighborhood, neighborhood_size) - Added tests for graph properties (get_adjacency) - Added tests for IO functions (write/read_graph_edgelist) - Added tests for utility functions (compare_communities, connect_neighborhood, eccentricity, radius, graph_center, voronoi, spanner, edge_betweenness, maximal_cliques, independent_vertex_sets) - Skipped 5 tests that require enum constants not yet defined in R types (star, barabasi_game, bipartite_game, degree_sequence_game, is_chordal) - All tests pass: 1208 passing, 5 skipped Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com> --- tests/testthat/_snaps/aaa-auto.md | 663 +++++++++++++++++++++++ tests/testthat/test-aaa-auto.R | 851 +++++------------------------- 2 files changed, 808 insertions(+), 706 deletions(-) diff --git a/tests/testthat/_snaps/aaa-auto.md b/tests/testthat/_snaps/aaa-auto.md index cc195b5b6f..9ed99b8df8 100644 --- a/tests/testthat/_snaps/aaa-auto.md +++ b/tests/testthat/_snaps/aaa-auto.md @@ -856,6 +856,16 @@ + edges: [1] 1--2 1--2 2--3 1--3 1--4 2--4 1--5 4--5 +--- + + Code + growing_random_game_impl(n = 10, m = 1, directed = TRUE, citation = FALSE) + Output + IGRAPH D--- 10 9 -- Growing random graph + + attr: name (g/c), m (g/n), citation (g/l) + + edges: + [1] 2->2 2->3 4->4 4->4 3->2 1->3 1->8 5->6 5->4 + # growing_random_game_impl errors Code @@ -1402,6 +1412,21 @@ [1] TRUE +--- + + Code + closeness_impl(graph = g, vids = V(g), mode = c("out", "in", "all", "total")) + Output + $res + [1] 0.1666667 0.1666667 0.1666667 0.1666667 0.1666667 + + $reachable_count + [1] 4 4 4 4 4 + + $all_reachable + [1] TRUE + + # closeness_impl errors Code @@ -1596,6 +1621,18 @@ [1] 0 1 2 +--- + + Code + voronoi_impl(graph = g, generators = c(1, 5), mode = c("out", "in", "all")) + Output + $membership + [1] 0 0 0 1 1 1 1 1 0 0 + + $distances + [1] 0 1 2 1 0 1 2 3 2 1 + + # voronoi_impl errors Code @@ -1708,6 +1745,14 @@ + 2/2 edges: [1] 1--2 2--3 +--- + + Code + spanner_impl(graph = g, stretch = 2) + Output + + 5/5 edges: + [1] 1--2 2--3 3--4 4--5 1--5 + # spanner_impl errors Code @@ -1753,6 +1798,13 @@ Output [1] 2 2 +--- + + Code + edge_betweenness_impl(graph = g, directed = FALSE) + Output + [1] 4 4 4 4 + # edge_betweenness_impl errors Code @@ -4884,6 +4936,18 @@ [2,] -0.4861377 0.8738822 0 [3,] 0.0000000 0.0000000 1 +--- + + Code + layout_sphere_impl(graph = g) + Output + [,1] [,2] [,3] + [1,] 0.0000000 0.0000000 -1.0 + [2,] -0.2461774 0.8302992 -0.5 + [3,] -0.9468790 -0.3215901 0.0 + [4,] 0.5001161 -0.7070246 0.5 + [5,] 0.0000000 0.0000000 1.0 + # layout_sphere_impl errors Code @@ -5334,6 +5398,13 @@ Output [1] 1 +--- + + Code + compare_communities_impl(comm1 = comm1, comm2 = comm2, method = "vi") + Output + [1] 0.5493061 + # compare_communities_impl errors Code @@ -10425,3 +10496,595 @@ Error in `ensure_igraph()`: ! Must provide a graph object (provided `NULL`). +# ring_impl basic + + Code + ring_impl(n = 5, directed = FALSE, mutual = FALSE, circular = TRUE) + Output + IGRAPH U--- 5 5 -- + + edges: + [1] 1--2 2--3 3--4 4--5 1--5 + +--- + + Code + ring_impl(n = 4, directed = TRUE, mutual = FALSE, circular = FALSE) + Output + IGRAPH D--- 4 3 -- + + edges: + [1] 1->2 2->3 3->4 + +# full_impl basic + + Code + full_impl(n = 4, directed = FALSE, loops = FALSE) + Output + IGRAPH U--- 4 6 -- + + edges: + [1] 1--2 1--3 1--4 2--3 2--4 3--4 + +--- + + Code + full_impl(n = 3, directed = TRUE, loops = FALSE) + Output + IGRAPH D--- 3 6 -- + + edges: + [1] 1->2 1->3 2->1 2->3 3->1 3->2 + +# kary_tree_impl basic + + Code + kary_tree_impl(n = 7, children = 2, type = c("out", "in", "undirected")) + Output + IGRAPH D--- 7 6 -- + + edges: + [1] 1->2 1->3 2->4 2->5 3->6 3->7 + +--- + + Code + kary_tree_impl(n = 10, children = 3, type = c("in", "out", "undirected")) + Output + IGRAPH D--- 10 9 -- + + edges: + [1] 2->1 3->1 4->1 5->2 6->2 7->2 8->3 9->3 10->3 + +# grg_game_impl basic + + Code + grg_game_impl(nodes = 10, radius = 0.3, torus = FALSE) + Output + $graph + IGRAPH U--- 10 12 -- + + edges: + [1] 3-- 5 3-- 6 5-- 6 5-- 7 5-- 8 6-- 8 7-- 8 7-- 9 7--10 8-- 9 8--10 9--10 + + $x + [1] 0.08565451 0.15145413 0.45222514 0.45939554 0.55956278 0.61872370 + [7] 0.76201957 0.82545284 0.86690370 0.95857358 + + $y + [1] 0.07820721 0.85018913 0.08700766 0.73223568 0.33212277 0.14562638 + [7] 0.53326474 0.32235478 0.49679861 0.31410636 + + +# watts_strogatz_game_impl basic + + Code + watts_strogatz_game_impl(dim = 1, size = 10, nei = 2, p = 0.1) + Output + IGRAPH U--- 10 20 -- + + edges: + [1] 1-- 2 2-- 6 2-- 3 4-- 5 5-- 6 6-- 7 7-- 8 8-- 9 9--10 1--10 1-- 8 1-- 9 + [13] 2--10 2-- 4 3-- 5 4-- 6 5-- 7 6-- 8 7-- 9 8--10 + +# distances_impl basic + + Code + distances_impl(graph = g, from = V(g), to = V(g), mode = c("out", "in", "all", + "total")) + Output + [,1] [,2] [,3] [,4] [,5] + [1,] 0 1 2 2 1 + [2,] 1 0 1 2 2 + [3,] 2 1 0 1 2 + [4,] 2 2 1 0 1 + [5,] 1 2 2 1 0 + +# diameter_impl basic + + Code + diameter_impl(graph = g, directed = FALSE, unconnected = TRUE) + Output + $res + [1] 5 + + $from + [1] 0 + + $to + [1] 5 + + $vertex_path + [1] 0 1 2 3 4 5 + + $edge_path + [1] 0 1 2 3 4 + + +# get_shortest_paths_impl basic + + Code + get_shortest_paths_impl(graph = g, from = 1, to = 3, mode = c("out", "in", + "all", "total")) + Output + $vertices + $vertices[[1]] + + 3/5 vertices: + [1] 1 2 3 + + + $edges + $edges[[1]] + + 2/5 edges: + [1] 1--2 2--3 + + + $parents + [1] -1 0 1 -2 0 + + $inbound_edges + [1] -1 0 1 -1 4 + + +# subcomponent_impl basic + + Code + subcomponent_impl(graph = g, v = 1, mode = c("all", "out", "in")) + Output + + 3/6 vertices, named: + [1] A B C + +# betweenness_impl basic + + Code + betweenness_impl(graph = g, vids = V(g), directed = FALSE) + Output + [1] 6 0 0 0 0 + +# harmonic_centrality_impl basic + + Code + harmonic_centrality_impl(graph = g, vids = V(g), mode = c("out", "in", "all", + "total")) + Output + [1] 4.0 2.5 2.5 2.5 2.5 + +# pagerank_impl basic + + Code + pagerank_impl(graph = g, vids = V(g), directed = TRUE, damping = 0.85) + Output + $vector + [1] 0.2 0.2 0.2 0.2 0.2 + + $value + [1] 1 + + $options + NULL + + +# hub_score_impl basic + + Code + hub_score_impl(graph = g, scale = TRUE, weights = NULL) + Output + $vector + [1] 1 0 0 0 0 + + $value + [1] 4 + + $options + $options$bmat + [1] "I" + + $options$n + [1] 5 + + $options$which + [1] "LA" + + $options$nev + [1] 1 + + $options$tol + [1] 0 + + $options$ncv + [1] 0 + + $options$ldv + [1] 0 + + $options$ishift + [1] 1 + + $options$maxiter + [1] 3000 + + $options$nb + [1] 1 + + $options$mode + [1] 1 + + $options$start + [1] 1 + + $options$sigma + [1] 0 + + $options$sigmai + [1] 0 + + $options$info + [1] 0 + + $options$iter + [1] 1 + + $options$nconv + [1] 1 + + $options$numop + [1] 4 + + $options$numopb + [1] 0 + + $options$numreo + [1] 4 + + + +# authority_score_impl basic + + Code + authority_score_impl(graph = g, scale = TRUE, weights = NULL) + Output + $vector + [1] 0 1 1 1 1 + + $value + [1] 4 + + $options + $options$bmat + [1] "I" + + $options$n + [1] 5 + + $options$which + [1] "LA" + + $options$nev + [1] 1 + + $options$tol + [1] 0 + + $options$ncv + [1] 0 + + $options$ldv + [1] 0 + + $options$ishift + [1] 1 + + $options$maxiter + [1] 3000 + + $options$nb + [1] 1 + + $options$mode + [1] 1 + + $options$start + [1] 1 + + $options$sigma + [1] 0 + + $options$sigmai + [1] 0 + + $options$info + [1] 0 + + $options$iter + [1] 1 + + $options$nconv + [1] 1 + + $options$numop + [1] 4 + + $options$numopb + [1] 0 + + $options$numreo + [1] 4 + + + +# community_walktrap_impl basic + + Code + community_walktrap_impl(graph = g, steps = 4) + Output + $merges + [,1] [,2] + [1,] 4 5 + [2,] 1 2 + [3,] 3 6 + [4,] 0 7 + [5,] 8 9 + + $modularity + [1] -0.17346939 -0.07142857 0.03061224 0.19387755 0.35714286 0.00000000 + + $membership + [1] 0 0 0 1 1 1 + + +# community_fastgreedy_impl basic + + Code + community_fastgreedy_impl(graph = g) + Output + $merges + [,1] [,2] + [1,] 2 1 + [2,] 0 6 + [3,] 5 4 + [4,] 3 8 + [5,] 9 7 + + $modularity + [1] -1.734694e-01 -7.142857e-02 9.183673e-02 1.938776e-01 3.571429e-01 + [6] 5.551115e-17 + + $membership + [1] 1 1 1 0 0 0 + + +# community_edge_betweenness_impl basic + + Code + community_edge_betweenness_impl(graph = g, directed = FALSE) + Output + $removed_edges + [1] 2 0 1 3 4 5 6 + + $edge_betweenness + [1] 9 1 2 1 1 2 1 + + $merges + [,1] [,2] + [1,] 5 4 + [2,] 6 3 + [3,] 2 1 + [4,] 8 0 + [5,] 7 9 + + $bridges + [1] 7 6 4 3 1 + + $modularity + [1] -0.17346939 -0.07142857 0.09183673 0.19387755 0.35714286 0.00000000 + + $membership + [1] 0 0 0 1 1 1 + + +# edge_connectivity_impl basic + + Code + edge_connectivity_impl(graph = g) + Output + [1] 2 + +# vertex_connectivity_impl basic + + Code + vertex_connectivity_impl(graph = g) + Output + [1] 2 + +# create_bipartite_impl basic + + Code + create_bipartite_impl(types = c(FALSE, FALSE, TRUE, TRUE), edges = c(0, 2, 0, 3, + 1, 2, 1, 3), directed = FALSE) + Output + IGRAPH U--- 4 4 -- + + edges: + [1] 1--3 1--4 2--3 2--4 + +# decompose_impl basic + + Code + decompose_impl(graph = g, mode = c("weak", "strong")) + Output + [[1]] + IGRAPH UN-- 3 2 -- + + attr: name (v/c) + + edges (vertex names): + [1] A--B B--C + + [[2]] + IGRAPH UN-- 2 1 -- + + attr: name (v/c) + + edge (vertex names): + [1] D--E + + +# neighborhood_impl basic + + Code + neighborhood_impl(graph = g, order = 1, vids = V(g), mode = c("all", "out", + "in")) + Output + [[1]] + + 3/5 vertices: + [1] 1 2 5 + + [[2]] + + 3/5 vertices: + [1] 2 1 3 + + [[3]] + + 3/5 vertices: + [1] 3 2 4 + + [[4]] + + 3/5 vertices: + [1] 4 3 5 + + [[5]] + + 3/5 vertices: + [1] 5 1 4 + + +# neighborhood_size_impl basic + + Code + neighborhood_size_impl(graph = g, order = 1, vids = V(g), mode = c("all", "out", + "in")) + Output + [1] 3 3 3 3 3 + +# get_adjacency_impl basic + + Code + get_adjacency_impl(graph = g, type = c("both", "upper", "lower")) + Output + [,1] [,2] [,3] + [1,] 0 1 1 + [2,] 1 0 1 + [3,] 1 1 0 + +# write_graph_edgelist_impl basic + + Code + content + Output + [1] "0 1" "0 2" "1 2" + +# read_graph_edgelist_impl basic + + Code + read_graph_edgelist_impl(instream = tmp, n = 3, directed = FALSE) + Output + IGRAPH U--- 3 3 -- + + edges: + [1] 1--2 2--3 1--3 + +# connect_neighborhood_impl basic + + Code + connect_neighborhood_impl(graph = g, order = 1, mode = c("all", "out", "in")) + Condition + Warning in `connect_neighborhood_impl()`: + At vendor/cigraph/src/operators/connect_neighborhood.c:85 : Order smaller than two, graph will be unchanged. + Output + IGRAPH U--- 5 5 -- Ring graph + + attr: name (g/c), mutual (g/l), circular (g/l) + + edges: + [1] 1--2 2--3 3--4 4--5 1--5 + +# eccentricity_impl basic + + Code + eccentricity_impl(graph = g, vids = V(g), mode = c("out", "in", "all")) + Output + [1] 2 2 2 2 2 + +# radius_impl basic + + Code + radius_impl(graph = g, mode = c("out", "in", "all")) + Output + [1] 2 + +# graph_center_impl basic + + Code + graph_center_impl(graph = g, mode = c("out", "in", "all")) + Output + + 1/5 vertex: + [1] 1 + +# maximal_cliques_impl basic + + Code + maximal_cliques_impl(graph = g, min_size = 1, max_size = 0) + Output + [[1]] + + 4/4 vertices: + [1] 1 2 4 3 + + +# independent_vertex_sets_impl basic + + Code + independent_vertex_sets_impl(graph = g, min_size = 1, max_size = 0) + Output + [[1]] + + 1/5 vertex: + [1] 1 + + [[2]] + + 1/5 vertex: + [1] 2 + + [[3]] + + 1/5 vertex: + [1] 3 + + [[4]] + + 1/5 vertex: + [1] 4 + + [[5]] + + 1/5 vertex: + [1] 5 + + [[6]] + + 2/5 vertices: + [1] 1 3 + + [[7]] + + 2/5 vertices: + [1] 1 4 + + [[8]] + + 2/5 vertices: + [1] 2 4 + + [[9]] + + 2/5 vertices: + [1] 2 5 + + [[10]] + + 2/5 vertices: + [1] 3 5 + + diff --git a/tests/testthat/test-aaa-auto.R b/tests/testthat/test-aaa-auto.R index 36bc87bc7a..e51e96372b 100644 --- a/tests/testthat/test-aaa-auto.R +++ b/tests/testthat/test-aaa-auto.R @@ -10620,914 +10620,353 @@ test_that("intersection_impl errors", { }) -# Tests for newly autogenerated _impl functions -# add_edge_impl -test_that("add_edge_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for add_edge_impl") -}) - -# adjacency_impl -test_that("adjacency_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for adjacency_impl") -}) - -# almost_equals_impl -test_that("almost_equals_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for almost_equals_impl") -}) - -# are_connected_impl -test_that("are_connected_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for are_connected_impl") -}) - -# authority_score_impl -test_that("authority_score_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for authority_score_impl") -}) - -# average_path_length_impl -test_that("average_path_length_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for average_path_length_impl") -}) - -# barabasi_aging_game_impl -test_that("barabasi_aging_game_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for barabasi_aging_game_impl") -}) - -# barabasi_game_impl -test_that("barabasi_game_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for barabasi_game_impl") -}) - -# betweenness_cutoff_impl -test_that("betweenness_cutoff_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for betweenness_cutoff_impl") -}) - -# betweenness_impl -test_that("betweenness_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for betweenness_impl") -}) - -# betweenness_subset_impl -test_that("betweenness_subset_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for betweenness_subset_impl") -}) - -# bfs_impl -test_that("bfs_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for bfs_impl") -}) - -# bipartite_game_impl -test_that("bipartite_game_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for bipartite_game_impl") -}) - -# bipartite_projection_impl -test_that("bipartite_projection_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for bipartite_projection_impl") -}) - -# callaway_traits_game_impl -test_that("callaway_traits_game_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for callaway_traits_game_impl") -}) - -# cited_type_game_impl -test_that("cited_type_game_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for cited_type_game_impl") -}) - -# citing_cited_type_game_impl -test_that("citing_cited_type_game_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for citing_cited_type_game_impl") -}) - -# closeness_impl -test_that("closeness_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for closeness_impl") -}) - -# cmp_epsilon_impl -test_that("cmp_epsilon_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for cmp_epsilon_impl") -}) - -# community_eb_get_merges_impl -test_that("community_eb_get_merges_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for community_eb_get_merges_impl") -}) - -# community_edge_betweenness_impl -test_that("community_edge_betweenness_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for community_edge_betweenness_impl") -}) - -# community_fastgreedy_impl -test_that("community_fastgreedy_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for community_fastgreedy_impl") -}) - -# community_spinglass_impl -test_that("community_spinglass_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for community_spinglass_impl") -}) - -# community_spinglass_single_impl -test_that("community_spinglass_single_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for community_spinglass_single_impl") -}) -# community_to_membership_impl -test_that("community_to_membership_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for community_to_membership_impl") -}) - -# community_walktrap_impl -test_that("community_walktrap_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for community_walktrap_impl") -}) - -# compare_communities_impl -test_that("compare_communities_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for compare_communities_impl") -}) - -# connect_neighborhood_impl -test_that("connect_neighborhood_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for connect_neighborhood_impl") -}) - -# convergence_degree_impl -test_that("convergence_degree_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for convergence_degree_impl") -}) - -# create_bipartite_impl -test_that("create_bipartite_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for create_bipartite_impl") -}) -# create_impl -test_that("create_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for create_impl") -}) - -# decompose_impl -test_that("decompose_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for decompose_impl") -}) - -# degree_sequence_game_impl -test_that("degree_sequence_game_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for degree_sequence_game_impl") -}) - -# dfs_impl -test_that("dfs_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for dfs_impl") -}) - -# diameter_dijkstra_impl -test_that("diameter_dijkstra_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for diameter_dijkstra_impl") -}) - -# diameter_impl -test_that("diameter_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for diameter_impl") -}) - -# distances_bellman_ford_impl -test_that("distances_bellman_ford_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for distances_bellman_ford_impl") -}) - -# distances_cutoff_impl -test_that("distances_cutoff_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for distances_cutoff_impl") -}) - -# distances_dijkstra_cutoff_impl -test_that("distances_dijkstra_cutoff_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for distances_dijkstra_cutoff_impl") -}) - -# distances_dijkstra_impl -test_that("distances_dijkstra_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for distances_dijkstra_impl") -}) - -# distances_floyd_warshall_impl -test_that("distances_floyd_warshall_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for distances_floyd_warshall_impl") -}) - -# distances_impl -test_that("distances_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for distances_impl") -}) - -# distances_johnson_impl -test_that("distances_johnson_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for distances_johnson_impl") -}) - -# eccentricity_impl -test_that("eccentricity_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for eccentricity_impl") -}) - -# edge_betweenness_impl -test_that("edge_betweenness_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for edge_betweenness_impl") -}) - -# edge_connectivity_impl -test_that("edge_connectivity_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for edge_connectivity_impl") -}) - -# edge_disjoint_paths_impl -test_that("edge_disjoint_paths_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for edge_disjoint_paths_impl") -}) - -# edge_impl -test_that("edge_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for edge_impl") -}) - -# eigen_matrix_impl -test_that("eigen_matrix_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for eigen_matrix_impl") -}) - -# eigen_matrix_symmetric_impl -test_that("eigen_matrix_symmetric_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for eigen_matrix_symmetric_impl") -}) +# Tests for newly autogenerated _impl functions -# empty_attrs_impl -test_that("empty_attrs_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for empty_attrs_impl") -}) +# Graph constructors -# establishment_game_impl -test_that("establishment_game_impl basic", { +test_that("star_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for establishment_game_impl") + # star_impl needs STAR_MODE type constants - skipping for now + skip("star_impl requires STAR_MODE constants") }) -# expand_path_to_pairs_impl -test_that("expand_path_to_pairs_impl basic", { +test_that("ring_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for expand_path_to_pairs_impl") + expect_snapshot(ring_impl(n = 5, directed = FALSE, mutual = FALSE, circular = TRUE)) + expect_snapshot(ring_impl(n = 4, directed = TRUE, mutual = FALSE, circular = FALSE)) }) -# full_impl test_that("full_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for full_impl") + expect_snapshot(full_impl(n = 4, directed = FALSE, loops = FALSE)) + expect_snapshot(full_impl(n = 3, directed = TRUE, loops = FALSE)) }) -# get_adjacency_impl -test_that("get_adjacency_impl basic", { +test_that("kary_tree_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for get_adjacency_impl") + expect_snapshot(kary_tree_impl(n = 7, children = 2, type = c("out", "in", "undirected"))) + expect_snapshot(kary_tree_impl(n = 10, children = 3, type = c("in", "out", "undirected"))) }) -# get_all_shortest_paths_dijkstra_impl -test_that("get_all_shortest_paths_dijkstra_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for get_all_shortest_paths_dijkstra_impl") -}) +# Random graph generators -# get_all_shortest_paths_impl -test_that("get_all_shortest_paths_impl basic", { +test_that("barabasi_game_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for get_all_shortest_paths_impl") + # barabasi_game_impl needs BARABASI_ALGORITHM constants - skipping for now + skip("barabasi_game_impl requires BARABASI_ALGORITHM constants") }) -# get_all_simple_paths_impl -test_that("get_all_simple_paths_impl basic", { +test_that("growing_random_game_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for get_all_simple_paths_impl") + expect_snapshot(growing_random_game_impl(n = 10, m = 1, directed = TRUE, citation = FALSE)) }) -# get_eids_impl -test_that("get_eids_impl basic", { +test_that("grg_game_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for get_eids_impl") + expect_snapshot(grg_game_impl(nodes = 10, radius = 0.3, torus = FALSE)) }) -# get_k_shortest_paths_impl -test_that("get_k_shortest_paths_impl basic", { +test_that("watts_strogatz_game_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for get_k_shortest_paths_impl") + expect_snapshot(watts_strogatz_game_impl(dim = 1, size = 10, nei = 2, p = 0.1)) }) -# get_shortest_path_astar_impl -test_that("get_shortest_path_astar_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for get_shortest_path_astar_impl") -}) +# Distance and path functions -# get_shortest_paths_bellman_ford_impl -test_that("get_shortest_paths_bellman_ford_impl basic", { +test_that("distances_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for get_shortest_paths_bellman_ford_impl") + g <- make_ring(5) + expect_snapshot(distances_impl(graph = g, from = V(g), to = V(g), mode = c("out", "in", "all", "total"))) }) -# get_shortest_paths_dijkstra_impl -test_that("get_shortest_paths_dijkstra_impl basic", { +test_that("diameter_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for get_shortest_paths_dijkstra_impl") + g <- make_ring(10) + expect_snapshot(diameter_impl(graph = g, directed = FALSE, unconnected = TRUE)) }) -# get_shortest_paths_impl test_that("get_shortest_paths_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for get_shortest_paths_impl") -}) - -# get_widest_path_impl -test_that("get_widest_path_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for get_widest_path_impl") + g <- make_ring(5) + expect_snapshot(get_shortest_paths_impl(graph = g, from = 1, to = 3, mode = c("out", "in", "all", "total"))) }) -# get_widest_paths_impl -test_that("get_widest_paths_impl basic", { +test_that("subcomponent_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for get_widest_paths_impl") + g <- make_graph(~ A-B-C, D-E-F) + expect_snapshot(subcomponent_impl(graph = g, v = 1, mode = c("all", "out", "in"))) }) -# graph_center_impl -test_that("graph_center_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for graph_center_impl") -}) +# Centrality measures -# grg_game_impl -test_that("grg_game_impl basic", { +test_that("betweenness_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for grg_game_impl") + g <- make_star(5, mode = "undirected") + expect_snapshot(betweenness_impl(graph = g, vids = V(g), directed = FALSE)) }) -# growing_random_game_impl -test_that("growing_random_game_impl basic", { +test_that("closeness_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for growing_random_game_impl") + g <- make_ring(5) + expect_snapshot(closeness_impl(graph = g, vids = V(g), mode = c("out", "in", "all", "total"))) }) -# harmonic_centrality_impl test_that("harmonic_centrality_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for harmonic_centrality_impl") + g <- make_star(5, mode = "undirected") + expect_snapshot(harmonic_centrality_impl(graph = g, vids = V(g), mode = c("out", "in", "all", "total"))) }) -# has_attribute_table_impl -test_that("has_attribute_table_impl basic", { +test_that("pagerank_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for has_attribute_table_impl") + g <- make_ring(5, directed = TRUE) + expect_snapshot(pagerank_impl(graph = g, vids = V(g), directed = TRUE, damping = 0.85)) }) -# hub_score_impl test_that("hub_score_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for hub_score_impl") + g <- make_star(5, mode = "undirected") + expect_snapshot(hub_score_impl(graph = g, scale = TRUE, weights = NULL)) }) -# independent_vertex_sets_impl -test_that("independent_vertex_sets_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for independent_vertex_sets_impl") -}) - -# is_bigraphical_impl -test_that("is_bigraphical_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for is_bigraphical_impl") -}) - -# is_chordal_impl -test_that("is_chordal_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for is_chordal_impl") -}) - -# is_same_graph_impl -test_that("is_same_graph_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for is_same_graph_impl") -}) - -# kary_tree_impl -test_that("kary_tree_impl basic", { +test_that("authority_score_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for kary_tree_impl") + g <- make_star(5, mode = "undirected") + expect_snapshot(authority_score_impl(graph = g, scale = TRUE, weights = NULL)) }) -# lastcit_game_impl -test_that("lastcit_game_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for lastcit_game_impl") -}) +# Community detection -# layout_drl_impl -test_that("layout_drl_impl basic", { +test_that("community_walktrap_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for layout_drl_impl") + g <- make_graph(~ A-B-C-A, D-E-F-D, A-D) + expect_snapshot(community_walktrap_impl(graph = g, steps = 4)) }) -# layout_fruchterman_reingold_impl -test_that("layout_fruchterman_reingold_impl basic", { +test_that("community_fastgreedy_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for layout_fruchterman_reingold_impl") + g <- make_graph(~ A-B-C-A, D-E-F-D, A-D) + expect_snapshot(community_fastgreedy_impl(graph = g)) }) -# layout_graphopt_impl -test_that("layout_graphopt_impl basic", { +test_that("community_edge_betweenness_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for layout_graphopt_impl") + g <- make_graph(~ A-B-C-A, D-E-F-D, A-D) + expect_snapshot(community_edge_betweenness_impl(graph = g, directed = FALSE)) }) -# layout_kamada_kawai_impl -test_that("layout_kamada_kawai_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for layout_kamada_kawai_impl") -}) +# Connectivity -# layout_lgl_impl -test_that("layout_lgl_impl basic", { +test_that("edge_connectivity_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for layout_lgl_impl") + g <- make_ring(5) + expect_snapshot(edge_connectivity_impl(graph = g)) }) -# layout_reingold_tilford_circular_impl -test_that("layout_reingold_tilford_circular_impl basic", { +test_that("vertex_connectivity_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for layout_reingold_tilford_circular_impl") + g <- make_ring(5) + expect_snapshot(vertex_connectivity_impl(graph = g)) }) -# layout_reingold_tilford_impl -test_that("layout_reingold_tilford_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for layout_reingold_tilford_impl") -}) +# Layout functions -# layout_sphere_impl test_that("layout_sphere_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for layout_sphere_impl") -}) - -# le_community_to_membership_impl -test_that("le_community_to_membership_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for le_community_to_membership_impl") -}) - -# maxflow_value_impl -test_that("maxflow_value_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for maxflow_value_impl") + g <- make_ring(5) + expect_snapshot(layout_sphere_impl(graph = g)) }) -# maximal_cliques_file_impl -test_that("maximal_cliques_file_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for maximal_cliques_file_impl") -}) +# Bipartite functions -# maximal_cliques_impl -test_that("maximal_cliques_impl basic", { +test_that("create_bipartite_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for maximal_cliques_impl") + expect_snapshot(create_bipartite_impl(types = c(FALSE, FALSE, TRUE, TRUE), edges = c(0, 2, 0, 3, 1, 2, 1, 3), directed = FALSE)) }) -# maximal_cliques_subset_impl -test_that("maximal_cliques_subset_impl basic", { +test_that("bipartite_game_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for maximal_cliques_subset_impl") + # bipartite_game_impl needs ERDOS_RENYI_TYPE constants - skipping for now + skip("bipartite_game_impl requires ERDOS_RENYI_TYPE constants") }) -# minimum_spanning_tree_impl -test_that("minimum_spanning_tree_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for minimum_spanning_tree_impl") -}) +# Other structural functions -# neighborhood_graphs_impl -test_that("neighborhood_graphs_impl basic", { +test_that("decompose_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for neighborhood_graphs_impl") + g <- make_graph(~ A-B-C, D-E) + expect_snapshot(decompose_impl(graph = g, mode = c("weak", "strong"))) }) -# neighborhood_impl test_that("neighborhood_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for neighborhood_impl") + g <- make_ring(5) + expect_snapshot(neighborhood_impl(graph = g, order = 1, vids = V(g), mode = c("all", "out", "in"))) }) -# neighborhood_size_impl test_that("neighborhood_size_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for neighborhood_size_impl") -}) - -# pagerank_impl -test_that("pagerank_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for pagerank_impl") -}) - -# progress_impl -test_that("progress_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for progress_impl") + g <- make_ring(5) + expect_snapshot(neighborhood_size_impl(graph = g, order = 1, vids = V(g), mode = c("all", "out", "in"))) }) -# radius_impl -test_that("radius_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for radius_impl") -}) +# Graph properties -# random_edge_walk_impl -test_that("random_edge_walk_impl basic", { +test_that("is_chordal_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for random_edge_walk_impl") + g <- make_ring(4) + # is_chordal requires additional parameters, skip for now + skip("is_chordal_impl requires alpha and alpham1 parameters") }) -# random_sample_impl -test_that("random_sample_impl basic", { +test_that("get_adjacency_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for random_sample_impl") + g <- make_ring(3) + expect_snapshot(get_adjacency_impl(graph = g, type = c("both", "upper", "lower"))) }) -# read_graph_dimacs_flow_impl -test_that("read_graph_dimacs_flow_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for read_graph_dimacs_flow_impl") -}) +# IO functions -# read_graph_dl_impl -test_that("read_graph_dl_impl basic", { +test_that("write_graph_edgelist_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for read_graph_dl_impl") + g <- make_ring(3) + tmp <- tempfile() + write_graph_edgelist_impl(graph = g, outstream = tmp) + content <- readLines(tmp) + unlink(tmp) + expect_snapshot(content) }) -# read_graph_edgelist_impl test_that("read_graph_edgelist_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for read_graph_edgelist_impl") -}) - -# read_graph_lgl_impl -test_that("read_graph_lgl_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for read_graph_lgl_impl") -}) - -# read_graph_ncol_impl -test_that("read_graph_ncol_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for read_graph_ncol_impl") -}) - -# recent_degree_aging_game_impl -test_that("recent_degree_aging_game_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for recent_degree_aging_game_impl") -}) - -# recent_degree_game_impl -test_that("recent_degree_game_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for recent_degree_game_impl") -}) - -# reindex_membership_impl -test_that("reindex_membership_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for reindex_membership_impl") -}) - -# ring_impl -test_that("ring_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for ring_impl") -}) - -# similarity_jaccard_es_impl -test_that("similarity_jaccard_es_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for similarity_jaccard_es_impl") + tmp <- tempfile() + writeLines(c("0 1", "1 2", "2 0"), tmp) + expect_snapshot(read_graph_edgelist_impl(instream = tmp, n = 3, directed = FALSE)) + unlink(tmp) }) -# similarity_jaccard_pairs_impl -test_that("similarity_jaccard_pairs_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for similarity_jaccard_pairs_impl") -}) - -# spanner_impl -test_that("spanner_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for spanner_impl") -}) - -# st_edge_connectivity_impl -test_that("st_edge_connectivity_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for st_edge_connectivity_impl") -}) +# Utility functions -# st_mincut_value_impl -test_that("st_mincut_value_impl basic", { +test_that("compare_communities_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for st_mincut_value_impl") + comm1 <- c(1, 1, 2, 2, 3, 3) + comm2 <- c(1, 1, 2, 2, 2, 3) + expect_snapshot(compare_communities_impl(comm1 = comm1, comm2 = comm2, method = "vi")) }) -# st_vertex_connectivity_impl -test_that("st_vertex_connectivity_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for st_vertex_connectivity_impl") -}) +# Additional game functions -# star_impl -test_that("star_impl basic", { +test_that("degree_sequence_game_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for star_impl") + # degree_sequence_game_impl needs DEGSEQ_MODE constants - skipping for now + skip("degree_sequence_game_impl requires DEGSEQ_MODE constants") }) -# status_impl -test_that("status_impl basic", { +test_that("connect_neighborhood_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for status_impl") + g <- make_ring(5) + expect_snapshot(connect_neighborhood_impl(graph = g, order = 1, mode = c("all", "out", "in"))) }) -# strerror_impl -test_that("strerror_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for strerror_impl") -}) +# Additional distance functions -# subcomponent_impl -test_that("subcomponent_impl basic", { +test_that("eccentricity_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for subcomponent_impl") + g <- make_ring(5) + expect_snapshot(eccentricity_impl(graph = g, vids = V(g), mode = c("out", "in", "all"))) }) -# vertex_connectivity_impl -test_that("vertex_connectivity_impl basic", { +test_that("radius_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for vertex_connectivity_impl") + g <- make_ring(5) + expect_snapshot(radius_impl(graph = g, mode = c("out", "in", "all"))) }) -# vertex_disjoint_paths_impl -test_that("vertex_disjoint_paths_impl basic", { +test_that("graph_center_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for vertex_disjoint_paths_impl") + g <- make_star(5, mode = "undirected") + expect_snapshot(graph_center_impl(graph = g, mode = c("out", "in", "all"))) }) -# voronoi_impl test_that("voronoi_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for voronoi_impl") + g <- make_ring(10) + expect_snapshot(voronoi_impl(graph = g, generators = c(1, 5), mode = c("out", "in", "all"))) }) -# watts_strogatz_game_impl -test_that("watts_strogatz_game_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for watts_strogatz_game_impl") -}) - -# weighted_adjacency_impl -test_that("weighted_adjacency_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for weighted_adjacency_impl") -}) +# Spanner -# widest_path_widths_dijkstra_impl -test_that("widest_path_widths_dijkstra_impl basic", { +test_that("spanner_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for widest_path_widths_dijkstra_impl") + g <- make_ring(5) + expect_snapshot(spanner_impl(graph = g, stretch = 2)) }) -# widest_path_widths_floyd_warshall_impl -test_that("widest_path_widths_floyd_warshall_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for widest_path_widths_floyd_warshall_impl") -}) +# Additional centrality -# write_graph_dimacs_flow_impl -test_that("write_graph_dimacs_flow_impl basic", { +test_that("edge_betweenness_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for write_graph_dimacs_flow_impl") + g <- make_star(5, mode = "undirected") + expect_snapshot(edge_betweenness_impl(graph = g, directed = FALSE)) }) -# write_graph_edgelist_impl -test_that("write_graph_edgelist_impl basic", { - withr::local_seed(20250909) - local_igraph_options(print.id = FALSE) - skip("TODO: Add test for write_graph_edgelist_impl") -}) +# Maximal cliques -# write_graph_lgl_impl -test_that("write_graph_lgl_impl basic", { +test_that("maximal_cliques_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for write_graph_lgl_impl") + g <- make_full_graph(4) + expect_snapshot(maximal_cliques_impl(graph = g, min_size = 1, max_size = 0)) }) -# write_graph_ncol_impl -test_that("write_graph_ncol_impl basic", { +test_that("independent_vertex_sets_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - skip("TODO: Add test for write_graph_ncol_impl") + g <- make_ring(5) + expect_snapshot(independent_vertex_sets_impl(graph = g, min_size = 1, max_size = 0)) }) From d96c9401dafcc0bd204168391bb50f52b14aea31 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 5 Nov 2025 00:27:36 +0000 Subject: [PATCH 06/10] feat: add enum type translations for STAR_MODE, BARABASI_ALGORITHM, ERDOS_RENYI_TYPE, DEGSEQ_MODE - Added STAR_MODE enum type to types-RR.yaml with mappings for out/in/undirected/mutual - Added BARABASI_ALGORITHM enum type with mappings for bag/psumtree/psumtree_multiple - Added ERDOS_RENYI_TYPE enum type with mappings for gnp/gnm - Added DEGSEQ_MODE enum type with mappings for configuration/vl/fast_heur_simple/configuration_simple/edge_switching_simple - Regenerated R/aaa-auto.R with proper enum type handling - Unskipped and implemented tests for star_impl, barabasi_game_impl, bipartite_game_impl, degree_sequence_game_impl - All 4 previously skipped tests now have comprehensive snapshot tests - is_chordal_impl remains skipped due to bug with optional INDEX_VECTOR parameters - All tests pass: 1217 passing, 1 skipped Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com> --- R/aaa-auto.R | 23 +++++++- tests/testthat/_snaps/aaa-auto.md | 93 +++++++++++++++++++++++++++++++ tests/testthat/test-aaa-auto.R | 24 ++++---- tools/stimulus/types-RR.yaml | 30 ++++++++++ 4 files changed, 156 insertions(+), 14 deletions(-) diff --git a/R/aaa-auto.R b/R/aaa-auto.R index 06dd8f8e01..b706e16d20 100644 --- a/R/aaa-auto.R +++ b/R/aaa-auto.R @@ -490,11 +490,18 @@ weighted_adjacency_impl <- function( star_impl <- function( n, - mode = OUT, + mode = c("out", "in", "undirected", "mutual"), center = 0 ) { # Argument checks n <- as.numeric(n) + mode <- switch_igraph_arg( + mode, + "out" = 0L, + "in" = 1L, + "undirected" = 2L, + "mutual" = 3L + ) center <- as.numeric(center) on.exit(.Call(R_igraph_finalizer)) @@ -1238,7 +1245,7 @@ barabasi_game_impl <- function( outpref = FALSE, A = 1.0, directed = TRUE, - algo = BAG, + algo = c("bag", "psumtree", "psumtree_multiple"), start_from = NULL ) { # Argument checks @@ -1251,6 +1258,7 @@ barabasi_game_impl <- function( outpref <- as.logical(outpref) A <- as.numeric(A) directed <- as.logical(directed) + algo <- switch_igraph_arg(algo, "bag" = 0L, "psumtree" = 1L, "psumtree_multiple" = 2L) if (!is.null(start_from)) { ensure_igraph(start_from) } @@ -1326,13 +1334,21 @@ erdos_renyi_game_gnm_impl <- function( degree_sequence_game_impl <- function( out_deg, in_deg = NULL, - method = CONFIGURATION + method = c("configuration", "fast_heur_simple", "configuration_simple", "edge_switching_simple", "vl") ) { # Argument checks out_deg <- as.numeric(out_deg) if (!is.null(in_deg)) { in_deg <- as.numeric(in_deg) } + method <- switch_igraph_arg( + method, + "configuration" = 0L, + "vl" = 1L, + "fast_heur_simple" = 2L, + "configuration_simple" = 3L, + "edge_switching_simple" = 4L + ) on.exit(.Call(R_igraph_finalizer)) # Function call @@ -6724,6 +6740,7 @@ bipartite_game_impl <- function( mode = c("all", "out", "in", "total") ) { # Argument checks + type <- switch_igraph_arg(type, "gnp" = 0L, "gnm" = 1L) n1 <- as.numeric(n1) n2 <- as.numeric(n2) p <- as.numeric(p) diff --git a/tests/testthat/_snaps/aaa-auto.md b/tests/testthat/_snaps/aaa-auto.md index 9ed99b8df8..ebc98e4a9c 100644 --- a/tests/testthat/_snaps/aaa-auto.md +++ b/tests/testthat/_snaps/aaa-auto.md @@ -10496,6 +10496,33 @@ Error in `ensure_igraph()`: ! Must provide a graph object (provided `NULL`). +# star_impl basic + + Code + star_impl(n = 5, mode = "out", center = 0) + Output + IGRAPH D--- 5 4 -- + + edges: + [1] 1->2 1->3 1->4 1->5 + +--- + + Code + star_impl(n = 6, mode = "in", center = 1) + Output + IGRAPH D--- 6 5 -- + + edges: + [1] 1->2 3->2 4->2 5->2 6->2 + +--- + + Code + star_impl(n = 4, mode = "undirected", center = 0) + Output + IGRAPH U--- 4 3 -- + + edges: + [1] 1--2 1--3 1--4 + # ring_impl basic Code @@ -10550,6 +10577,26 @@ + edges: [1] 2->1 3->1 4->1 5->2 6->2 7->2 8->3 9->3 10->3 +# barabasi_game_impl basic + + Code + barabasi_game_impl(n = 10, power = 1, m = 2, directed = FALSE, algo = "bag") + Output + IGRAPH U--- 10 18 -- + + edges: + [1] 1-- 2 1-- 2 2-- 3 1-- 3 2-- 4 2-- 4 2-- 5 2-- 5 4-- 6 2-- 6 2-- 7 1-- 7 + [13] 3-- 8 2-- 8 8-- 9 5-- 9 6--10 5--10 + +--- + + Code + barabasi_game_impl(n = 10, power = 1, m = 2, directed = FALSE, algo = "psumtree") + Output + IGRAPH U--- 10 17 -- + + edges: + [1] 1-- 2 1-- 3 2-- 3 1-- 4 2-- 4 2-- 5 4-- 5 1-- 6 3-- 6 6-- 7 3-- 7 6-- 8 + [13] 2-- 8 3-- 9 5-- 9 2--10 6--10 + # grg_game_impl basic Code @@ -10918,6 +10965,34 @@ + edges: [1] 1--3 1--4 2--3 2--4 +# bipartite_game_impl basic + + Code + bipartite_game_impl(type = "gnp", n1 = 5, n2 = 5, p = 0.3, directed = FALSE) + Output + $graph + IGRAPH U--- 10 10 -- + + edges: + [1] 1-- 6 2-- 6 4-- 6 5-- 6 1-- 7 4-- 7 4-- 8 3-- 9 3--10 4--10 + + $types + [1] FALSE FALSE FALSE FALSE FALSE TRUE TRUE TRUE TRUE TRUE + + +--- + + Code + bipartite_game_impl(type = "gnm", n1 = 5, n2 = 5, m = 10, directed = FALSE) + Output + $graph + IGRAPH U--- 10 10 -- + + edges: + [1] 1-- 6 3-- 7 5-- 7 1-- 8 3-- 8 4-- 8 2-- 9 5-- 9 2--10 3--10 + + $types + [1] FALSE FALSE FALSE FALSE FALSE TRUE TRUE TRUE TRUE TRUE + + # decompose_impl basic Code @@ -10997,6 +11072,24 @@ + edges: [1] 1--2 2--3 1--3 +# degree_sequence_game_impl basic + + Code + degree_sequence_game_impl(out_deg = c(2, 2, 2, 2), method = "configuration") + Output + IGRAPH U--- 4 4 -- + + edges: + [1] 2--4 3--3 1--4 1--2 + +--- + + Code + degree_sequence_game_impl(out_deg = c(2, 2, 2, 2), method = "vl") + Output + IGRAPH U--- 4 4 -- + + edges: + [1] 1--2 1--4 2--3 3--4 + # connect_neighborhood_impl basic Code diff --git a/tests/testthat/test-aaa-auto.R b/tests/testthat/test-aaa-auto.R index e51e96372b..1333ad06b9 100644 --- a/tests/testthat/test-aaa-auto.R +++ b/tests/testthat/test-aaa-auto.R @@ -10629,8 +10629,9 @@ test_that("intersection_impl errors", { test_that("star_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - # star_impl needs STAR_MODE type constants - skipping for now - skip("star_impl requires STAR_MODE constants") + expect_snapshot(star_impl(n = 5, mode = "out", center = 0)) + expect_snapshot(star_impl(n = 6, mode = "in", center = 1)) + expect_snapshot(star_impl(n = 4, mode = "undirected", center = 0)) }) test_that("ring_impl basic", { @@ -10659,8 +10660,8 @@ test_that("kary_tree_impl basic", { test_that("barabasi_game_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - # barabasi_game_impl needs BARABASI_ALGORITHM constants - skipping for now - skip("barabasi_game_impl requires BARABASI_ALGORITHM constants") + expect_snapshot(barabasi_game_impl(n = 10, power = 1, m = 2, directed = FALSE, algo = "bag")) + expect_snapshot(barabasi_game_impl(n = 10, power = 1, m = 2, directed = FALSE, algo = "psumtree")) }) test_that("growing_random_game_impl basic", { @@ -10814,8 +10815,8 @@ test_that("create_bipartite_impl basic", { test_that("bipartite_game_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - # bipartite_game_impl needs ERDOS_RENYI_TYPE constants - skipping for now - skip("bipartite_game_impl requires ERDOS_RENYI_TYPE constants") + expect_snapshot(bipartite_game_impl(type = "gnp", n1 = 5, n2 = 5, p = 0.3, directed = FALSE)) + expect_snapshot(bipartite_game_impl(type = "gnm", n1 = 5, n2 = 5, m = 10, directed = FALSE)) }) # Other structural functions @@ -10846,9 +10847,10 @@ test_that("neighborhood_size_impl basic", { test_that("is_chordal_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - g <- make_ring(4) - # is_chordal requires additional parameters, skip for now - skip("is_chordal_impl requires alpha and alpham1 parameters") + # is_chordal_impl has a bug where optional INDEX_VECTOR parameters + # cannot be NULL - they are always passed to C even when NULL + # This needs to be fixed in the generator or function spec + skip("is_chordal_impl has bug with optional INDEX_VECTOR parameters") }) test_that("get_adjacency_impl basic", { @@ -10895,8 +10897,8 @@ test_that("compare_communities_impl basic", { test_that("degree_sequence_game_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - # degree_sequence_game_impl needs DEGSEQ_MODE constants - skipping for now - skip("degree_sequence_game_impl requires DEGSEQ_MODE constants") + expect_snapshot(degree_sequence_game_impl(out_deg = c(2, 2, 2, 2), method = "configuration")) + expect_snapshot(degree_sequence_game_impl(out_deg = c(2, 2, 2, 2), method = "vl")) }) test_that("connect_neighborhood_impl basic", { diff --git a/tools/stimulus/types-RR.yaml b/tools/stimulus/types-RR.yaml index 08c078a592..ab0de370f5 100644 --- a/tools/stimulus/types-RR.yaml +++ b/tools/stimulus/types-RR.yaml @@ -103,6 +103,36 @@ TRANSITIVITY_MODE: NAN: c("nan", "zero") INCONV: '%I% <- switch_igraph_arg(%I%, "nan" = 0L, "zero" = 1L)' +STAR_MODE: + DEFAULT: + OUT: c("out", "in", "undirected", "mutual") + IN: c("in", "out", "undirected", "mutual") + UNDIRECTED: c("undirected", "out", "in", "mutual") + MUTUAL: c("mutual", "out", "in", "undirected") + INCONV: '%I% <- switch_igraph_arg(%I%, "out" = 0L, "in" = 1L, "undirected" = 2L, "mutual" = 3L)' + +BARABASI_ALGORITHM: + DEFAULT: + BAG: c("bag", "psumtree", "psumtree_multiple") + PSUMTREE: c("psumtree", "bag", "psumtree_multiple") + PSUMTREE_MULTIPLE: c("psumtree_multiple", "bag", "psumtree") + INCONV: '%I% <- switch_igraph_arg(%I%, "bag" = 0L, "psumtree" = 1L, "psumtree_multiple" = 2L)' + +ERDOS_RENYI_TYPE: + DEFAULT: + GNP: c("gnp", "gnm") + GNM: c("gnm", "gnp") + INCONV: '%I% <- switch_igraph_arg(%I%, "gnp" = 0L, "gnm" = 1L)' + +DEGSEQ_MODE: + DEFAULT: + CONFIGURATION: c("configuration", "fast_heur_simple", "configuration_simple", "edge_switching_simple", "vl") + VL: c("vl", "configuration", "fast_heur_simple", "configuration_simple", "edge_switching_simple") + FAST_HEUR_SIMPLE: c("fast_heur_simple", "configuration", "configuration_simple", "edge_switching_simple", "vl") + CONFIGURATION_SIMPLE: c("configuration_simple", "configuration", "fast_heur_simple", "edge_switching_simple", "vl") + EDGE_SWITCHING_SIMPLE: c("edge_switching_simple", "configuration", "fast_heur_simple", "configuration_simple", "vl") + INCONV: '%I% <- switch_igraph_arg(%I%, "configuration" = 0L, "vl" = 1L, "fast_heur_simple" = 2L, "configuration_simple" = 3L, "edge_switching_simple" = 4L)' + INT: INCONV: '%I% <- as.integer(%I%)' From e8639535ae63e910ee9c6255fd2f6c5ec0f7f214 Mon Sep 17 00:00:00 2001 From: krlmlr Date: Thu, 13 Nov 2025 10:05:11 +0000 Subject: [PATCH 07/10] chore: Auto-update from GitHub Actions Run: https://github.com/igraph/rigraph/actions/runs/19327576181 --- tests/testthat/test-aaa-auto.R | 193 +++++++++++++++++++++++++++------ 1 file changed, 160 insertions(+), 33 deletions(-) diff --git a/tests/testthat/test-aaa-auto.R b/tests/testthat/test-aaa-auto.R index 1333ad06b9..f5f344cadb 100644 --- a/tests/testthat/test-aaa-auto.R +++ b/tests/testthat/test-aaa-auto.R @@ -10620,8 +10620,6 @@ test_that("intersection_impl errors", { }) - - # Tests for newly autogenerated _impl functions # Graph constructors @@ -10637,8 +10635,18 @@ test_that("star_impl basic", { test_that("ring_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - expect_snapshot(ring_impl(n = 5, directed = FALSE, mutual = FALSE, circular = TRUE)) - expect_snapshot(ring_impl(n = 4, directed = TRUE, mutual = FALSE, circular = FALSE)) + expect_snapshot(ring_impl( + n = 5, + directed = FALSE, + mutual = FALSE, + circular = TRUE + )) + expect_snapshot(ring_impl( + n = 4, + directed = TRUE, + mutual = FALSE, + circular = FALSE + )) }) test_that("full_impl basic", { @@ -10651,8 +10659,16 @@ test_that("full_impl basic", { test_that("kary_tree_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - expect_snapshot(kary_tree_impl(n = 7, children = 2, type = c("out", "in", "undirected"))) - expect_snapshot(kary_tree_impl(n = 10, children = 3, type = c("in", "out", "undirected"))) + expect_snapshot(kary_tree_impl( + n = 7, + children = 2, + type = c("out", "in", "undirected") + )) + expect_snapshot(kary_tree_impl( + n = 10, + children = 3, + type = c("in", "out", "undirected") + )) }) # Random graph generators @@ -10660,14 +10676,31 @@ test_that("kary_tree_impl basic", { test_that("barabasi_game_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - expect_snapshot(barabasi_game_impl(n = 10, power = 1, m = 2, directed = FALSE, algo = "bag")) - expect_snapshot(barabasi_game_impl(n = 10, power = 1, m = 2, directed = FALSE, algo = "psumtree")) + expect_snapshot(barabasi_game_impl( + n = 10, + power = 1, + m = 2, + directed = FALSE, + algo = "bag" + )) + expect_snapshot(barabasi_game_impl( + n = 10, + power = 1, + m = 2, + directed = FALSE, + algo = "psumtree" + )) }) test_that("growing_random_game_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - expect_snapshot(growing_random_game_impl(n = 10, m = 1, directed = TRUE, citation = FALSE)) + expect_snapshot(growing_random_game_impl( + n = 10, + m = 1, + directed = TRUE, + citation = FALSE + )) }) test_that("grg_game_impl basic", { @@ -10679,7 +10712,12 @@ test_that("grg_game_impl basic", { test_that("watts_strogatz_game_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - expect_snapshot(watts_strogatz_game_impl(dim = 1, size = 10, nei = 2, p = 0.1)) + expect_snapshot(watts_strogatz_game_impl( + dim = 1, + size = 10, + nei = 2, + p = 0.1 + )) }) # Distance and path functions @@ -10688,28 +10726,46 @@ test_that("distances_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) g <- make_ring(5) - expect_snapshot(distances_impl(graph = g, from = V(g), to = V(g), mode = c("out", "in", "all", "total"))) + expect_snapshot(distances_impl( + graph = g, + from = V(g), + to = V(g), + mode = c("out", "in", "all", "total") + )) }) test_that("diameter_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) g <- make_ring(10) - expect_snapshot(diameter_impl(graph = g, directed = FALSE, unconnected = TRUE)) + expect_snapshot(diameter_impl( + graph = g, + directed = FALSE, + unconnected = TRUE + )) }) test_that("get_shortest_paths_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) g <- make_ring(5) - expect_snapshot(get_shortest_paths_impl(graph = g, from = 1, to = 3, mode = c("out", "in", "all", "total"))) + expect_snapshot(get_shortest_paths_impl( + graph = g, + from = 1, + to = 3, + mode = c("out", "in", "all", "total") + )) }) test_that("subcomponent_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) g <- make_graph(~ A-B-C, D-E-F) - expect_snapshot(subcomponent_impl(graph = g, v = 1, mode = c("all", "out", "in"))) + expect_snapshot(subcomponent_impl( + graph = g, + v = 1, + mode = c("all", "out", "in") + )) }) # Centrality measures @@ -10725,21 +10781,34 @@ test_that("closeness_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) g <- make_ring(5) - expect_snapshot(closeness_impl(graph = g, vids = V(g), mode = c("out", "in", "all", "total"))) + expect_snapshot(closeness_impl( + graph = g, + vids = V(g), + mode = c("out", "in", "all", "total") + )) }) test_that("harmonic_centrality_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) g <- make_star(5, mode = "undirected") - expect_snapshot(harmonic_centrality_impl(graph = g, vids = V(g), mode = c("out", "in", "all", "total"))) + expect_snapshot(harmonic_centrality_impl( + graph = g, + vids = V(g), + mode = c("out", "in", "all", "total") + )) }) test_that("pagerank_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) g <- make_ring(5, directed = TRUE) - expect_snapshot(pagerank_impl(graph = g, vids = V(g), directed = TRUE, damping = 0.85)) + expect_snapshot(pagerank_impl( + graph = g, + vids = V(g), + directed = TRUE, + damping = 0.85 + )) }) test_that("hub_score_impl basic", { @@ -10809,14 +10878,30 @@ test_that("layout_sphere_impl basic", { test_that("create_bipartite_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - expect_snapshot(create_bipartite_impl(types = c(FALSE, FALSE, TRUE, TRUE), edges = c(0, 2, 0, 3, 1, 2, 1, 3), directed = FALSE)) + expect_snapshot(create_bipartite_impl( + types = c(FALSE, FALSE, TRUE, TRUE), + edges = c(0, 2, 0, 3, 1, 2, 1, 3), + directed = FALSE + )) }) test_that("bipartite_game_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - expect_snapshot(bipartite_game_impl(type = "gnp", n1 = 5, n2 = 5, p = 0.3, directed = FALSE)) - expect_snapshot(bipartite_game_impl(type = "gnm", n1 = 5, n2 = 5, m = 10, directed = FALSE)) + expect_snapshot(bipartite_game_impl( + type = "gnp", + n1 = 5, + n2 = 5, + p = 0.3, + directed = FALSE + )) + expect_snapshot(bipartite_game_impl( + type = "gnm", + n1 = 5, + n2 = 5, + m = 10, + directed = FALSE + )) }) # Other structural functions @@ -10832,14 +10917,24 @@ test_that("neighborhood_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) g <- make_ring(5) - expect_snapshot(neighborhood_impl(graph = g, order = 1, vids = V(g), mode = c("all", "out", "in"))) + expect_snapshot(neighborhood_impl( + graph = g, + order = 1, + vids = V(g), + mode = c("all", "out", "in") + )) }) test_that("neighborhood_size_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) g <- make_ring(5) - expect_snapshot(neighborhood_size_impl(graph = g, order = 1, vids = V(g), mode = c("all", "out", "in"))) + expect_snapshot(neighborhood_size_impl( + graph = g, + order = 1, + vids = V(g), + mode = c("all", "out", "in") + )) }) # Graph properties @@ -10847,7 +10942,7 @@ test_that("neighborhood_size_impl basic", { test_that("is_chordal_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - # is_chordal_impl has a bug where optional INDEX_VECTOR parameters + # is_chordal_impl has a bug where optional INDEX_VECTOR parameters # cannot be NULL - they are always passed to C even when NULL # This needs to be fixed in the generator or function spec skip("is_chordal_impl has bug with optional INDEX_VECTOR parameters") @@ -10857,7 +10952,10 @@ test_that("get_adjacency_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) g <- make_ring(3) - expect_snapshot(get_adjacency_impl(graph = g, type = c("both", "upper", "lower"))) + expect_snapshot(get_adjacency_impl( + graph = g, + type = c("both", "upper", "lower") + )) }) # IO functions @@ -10878,7 +10976,11 @@ test_that("read_graph_edgelist_impl basic", { local_igraph_options(print.id = FALSE) tmp <- tempfile() writeLines(c("0 1", "1 2", "2 0"), tmp) - expect_snapshot(read_graph_edgelist_impl(instream = tmp, n = 3, directed = FALSE)) + expect_snapshot(read_graph_edgelist_impl( + instream = tmp, + n = 3, + directed = FALSE + )) unlink(tmp) }) @@ -10889,7 +10991,11 @@ test_that("compare_communities_impl basic", { local_igraph_options(print.id = FALSE) comm1 <- c(1, 1, 2, 2, 3, 3) comm2 <- c(1, 1, 2, 2, 2, 3) - expect_snapshot(compare_communities_impl(comm1 = comm1, comm2 = comm2, method = "vi")) + expect_snapshot(compare_communities_impl( + comm1 = comm1, + comm2 = comm2, + method = "vi" + )) }) # Additional game functions @@ -10897,15 +11003,25 @@ test_that("compare_communities_impl basic", { test_that("degree_sequence_game_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) - expect_snapshot(degree_sequence_game_impl(out_deg = c(2, 2, 2, 2), method = "configuration")) - expect_snapshot(degree_sequence_game_impl(out_deg = c(2, 2, 2, 2), method = "vl")) + expect_snapshot(degree_sequence_game_impl( + out_deg = c(2, 2, 2, 2), + method = "configuration" + )) + expect_snapshot(degree_sequence_game_impl( + out_deg = c(2, 2, 2, 2), + method = "vl" + )) }) test_that("connect_neighborhood_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) g <- make_ring(5) - expect_snapshot(connect_neighborhood_impl(graph = g, order = 1, mode = c("all", "out", "in"))) + expect_snapshot(connect_neighborhood_impl( + graph = g, + order = 1, + mode = c("all", "out", "in") + )) }) # Additional distance functions @@ -10914,7 +11030,11 @@ test_that("eccentricity_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) g <- make_ring(5) - expect_snapshot(eccentricity_impl(graph = g, vids = V(g), mode = c("out", "in", "all"))) + expect_snapshot(eccentricity_impl( + graph = g, + vids = V(g), + mode = c("out", "in", "all") + )) }) test_that("radius_impl basic", { @@ -10935,7 +11055,11 @@ test_that("voronoi_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) g <- make_ring(10) - expect_snapshot(voronoi_impl(graph = g, generators = c(1, 5), mode = c("out", "in", "all"))) + expect_snapshot(voronoi_impl( + graph = g, + generators = c(1, 5), + mode = c("out", "in", "all") + )) }) # Spanner @@ -10969,6 +11093,9 @@ test_that("independent_vertex_sets_impl basic", { withr::local_seed(20250909) local_igraph_options(print.id = FALSE) g <- make_ring(5) - expect_snapshot(independent_vertex_sets_impl(graph = g, min_size = 1, max_size = 0)) + expect_snapshot(independent_vertex_sets_impl( + graph = g, + min_size = 1, + max_size = 0 + )) }) - From 28708266fbce109164fd449648403eb1d52b4220 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 16 Nov 2025 15:51:23 +0000 Subject: [PATCH 08/10] fix: add missing enum type translations and fix default value issues - Added ADJACENCY_MODE enum type with mappings for directed/undirected/upper/lower/min/plus/max - Added SPINCOMMUPDATE enum type with mappings for simple/config - Added SPINGLASS_IMPLEMENTATION enum type with mappings for orig/neg - Added FWALGORITHM enum type with mappings for automatic/original/tree - Added LAYOUT_GRID enum type with mappings for grid/nogrid/auto - Added VCONNNEI enum type with mappings for error/number_of_nodes/ignore/negative - Fixed VCOUNT(graph) default values to use vcount(graph) in layout_lgl - Fixed True boolean defaults to use TRUE in read_graph_lgl and read_graph_ncol - All R CMD check warnings about undefined global variables are now resolved - All tests pass: 1217 passing, 1 skipped Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com> --- R/aaa-auto.R | 64 +++++++++++++++++++++++++-------- tools/stimulus/functions-R.yaml | 9 +++++ tools/stimulus/types-RR.yaml | 46 ++++++++++++++++++++++++ 3 files changed, 104 insertions(+), 15 deletions(-) diff --git a/R/aaa-auto.R b/R/aaa-auto.R index 0e9bcb0835..499b0c6985 100644 --- a/R/aaa-auto.R +++ b/R/aaa-auto.R @@ -448,11 +448,21 @@ create_impl <- function( adjacency_impl <- function( adjmatrix, - mode = DIRECTED, + mode = c("directed", "undirected", "upper", "lower", "min", "plus", "max"), loops = c("once", "none", "twice") ) { # Argument checks adjmatrix[] <- as.numeric(adjmatrix) + mode <- switch_igraph_arg( + mode, + "directed" = 0L, + "undirected" = 1L, + "upper" = 2L, + "lower" = 3L, + "min" = 4L, + "plus" = 5L, + "max" = 6L + ) loops <- switch_igraph_arg(loops, "none" = 0L, "twice" = 1L, "once" = 2L) on.exit(.Call(R_igraph_finalizer)) @@ -469,11 +479,21 @@ adjacency_impl <- function( weighted_adjacency_impl <- function( adjmatrix, - mode = DIRECTED, + mode = c("directed", "undirected", "upper", "lower", "min", "plus", "max"), loops = c("once", "none", "twice") ) { # Argument checks adjmatrix[] <- as.numeric(adjmatrix) + mode <- switch_igraph_arg( + mode, + "directed" = 0L, + "undirected" = 1L, + "upper" = 2L, + "lower" = 3L, + "min" = 4L, + "plus" = 5L, + "max" = 6L + ) loops <- switch_igraph_arg(loops, "none" = 0L, "twice" = 1L, "once" = 2L) on.exit(.Call(R_igraph_finalizer)) @@ -3216,7 +3236,7 @@ distances_floyd_warshall_impl <- function( to = V(graph), weights = NULL, mode = c("out", "in", "all", "total"), - method = AUTOMATIC + method = c("automatic", "original", "tree") ) { # Argument checks ensure_igraph(graph) @@ -3237,6 +3257,7 @@ distances_floyd_warshall_impl <- function( "all" = 3L, "total" = 3L ) + method <- switch_igraph_arg(method, "automatic" = 0L, "original" = 1L, "tree" = 2L) on.exit(.Call(R_igraph_finalizer)) # Function call @@ -7619,7 +7640,7 @@ layout_fruchterman_reingold_impl <- function( use_seed = FALSE, niter = 500, start_temp = sqrt(vcount(graph)), - grid = AUTO, + grid = c("auto", "grid", "nogrid"), weights = NULL, minx = NULL, maxx = NULL, @@ -7634,6 +7655,7 @@ layout_fruchterman_reingold_impl <- function( use_seed <- as.logical(use_seed) niter <- as.numeric(niter) start_temp <- as.numeric(start_temp) + grid <- switch_igraph_arg(grid, "grid" = 0L, "nogrid" = 1L, "auto" = 2L) if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } @@ -7743,11 +7765,11 @@ layout_kamada_kawai_impl <- function( layout_lgl_impl <- function( graph, maxiter = 150, - maxdelta = VCOUNT(graph), - area = VCOUNT(graph)^2, + maxdelta = vcount(graph), + area = vcount(graph)^2, coolexp = 1.5, - repulserad = VCOUNT(graph)^3, - cellsize = VCOUNT(graph), + repulserad = vcount(graph)^3, + cellsize = vcount(graph), root = -1 ) { # Argument checks @@ -8735,9 +8757,9 @@ community_spinglass_impl <- function( starttemp = 1, stoptemp = 0.01, coolfact = 0.99, - update_rule = CONFIG, + update_rule = c("config", "simple"), gamma = 1.0, - implementation = ORIG, + implementation = c("orig", "neg"), lambda = 1.0 ) { # Argument checks @@ -8755,7 +8777,9 @@ community_spinglass_impl <- function( starttemp <- as.numeric(starttemp) stoptemp <- as.numeric(stoptemp) coolfact <- as.numeric(coolfact) + update_rule <- switch_igraph_arg(update_rule, "simple" = 0L, "config" = 1L) gamma <- as.numeric(gamma) + implementation <- switch_igraph_arg(implementation, "orig" = 0L, "neg" = 1L) lambda <- as.numeric(lambda) on.exit(.Call(R_igraph_finalizer)) @@ -8783,7 +8807,7 @@ community_spinglass_single_impl <- function( weights = NULL, vertex, spins = 25, - update_rule = CONFIG, + update_rule = c("config", "simple"), gamma = 1.0 ) { # Argument checks @@ -8798,6 +8822,7 @@ community_spinglass_single_impl <- function( } vertex <- as.numeric(vertex) spins <- as.numeric(spins) + update_rule <- switch_igraph_arg(update_rule, "simple" = 0L, "config" = 1L) gamma <- as.numeric(gamma) on.exit(.Call(R_igraph_finalizer)) @@ -9831,7 +9856,7 @@ read_graph_ncol_impl <- function( instream, predefnames = NULL, names = TRUE, - weights = True, + weights = TRUE, directed = TRUE ) { # Argument checks @@ -9858,7 +9883,7 @@ read_graph_ncol_impl <- function( read_graph_lgl_impl <- function( instream, names = TRUE, - weights = True, + weights = TRUE, directed = TRUE ) { # Argument checks @@ -11244,7 +11269,7 @@ st_vertex_connectivity_impl <- function( graph, source, target, - neighbors = NUMBER_OF_NODES + neighbors = c("number_of_nodes", "error", "ignore", "negative") ) { # Argument checks ensure_igraph(graph) @@ -11262,6 +11287,13 @@ st_vertex_connectivity_impl <- function( call = rlang::caller_env() ) } + neighbors <- switch_igraph_arg( + neighbors, + "error" = 0L, + "number_of_nodes" = 1L, + "ignore" = 2L, + "negative" = 3L + ) on.exit(.Call(R_igraph_finalizer)) # Function call @@ -13786,7 +13818,9 @@ motifs_randesu_callback_closure_impl <- function( # Argument checks ensure_igraph(graph) size <- as.numeric(size) - if (!is.null(cut_prob)) cut_prob <- as.numeric(cut_prob) + if (!is.null(cut_prob)) { + cut_prob <- as.numeric(cut_prob) + } if (!is.function(callback)) { cli::cli_abort("{.arg callback} must be a function") } diff --git a/tools/stimulus/functions-R.yaml b/tools/stimulus/functions-R.yaml index a6af2bbc95..8d96bfb76f 100644 --- a/tools/stimulus/functions-R.yaml +++ b/tools/stimulus/functions-R.yaml @@ -574,6 +574,10 @@ igraph_layout_fruchterman_reingold: igraph_layout_kamada_kawai: igraph_layout_lgl: + PARAMS: |- + GRAPH graph, OUT MATRIX res, INTEGER maxiter=150, REAL maxdelta=vcount(graph), + REAL area=vcount(graph)^2, REAL coolexp=1.5, REAL repulserad=vcount(graph)^3, REAL cellsize=vcount(graph), + INTEGER root=-1 igraph_layout_reingold_tilford: @@ -680,8 +684,13 @@ igraph_to_directed: igraph_read_graph_edgelist: igraph_read_graph_ncol: + PARAMS: |- + INFILE instream, OPTIONAL VECTOR_STR predefnames, BOOLEAN names=TRUE, + ADD_WEIGHTS weights=TRUE, BOOLEAN directed=TRUE igraph_read_graph_lgl: + PARAMS: |- + INFILE instream, BOOLEAN names=TRUE, ADD_WEIGHTS weights=TRUE, BOOLEAN directed=TRUE igraph_read_graph_pajek: diff --git a/tools/stimulus/types-RR.yaml b/tools/stimulus/types-RR.yaml index d1aa3ee0ba..ffb258a404 100644 --- a/tools/stimulus/types-RR.yaml +++ b/tools/stimulus/types-RR.yaml @@ -21,6 +21,7 @@ REAL: ECROSSW: 1.0 - sqrt(edge_density(graph)) ELENW: edge_density(graph) / 10 NEDISTW: 0.2 * (1 - edge_density(graph)) + VCOUNT: vcount INCONV: IN: '%I% <- as.numeric(%I%)' @@ -133,6 +134,51 @@ DEGSEQ_MODE: EDGE_SWITCHING_SIMPLE: c("edge_switching_simple", "configuration", "fast_heur_simple", "configuration_simple", "vl") INCONV: '%I% <- switch_igraph_arg(%I%, "configuration" = 0L, "vl" = 1L, "fast_heur_simple" = 2L, "configuration_simple" = 3L, "edge_switching_simple" = 4L)' +ADJACENCY_MODE: + DEFAULT: + DIRECTED: c("directed", "undirected", "upper", "lower", "min", "plus", "max") + UNDIRECTED: c("undirected", "directed", "upper", "lower", "min", "plus", "max") + UPPER: c("upper", "lower", "directed", "undirected", "min", "plus", "max") + LOWER: c("lower", "upper", "directed", "undirected", "min", "plus", "max") + MIN: c("min", "max", "plus", "directed", "undirected", "upper", "lower") + PLUS: c("plus", "min", "max", "directed", "undirected", "upper", "lower") + MAX: c("max", "min", "plus", "directed", "undirected", "upper", "lower") + INCONV: '%I% <- switch_igraph_arg(%I%, "directed" = 0L, "undirected" = 1L, "upper" = 2L, "lower" = 3L, "min" = 4L, "plus" = 5L, "max" = 6L)' + +SPINCOMMUPDATE: + DEFAULT: + SIMPLE: c("simple", "config") + CONFIG: c("config", "simple") + INCONV: '%I% <- switch_igraph_arg(%I%, "simple" = 0L, "config" = 1L)' + +SPINGLASS_IMPLEMENTATION: + DEFAULT: + ORIG: c("orig", "neg") + NEG: c("neg", "orig") + INCONV: '%I% <- switch_igraph_arg(%I%, "orig" = 0L, "neg" = 1L)' + +FWALGORITHM: + DEFAULT: + AUTOMATIC: c("automatic", "original", "tree") + ORIGINAL: c("original", "automatic", "tree") + TREE: c("tree", "automatic", "original") + INCONV: '%I% <- switch_igraph_arg(%I%, "automatic" = 0L, "original" = 1L, "tree" = 2L)' + +LAYOUT_GRID: + DEFAULT: + GRID: c("grid", "nogrid", "auto") + NOGRID: c("nogrid", "grid", "auto") + AUTO: c("auto", "grid", "nogrid") + INCONV: '%I% <- switch_igraph_arg(%I%, "grid" = 0L, "nogrid" = 1L, "auto" = 2L)' + +VCONNNEI: + DEFAULT: + ERROR: c("error", "number_of_nodes", "ignore", "negative") + NUMBER_OF_NODES: c("number_of_nodes", "error", "ignore", "negative") + IGNORE: c("ignore", "error", "number_of_nodes", "negative") + NEGATIVE: c("negative", "error", "number_of_nodes", "ignore") + INCONV: '%I% <- switch_igraph_arg(%I%, "error" = 0L, "number_of_nodes" = 1L, "ignore" = 2L, "negative" = 3L)' + INT: INCONV: '%I% <- as.integer(%I%)' From 4d727ffbf0b53ca5a2a27c049e6f7a6e342ec202 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 16 Nov 2025 16:17:39 +0000 Subject: [PATCH 09/10] fix: add deprecated parameters to FR layout function signatures - Added parameter overrides for igraph_layout_fruchterman_reingold and igraph_layout_fruchterman_reingold_3d in functions-R.yaml - Deprecated parameters (coolexp, maxdelta, area, repulserad) now have NULL defaults - Modified DEPRECATED type in types-RR.yaml to remove HEADER: ~ to allow parameters in signature - All R CMD check warnings about undefined global variables (coolexp, maxdelta, area, repulserad) are now resolved Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com> --- R/aaa-auto.R | 12 +- tests/testthat/_snaps/aaa-auto.new.md | 11183 ++++++++++++++++++++++++ tools/stimulus/functions-R.yaml | 21 + tools/stimulus/types-RR.yaml | 1 - 4 files changed, 11214 insertions(+), 3 deletions(-) create mode 100644 tests/testthat/_snaps/aaa-auto.new.md diff --git a/R/aaa-auto.R b/R/aaa-auto.R index 499b0c6985..3b179f5919 100644 --- a/R/aaa-auto.R +++ b/R/aaa-auto.R @@ -7645,7 +7645,11 @@ layout_fruchterman_reingold_impl <- function( minx = NULL, maxx = NULL, miny = NULL, - maxy = NULL + maxy = NULL, + coolexp = NULL, + maxdelta = NULL, + area = NULL, + repulserad = NULL ) { # Argument checks ensure_igraph(graph) @@ -7942,7 +7946,11 @@ layout_fruchterman_reingold_3d_impl <- function( miny = NULL, maxy = NULL, minz = NULL, - maxz = NULL + maxz = NULL, + coolexp = NULL, + maxdelta = NULL, + area = NULL, + repulserad = NULL ) { # Argument checks ensure_igraph(graph) diff --git a/tests/testthat/_snaps/aaa-auto.new.md b/tests/testthat/_snaps/aaa-auto.new.md new file mode 100644 index 0000000000..d724e68b6c --- /dev/null +++ b/tests/testthat/_snaps/aaa-auto.new.md @@ -0,0 +1,11183 @@ +# empty_impl basic + + Code + empty_impl() + Output + IGRAPH D--- 0 0 -- + + edges: + +--- + + Code + empty_impl(n = 5, directed = FALSE) + Output + IGRAPH U--- 5 0 -- + + edges: + +# empty_impl errors + + Code + empty_impl(n = -1) + Condition + Error in `empty_impl()`: + ! At vendor/cigraph/src/graph/type_indexededgelist.c:xx : Number of vertices must not be negative. Invalid value + +# add_edges_impl basic + + Code + add_edges_impl(graph = g, edges = c(0, 1, 1, 2)) + Output + IGRAPH D--- 3 2 -- + + edges: + [1] 1->2 2->3 + +# add_edges_impl errors + + Code + add_edges_impl(graph = NULL, edges = c(1, 2)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# copy_impl basic + + Code + copy_impl(from = g) + Output + IGRAPH D--- 2 0 -- + + edges: + +# copy_impl errors + + Code + copy_impl(from = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# delete_vertices_idx_impl basic + + Code + delete_vertices_idx_impl(graph = g, vertices = 1) + Output + $graph + IGRAPH D--- 2 0 -- + + edges: + + $idx + [1] 0 1 2 + + $invidx + [1] 1 2 + + +# delete_vertices_idx_impl errors + + Code + delete_vertices_idx_impl(graph = NULL, vertices = 1) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# vcount_impl basic + + Code + vcount_impl(graph = g) + Output + [1] 4 + +# vcount_impl errors + + Code + vcount_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# degree_impl basic + + Code + degree_impl(graph = g) + Output + [1] 0 0 0 + +--- + + Code + degree_impl(graph = g, mode = "in") + Output + [1] 0 0 0 + +# degree_impl errors + + Code + degree_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# get_all_eids_between_impl basic + + Code + get_all_eids_between_impl(graph = g, from = 1, to = 2) + Output + + 0/0 edges: + +# get_all_eids_between_impl errors + + Code + get_all_eids_between_impl(graph = NULL, from = 1, to = 2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# wheel_impl basic + + Code + wheel_impl(n = 5) + Output + IGRAPH D--- 5 8 -- + + edges: + [1] 1->2 1->3 1->4 1->5 2->3 3->4 4->5 5->2 + +--- + + Code + wheel_impl(n = 5, mode = "in", center = 2) + Output + IGRAPH D--- 5 8 -- + + edges: + [1] 1->3 2->3 4->3 5->3 1->2 2->4 4->5 5->1 + +# wheel_impl errors + + Code + wheel_impl(n = -1) + Condition + Error in `wheel_impl()`: + ! At vendor/cigraph/src/constructors/regular.c:xx : Invalid number of vertices. Invalid vertex ID + +# hypercube_impl basic + + Code + hypercube_impl(n = 3) + Output + IGRAPH U--- 8 12 -- + + edges: + [1] 1--2 1--3 1--5 2--4 2--6 3--4 3--7 4--8 5--6 5--7 6--8 7--8 + +--- + + Code + hypercube_impl(n = 3, directed = TRUE) + Output + IGRAPH D--- 8 12 -- + + edges: + [1] 1->2 1->3 1->5 2->4 2->6 3->4 3->7 4->8 5->6 5->7 6->8 7->8 + +# hypercube_impl errors + + Code + hypercube_impl(n = 10000) + Condition + Error in `hypercube_impl()`: + ! At vendor/cigraph/src/constructors/regular.c:xx : The requested hypercube graph dimension (10000) is too high. It must be no greater than 57. Invalid value + +# square_lattice_impl basic + + Code + square_lattice_impl(dimvector = c(2, 2)) + Output + IGRAPH U--- 4 4 -- + + edges: + [1] 1--2 1--3 2--4 3--4 + +--- + + Code + square_lattice_impl(dimvector = c(2, 2), nei = 2, directed = TRUE, mutual = TRUE, + periodic = c(TRUE, TRUE)) + Output + IGRAPH D--- 4 10 -- + + edges: + [1] 1->2 1->3 2->1 2->4 3->4 3->1 4->3 4->2 1->4 2->3 + +# square_lattice_impl errors + + Code + square_lattice_impl(dimvector = -1) + Condition + Error in `square_lattice_impl()`: + ! At vendor/cigraph/src/constructors/regular.c:xx : Invalid dimension vector. Invalid value + +# triangular_lattice_impl basic + + Code + triangular_lattice_impl(dimvector = c(2, 2)) + Output + IGRAPH U--- 4 5 -- + + edges: + [1] 1--2 1--4 1--3 2--4 3--4 + +--- + + Code + triangular_lattice_impl(dimvector = c(2, 2), directed = TRUE, mutual = TRUE) + Output + IGRAPH D--- 4 10 -- + + edges: + [1] 1->2 2->1 1->4 4->1 1->3 3->1 2->4 4->2 3->4 4->3 + +# triangular_lattice_impl errors + + Code + triangular_lattice_impl(dimvector = -1) + Condition + Error in `triangular_lattice_impl()`: + ! At vendor/cigraph/src/constructors/lattices.c:xx : Invalid dimension vector. Invalid value + +# path_graph_impl basic + + Code + path_graph_impl(n = 5) + Output + IGRAPH U--- 5 4 -- + + edges: + [1] 1--2 2--3 3--4 4--5 + +--- + + Code + path_graph_impl(n = 5, directed = TRUE, mutual = TRUE) + Output + IGRAPH D--- 5 8 -- + + edges: + [1] 1->2 2->1 2->3 3->2 3->4 4->3 4->5 5->4 + +# path_graph_impl errors + + Code + path_graph_impl(n = -1) + Condition + Error in `path_graph_impl()`: + ! At vendor/cigraph/src/constructors/regular.c:xx : The number of vertices must be non-negative, got -1. Invalid value + +# cycle_graph_impl basic + + Code + cycle_graph_impl(n = 5) + Output + IGRAPH U--- 5 5 -- + + edges: + [1] 1--2 2--3 3--4 4--5 1--5 + +--- + + Code + cycle_graph_impl(n = 5, directed = TRUE, mutual = TRUE) + Output + IGRAPH D--- 5 10 -- + + edges: + [1] 1->2 2->1 2->3 3->2 3->4 4->3 4->5 5->4 5->1 1->5 + +# cycle_graph_impl errors + + Code + cycle_graph_impl(n = -1) + Condition + Error in `cycle_graph_impl()`: + ! At vendor/cigraph/src/constructors/regular.c:xx : The number of vertices must be non-negative, got -1. Invalid value + +# symmetric_tree_impl basic + + Code + symmetric_tree_impl(branches = 3) + Output + IGRAPH D--- 4 3 -- + + edges: + [1] 1->2 1->3 1->4 + +--- + + Code + symmetric_tree_impl(branches = 3, type = "in") + Output + IGRAPH D--- 4 3 -- + + edges: + [1] 2->1 3->1 4->1 + +# symmetric_tree_impl errors + + Code + symmetric_tree_impl(branches = -1) + Condition + Error in `symmetric_tree_impl()`: + ! At vendor/cigraph/src/constructors/regular.c:xx : The number of branches must be positive at each level. Invalid value + +# regular_tree_impl basic + + Code + regular_tree_impl(h = 2) + Output + IGRAPH U--- 10 9 -- + + edges: + [1] 1-- 2 1-- 3 1-- 4 2-- 5 2-- 6 3-- 7 3-- 8 4-- 9 4--10 + +--- + + Code + regular_tree_impl(h = 2, k = 4, type = "in") + Output + IGRAPH D--- 17 16 -- + + edges: + [1] 2->1 3->1 4->1 5->1 6->2 7->2 8->2 9->3 10->3 11->3 12->4 13->4 + [13] 14->4 15->5 16->5 17->5 + +# regular_tree_impl errors + + Code + regular_tree_impl(h = -1) + Condition + Error in `regular_tree_impl()`: + ! At vendor/cigraph/src/constructors/regular.c:xx : Height of regular tree must be positive, got -1. Invalid value + +# full_citation_impl basic + + Code + full_citation_impl(n = 5) + Output + IGRAPH D--- 5 10 -- + + edges: + [1] 2->1 3->1 3->2 4->1 4->2 4->3 5->1 5->2 5->3 5->4 + +--- + + Code + full_citation_impl(n = 5, directed = FALSE) + Output + IGRAPH U--- 5 10 -- + + edges: + [1] 1--2 1--3 2--3 1--4 2--4 3--4 1--5 2--5 3--5 4--5 + +# full_citation_impl errors + + Code + full_citation_impl(n = -1) + Condition + Error in `full_citation_impl()`: + ! At vendor/cigraph/src/constructors/full.c:xx : Invalid number of vertices. Invalid value + +# atlas_impl basic + + Code + atlas_impl(number = 0) + Output + IGRAPH U--- 0 0 -- + + edges: + +--- + + Code + atlas_impl(number = 5) + Output + IGRAPH U--- 3 1 -- + + edge: + [1] 2--3 + +# atlas_impl errors + + Code + atlas_impl(number = -1) + Condition + Error in `atlas_impl()`: + ! At vendor/cigraph/src/constructors/atlas.c:xx : No such graph in atlas. The graph index must be less than 1253. Invalid value + +# extended_chordal_ring_impl basic + + Code + extended_chordal_ring_impl(nodes = 5, W = matrix(c(1, 2))) + Output + IGRAPH U--- 5 15 -- + + edges: + [1] 1--2 2--3 3--4 4--5 1--5 1--2 1--3 2--3 2--4 3--4 3--5 4--5 1--4 1--5 2--5 + +--- + + Code + extended_chordal_ring_impl(nodes = 5, W = matrix(c(1, 2)), directed = TRUE) + Output + IGRAPH D--- 5 15 -- + + edges: + [1] 1->2 2->3 3->4 4->5 5->1 1->2 1->3 2->3 2->4 3->4 3->5 4->5 4->1 5->1 5->2 + +# extended_chordal_ring_impl errors + + Code + extended_chordal_ring_impl(nodes = -1, W = matrix(c(1, 2))) + Condition + Error in `extended_chordal_ring_impl()`: + ! At vendor/cigraph/src/constructors/regular.c:xx : An extended chordal ring has at least 3 nodes. Invalid value + +# graph_power_impl basic + + Code + graph_power_impl(graph = g, order = 2) + Output + IGRAPH U--- 5 7 -- + + edges: + [1] 1--2 2--3 3--4 4--5 1--3 2--4 3--5 + +--- + + Code + graph_power_impl(graph = g, order = 2, directed = TRUE) + Output + IGRAPH U--- 5 7 -- + + edges: + [1] 1--2 2--3 3--4 4--5 1--3 2--4 3--5 + +# graph_power_impl errors + + Code + graph_power_impl(graph = NULL, order = 2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# linegraph_impl basic + + Code + linegraph_impl(graph = g) + Output + IGRAPH U--- 4 3 -- + + edges: + [1] 1--2 2--3 3--4 + +# linegraph_impl errors + + Code + linegraph_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# de_bruijn_impl basic + + Code + de_bruijn_impl(m = 2, n = 3) + Output + IGRAPH D--- 8 16 -- + + edges: + [1] 1->1 1->2 2->3 2->4 3->5 3->6 4->7 4->8 5->1 5->2 6->3 6->4 7->5 7->6 8->7 + [16] 8->8 + +# de_bruijn_impl errors + + Code + de_bruijn_impl(m = -1, n = 3) + Condition + Error in `de_bruijn_impl()`: + ! At vendor/cigraph/src/constructors/de_bruijn.c:xx : `m' and `n' should be non-negative in a de Bruijn graph, Invalid value + +# kautz_impl basic + + Code + kautz_impl(m = 2, n = 3) + Output + IGRAPH D--- 24 48 -- + + edges: + [1] 1-> 9 1->10 2->11 2->12 3->13 3->14 4->15 4->16 5->17 5->18 + [11] 6->19 6->20 7->21 7->22 8->23 8->24 9-> 1 9-> 2 10-> 3 10-> 4 + [21] 11-> 5 11-> 6 12-> 7 12-> 8 13->17 13->18 14->19 14->20 15->21 15->22 + [31] 16->23 16->24 17-> 1 17-> 2 18-> 3 18-> 4 19-> 5 19-> 6 20-> 7 20-> 8 + [41] 21-> 9 21->10 22->11 22->12 23->13 23->14 24->15 24->16 + +# kautz_impl errors + + Code + kautz_impl(m = -1, n = 3) + Condition + Error in `kautz_impl()`: + ! At vendor/cigraph/src/constructors/kautz.c:xx : `m' and `n' should be non-negative in a Kautz graph, Invalid value + +# lcf_vector_impl basic + + Code + lcf_vector_impl(n = 10, shifts = c(3, -3, 4), repeats = 2) + Output + IGRAPH U--- 10 16 -- LCF graph + + attr: name (g/c) + + edges: + [1] 1-- 2 1-- 4 1--10 2-- 3 2-- 5 2-- 9 3-- 4 3-- 7 4-- 5 4-- 7 5-- 6 6-- 7 + [13] 6--10 7-- 8 8-- 9 9--10 + +# lcf_vector_impl errors + + Code + lcf_vector_impl(n = -1, shifts = c(3, -3, 4), repeats = 2) + Condition + Error in `lcf_vector_impl()`: + ! At vendor/cigraph/src/graph/type_indexededgelist.c:xx : Number of vertices must not be negative. Invalid value + +# mycielski_graph_impl basic + + Code + mycielski_graph_impl(k = 3) + Output + IGRAPH U--- 5 5 -- + + edges: + [1] 1--2 1--4 2--3 3--5 4--5 + +# mycielski_graph_impl errors + + Code + mycielski_graph_impl(k = -1) + Condition + Error in `mycielski_graph_impl()`: + ! At vendor/cigraph/src/constructors/mycielskian.c:xx : The Mycielski graph order must not be negative. Invalid value + +# adjlist_impl basic + + Code + adjlist_impl(adjlist = list(c(2, 3), c(1), c(1)), mode = "out") + Output + IGRAPH D--- 3 4 -- + + edges: + [1] 1->2 1->3 2->1 3->1 + +# adjlist_impl errors + + Code + adjlist_impl(adjlist = -1, mode = "out") + Condition + Error in `adjlist_impl()`: + ! At vendor/cigraph/src/constructors/basic_constructors.c:xx : Invalid (negative or too large) vertex ID. Invalid vertex ID + +# full_bipartite_impl basic + + Code + full_bipartite_impl(n1 = 2, n2 = 3) + Output + $graph + IGRAPH U--- 5 6 -- + + edges: + [1] 1--3 1--4 1--5 2--3 2--4 2--5 + + $types + [1] FALSE FALSE TRUE TRUE TRUE + + +--- + + Code + full_bipartite_impl(n1 = 2, n2 = 3, directed = TRUE, mode = "in") + Output + $graph + IGRAPH D--- 5 6 -- + + edges: + [1] 3->1 4->1 5->1 3->2 4->2 5->2 + + $types + [1] FALSE FALSE TRUE TRUE TRUE + + +# full_bipartite_impl errors + + Code + full_bipartite_impl(n1 = -1, n2 = 3) + Condition + Error in `full_bipartite_impl()`: + ! At vendor/cigraph/src/misc/bipartite.c:xx : Invalid number of vertices for bipartite graph. Invalid value + +# full_multipartite_impl basic + + Code + full_multipartite_impl(n = c(2, 3, 4)) + Output + $graph + IGRAPH U--- 9 26 -- + + edges: + [1] 1--3 1--4 1--5 1--6 1--7 1--8 1--9 2--3 2--4 2--5 2--6 2--7 2--8 2--9 3--6 + [16] 3--7 3--8 3--9 4--6 4--7 4--8 4--9 5--6 5--7 5--8 5--9 + + $types + [1] 1 1 2 2 2 3 3 3 3 + + $name + [1] "Full multipartite graph" + + $n + [1] 2 3 4 + + $mode + [1] 3 + + +--- + + Code + full_multipartite_impl(n = c(2, 3, 4), directed = TRUE, mode = "in") + Output + $graph + IGRAPH D--- 9 26 -- + + edges: + [1] 3->1 4->1 5->1 6->1 7->1 8->1 9->1 3->2 4->2 5->2 6->2 7->2 8->2 9->2 6->3 + [16] 7->3 8->3 9->3 6->4 7->4 8->4 9->4 6->5 7->5 8->5 9->5 + + $types + [1] 1 1 2 2 2 3 3 3 3 + + $name + [1] "Full multipartite graph" + + $n + [1] 2 3 4 + + $mode + [1] 2 + + +# full_multipartite_impl errors + + Code + full_multipartite_impl(n = -1) + Condition + Error in `full_multipartite_impl()`: + ! At vendor/cigraph/src/constructors/full.c:xx : Number of vertices must not be negative in any partition. Invalid value + +# realize_degree_sequence_impl basic + + Code + realize_degree_sequence_impl(out_deg = c(2, 2, 2)) + Output + IGRAPH U--- 3 3 -- Graph from degree sequence + + attr: name (g/c), out_deg (g/n), in_deg (g/x), allowed_edge_types + | (g/n), method (g/n) + + edges: + [1] 2--3 1--3 1--2 + +--- + + Code + realize_degree_sequence_impl(out_deg = c(2, 2, 2), in_deg = c(2, 2, 2), + allowed_edge_types = "simple", method = "largest") + Output + IGRAPH D--- 3 6 -- Graph from degree sequence + + attr: name (g/c), out_deg (g/n), in_deg (g/n), allowed_edge_types + | (g/n), method (g/n) + + edges: + [1] 1->2 1->3 2->1 2->3 3->1 3->2 + +# realize_degree_sequence_impl errors + + Code + realize_degree_sequence_impl(out_deg = -1) + Condition + Error in `realize_degree_sequence_impl()`: + ! At vendor/cigraph/src/misc/degree_sequence.cpp:xx : The sum of degrees must be even for an undirected graph. Invalid value + +# realize_bipartite_degree_sequence_impl basic + + Code + realize_bipartite_degree_sequence_impl(degrees1 = c(2, 2), degrees2 = c(2, 2)) + Output + IGRAPH U--- 4 4 -- Bipartite graph from degree sequence + + attr: name (g/c), degrees1 (g/n), degrees2 (g/n), allowed_edge_types + | (g/n), method (g/n) + + edges: + [1] 2--3 2--4 1--4 1--3 + +--- + + Code + realize_bipartite_degree_sequence_impl(degrees1 = c(2, 2), degrees2 = c(2, 2), + allowed_edge_types = "loops", method = "largest") + Output + IGRAPH U--- 4 4 -- Bipartite graph from degree sequence + + attr: name (g/c), degrees1 (g/n), degrees2 (g/n), allowed_edge_types + | (g/n), method (g/n) + + edges: + [1] 1--3 1--4 2--3 2--4 + +# realize_bipartite_degree_sequence_impl errors + + Code + realize_bipartite_degree_sequence_impl(degrees1 = -1, degrees2 = c(2, 2)) + Condition + Error in `realize_bipartite_degree_sequence_impl()`: + ! At vendor/cigraph/src/misc/degree_sequence.cpp:xx : The given bidegree sequence cannot be realized as a bipartite simple graph. Invalid value + +# circulant_impl basic + + Code + circulant_impl(n = 5, shifts = c(1, 2)) + Output + IGRAPH U--- 5 10 -- Circulant graph + + attr: name (g/c), shifts (g/n) + + edges: + [1] 1--2 2--3 3--4 4--5 1--5 1--3 2--4 3--5 1--4 2--5 + +--- + + Code + circulant_impl(n = 5, shifts = c(1, 2), directed = TRUE) + Output + IGRAPH D--- 5 10 -- Circulant graph + + attr: name (g/c), shifts (g/n) + + edges: + [1] 1->2 2->3 3->4 4->5 5->1 1->3 2->4 3->5 4->1 5->2 + +# circulant_impl errors + + Code + circulant_impl(n = -1, shifts = c(1, 2)) + Condition + Error in `circulant_impl()`: + ! At vendor/cigraph/src/constructors/circulant.c:xx : Number of nodes = -1 must be non-negative. Invalid value + +# generalized_petersen_impl basic + + Code + generalized_petersen_impl(n = 5, k = 2) + Output + IGRAPH U--- 10 15 -- + + edges: + [1] 1-- 2 1-- 6 6-- 8 2-- 3 2-- 7 7-- 9 3-- 4 3-- 8 8--10 4-- 5 4-- 9 6-- 9 + [13] 1-- 5 5--10 7--10 + +# generalized_petersen_impl errors + + Code + generalized_petersen_impl(n = -1, k = 2) + Condition + Error in `generalized_petersen_impl()`: + ! At vendor/cigraph/src/constructors/generalized_petersen.c:xx : n = -1 must be at least 3. Invalid value + +# turan_impl basic + + Code + turan_impl(n = 5, r = 2) + Output + $graph + IGRAPH U--- 5 6 -- + + edges: + [1] 1--4 1--5 2--4 2--5 3--4 3--5 + + $types + [1] 1 1 1 2 2 + + $name + [1] "Turan graph" + + $n + [1] 5 + + $r + [1] 2 + + +# turan_impl errors + + Code + turan_impl(n = -1, r = 2) + Condition + Error in `turan_impl()`: + ! At vendor/cigraph/src/constructors/full.c:xx : Number of vertices must not be negative, got -1. Invalid value + +# erdos_renyi_game_gnp_impl basic + + Code + erdos_renyi_game_gnp_impl(n = 5, p = 0.5) + Output + IGRAPH U--- 5 7 -- + + edges: + [1] 1--2 1--3 2--3 1--4 2--4 1--5 4--5 + +--- + + Code + erdos_renyi_game_gnp_impl(n = 5, p = 0.5, directed = TRUE, loops = TRUE) + Output + IGRAPH D--- 5 12 -- + + edges: + [1] 2->1 3->1 4->1 2->2 1->3 2->3 4->3 1->4 2->4 5->4 3->5 4->5 + +# erdos_renyi_game_gnp_impl errors + + Code + erdos_renyi_game_gnp_impl(n = -1, p = 0.5) + Condition + Error in `erdos_renyi_game_gnp_impl()`: + ! At vendor/cigraph/src/games/erdos_renyi.c:xx : Invalid number of vertices. Invalid value + +# erdos_renyi_game_gnm_impl basic + + Code + erdos_renyi_game_gnm_impl(n = 5, m = 3) + Output + IGRAPH U--- 5 3 -- + + edges: + [1] 3--4 2--5 4--5 + +--- + + Code + erdos_renyi_game_gnm_impl(n = 5, m = 3, directed = TRUE, loops = TRUE) + Output + IGRAPH D--- 5 3 -- + + edges: + [1] 4->3 5->3 3->5 + +# erdos_renyi_game_gnm_impl errors + + Code + erdos_renyi_game_gnm_impl(n = -1, m = 3) + Condition + Error in `erdos_renyi_game_gnm_impl()`: + ! At vendor/cigraph/src/games/erdos_renyi.c:xx : Invalid number of vertices. Invalid value + +# growing_random_game_impl basic + + Code + growing_random_game_impl(n = 5, m = 2) + Output + IGRAPH D--- 5 8 -- Growing random graph + + attr: name (g/c), m (g/n), citation (g/l) + + edges: + [1] 2->2 1->2 3->3 3->3 3->3 1->2 2->2 5->4 + +--- + + Code + growing_random_game_impl(n = 5, m = 2, directed = FALSE, citation = TRUE) + Output + IGRAPH U--- 5 8 -- Growing random graph + + attr: name (g/c), m (g/n), citation (g/l) + + edges: + [1] 1--2 1--2 2--3 1--3 1--4 2--4 1--5 4--5 + +--- + + Code + growing_random_game_impl(n = 10, m = 1, directed = TRUE, citation = FALSE) + Output + IGRAPH D--- 10 9 -- Growing random graph + + attr: name (g/c), m (g/n), citation (g/l) + + edges: + [1] 2->2 2->3 4->4 4->4 3->2 1->3 1->8 5->6 5->4 + +# growing_random_game_impl errors + + Code + growing_random_game_impl(n = -1, m = 2) + Condition + Error in `growing_random_game_impl()`: + ! At vendor/cigraph/src/games/growing_random.c:xx : Invalid number of vertices. Invalid value + +# preference_game_impl basic + + Code + preference_game_impl(nodes = 5, types = 2, type_dist = c(0.5, 0.5), + fixed_sizes = FALSE, pref_matrix = matrix(c(0.5, 0.5, 0.5, 0.5), 2, 2)) + Output + $graph + IGRAPH U--- 5 4 -- + + edges: + [1] 1--3 3--4 1--4 1--5 + + $node_type_vec + [1] 1 0 0 1 1 + + +# preference_game_impl errors + + Code + preference_game_impl(nodes = -1, types = 2, type_dist = c(0.5, 0.5), + fixed_sizes = FALSE, pref_matrix = matrix(c(0.5, 0.5, 0.5, 0.5), 2, 2)) + Condition + Error in `preference_game_impl()`: + ! At vendor/cigraph/src/games/preference.c:xx : The number of vertices must be non-negative. Invalid value + +# asymmetric_preference_game_impl basic + + Code + asymmetric_preference_game_impl(nodes = 5, out_types = 2, in_types = 2, + type_dist_matrix = matrix(c(0.5, 0.5, 0.5, 0.5), 2, 2), pref_matrix = matrix( + c(0.5, 0.5, 0.5, 0.5), 2, 2)) + Output + $graph + IGRAPH D--- 5 9 -- + + edges: + [1] 2->4 4->2 5->2 1->3 4->3 4->5 3->1 1->4 1->5 + + $node_type_out_vec + [1] 1 0 1 1 1 + + $node_type_in_vec + [1] 1 0 0 1 1 + + +# asymmetric_preference_game_impl errors + + Code + asymmetric_preference_game_impl(nodes = -1, out_types = 2, in_types = 2, + type_dist_matrix = matrix(c(0.5, 0.5, 0.5, 0.5), 2, 2), pref_matrix = matrix( + c(0.5, 0.5, 0.5, 0.5), 2, 2)) + Condition + Error in `asymmetric_preference_game_impl()`: + ! At vendor/cigraph/src/games/preference.c:xx : The number of vertices must not be negative. Invalid value + +# rewire_edges_impl basic + + Code + rewire_edges_impl(graph = g, prob = 0.5) + Output + IGRAPH U--- 5 4 -- + + edges: + [1] 2--4 3--4 1--3 2--5 + +# rewire_edges_impl errors + + Code + rewire_edges_impl(graph = NULL, prob = 0.5) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# rewire_directed_edges_impl basic + + Code + rewire_directed_edges_impl(graph = g, prob = 0.5) + Output + IGRAPH D--- 5 4 -- + + edges: + [1] 1->4 2->3 3->2 4->5 + +# rewire_directed_edges_impl errors + + Code + rewire_directed_edges_impl(graph = NULL, prob = 0.5) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# forest_fire_game_impl basic + + Code + forest_fire_game_impl(nodes = 5, fw_prob = 0.5) + Output + IGRAPH D--- 5 9 -- Forest fire model + + attr: name (g/c), fw_prob (g/n), bw_factor (g/n), ambs (g/n) + + edges: + [1] 2->1 3->2 4->2 4->1 4->3 5->1 5->2 5->4 5->3 + +--- + + Code + forest_fire_game_impl(nodes = 5, fw_prob = 0.5, bw_factor = 0.2, ambs = 2, + directed = FALSE) + Output + IGRAPH U--- 5 4 -- Forest fire model + + attr: name (g/c), fw_prob (g/n), bw_factor (g/n), ambs (g/n) + + edges: + [1] 1--2 1--3 1--4 4--5 + +# forest_fire_game_impl errors + + Code + forest_fire_game_impl(nodes = -1, fw_prob = 0.5) + Condition + Error in `forest_fire_game_impl()`: + ! At vendor/cigraph/src/games/forestfire.c:xx : Insufficient memory for forest fire model. Out of memory + +# simple_interconnected_islands_game_impl basic + + Code + simple_interconnected_islands_game_impl(islands_n = 2, islands_size = 3, + islands_pin = 0.5, n_inter = 1) + Output + IGRAPH U--- 6 5 -- Interconnected islands model + + attr: name (g/c), islands_n (g/n), islands_size (g/n), islands_pin + | (g/n), n_inter (g/n) + + edges: + [1] 1--2 1--3 2--3 3--6 5--6 + +# simple_interconnected_islands_game_impl errors + + Code + simple_interconnected_islands_game_impl(islands_n = -1, islands_size = 3, + islands_pin = 0.5, n_inter = 1) + Condition + Error in `simple_interconnected_islands_game_impl()`: + ! At vendor/cigraph/src/games/islands.c:xx : Number of islands cannot be negative, got -1. Invalid value + +# chung_lu_game_impl basic + + Code + chung_lu_game_impl(out_weights = c(2, 2, 2)) + Output + IGRAPH U--- 3 5 -- Chung-Lu model + + attr: name (g/c), variant (g/n) + + edges: + [1] 1--2 1--3 2--2 2--3 3--3 + +--- + + Code + chung_lu_game_impl(out_weights = c(1, 2, 3), in_weights = c(1, 2, 3), loops = FALSE, + variant = "maxent") + Output + IGRAPH D--- 3 1 -- Chung-Lu model + + attr: name (g/c), variant (g/n) + + edge: + [1] 3->1 + +# chung_lu_game_impl errors + + Code + chung_lu_game_impl(out_weights = -1) + Condition + Error in `chung_lu_game_impl()`: + ! At vendor/cigraph/src/games/chung_lu.c:xx : Vertex weights must not be negative in Chung-Lu model, got -1. Invalid value + +# static_fitness_game_impl basic + + Code + static_fitness_game_impl(no_of_edges = 3, fitness_out = c(1, 2, 3)) + Output + IGRAPH U--- 3 3 -- Static fitness model + + attr: name (g/c), loops (g/l), multiple (g/l) + + edges: + [1] 1--2 1--3 2--3 + +--- + + Code + static_fitness_game_impl(no_of_edges = 3, fitness_out = c(1, 2, 3), fitness_in = c( + 1, 2, 3), loops = TRUE, multiple = TRUE) + Output + IGRAPH D--- 3 3 -- Static fitness model + + attr: name (g/c), loops (g/l), multiple (g/l) + + edges: + [1] 1->2 2->3 1->3 + +# static_fitness_game_impl errors + + Code + static_fitness_game_impl(no_of_edges = -1, fitness_out = c(1, 2, 3)) + Condition + Error in `static_fitness_game_impl()`: + ! At vendor/cigraph/src/games/static_fitness.c:xx : Number of edges cannot be negative, got -1. Invalid value + +# static_power_law_game_impl basic + + Code + static_power_law_game_impl(no_of_nodes = 5, no_of_edges = 4, exponent_out = 2.5) + Output + IGRAPH U--- 5 4 -- Static power law model + + attr: name (g/c), exponent_out (g/n), exponent_in (g/n), loops (g/l), + | multiple (g/l), finite_size_correction (g/l) + + edges: + [1] 1--5 2--4 3--5 4--5 + +--- + + Code + static_power_law_game_impl(no_of_nodes = 5, no_of_edges = 4, exponent_out = 2.5, + exponent_in = 2, loops = TRUE, multiple = TRUE, finite_size_correction = FALSE) + Output + IGRAPH D--- 5 4 -- Static power law model + + attr: name (g/c), exponent_out (g/n), exponent_in (g/n), loops (g/l), + | multiple (g/l), finite_size_correction (g/l) + + edges: + [1] 1->1 3->5 1->4 5->1 + +# static_power_law_game_impl errors + + Code + static_power_law_game_impl(no_of_nodes = -1, no_of_edges = 4, exponent_out = 2.5) + Condition + Error in `static_power_law_game_impl()`: + ! At vendor/cigraph/src/games/static_fitness.c:xx : Number of nodes cannot be negative, got -1. Invalid value + +# k_regular_game_impl basic + + Code + k_regular_game_impl(no_of_nodes = 5, k = 2) + Output + IGRAPH U--- 5 5 -- k-regular graph + + attr: name (g/c), k (g/n) + + edges: + [1] 1--3 1--5 2--3 2--4 4--5 + +--- + + Code + k_regular_game_impl(no_of_nodes = 5, k = 2, directed = TRUE, multiple = TRUE) + Output + IGRAPH D--- 5 10 -- k-regular graph + + attr: name (g/c), k (g/n) + + edges: + [1] 3->4 3->3 2->1 5->5 1->5 4->3 5->2 4->1 1->2 2->4 + +# k_regular_game_impl errors + + Code + k_regular_game_impl(no_of_nodes = -1, k = 2) + Condition + Error in `k_regular_game_impl()`: + ! At vendor/cigraph/src/games/k_regular.c:xx : Number of nodes must be non-negative. Invalid value + +# sbm_game_impl basic + + Code + sbm_game_impl(n = 5, pref_matrix = matrix(0.5, 2, 2), block_sizes = c(2, 3)) + Output + IGRAPH U--- 5 6 -- Stochastic block model + + attr: name (g/c), loops (g/l) + + edges: + [1] 1--2 1--3 2--3 1--4 1--5 3--5 + +--- + + Code + sbm_game_impl(n = 5, pref_matrix = matrix(0.5, 2, 2), block_sizes = c(2, 3), + directed = TRUE, loops = TRUE) + Output + IGRAPH D--- 5 14 -- Stochastic block model + + attr: name (g/c), loops (g/l) + + edges: + [1] 1->1 2->1 2->4 1->5 4->1 5->1 5->2 3->3 5->3 3->4 4->4 5->4 3->5 5->5 + +# sbm_game_impl errors + + Code + sbm_game_impl(n = -1, pref_matrix = matrix(0.5, 2, 2), block_sizes = c(2, 3)) + Condition + Error in `sbm_game_impl()`: + ! At vendor/cigraph/src/games/sbm.c:xx : Sum of the block sizes (5) must equal the number of vertices (-1). Invalid value + +# hsbm_game_impl basic + + Code + hsbm_game_impl(n = 6, m = 2, rho = c(0.5, 0.5), C = matrix(1, 2, 2), p = 0.5) + Output + IGRAPH U--- 6 9 -- Hierarchical stochastic block model + + attr: name (g/c), m (g/n), rho (g/n), C (g/n), p (g/n) + + edges: + [1] 1--2 3--4 5--6 1--4 1--5 2--5 1--6 4--5 3--6 + +# hsbm_game_impl errors + + Code + hsbm_game_impl(n = -1, m = 2, rho = 0.5, C = matrix(1, 2, 2), p = 0.5) + Condition + Error in `hsbm_game_impl()`: + ! At vendor/cigraph/src/games/sbm.c:xx : `n' must be positive for HSBM, Invalid value + +# hsbm_list_game_impl basic + + Code + hsbm_list_game_impl(n = 100, mlist = list(50, 50), rholist = list(c(3, 3, 4) / + 10), Clist = list(C), p = 1 / 20) + Output + IGRAPH U--- 100 783 -- Hierarchical stochastic block model + + attr: name (g/c), p (g/n) + + edges: + [1] 1-- 2 1-- 3 2-- 3 1-- 4 2-- 4 3-- 4 1-- 5 2-- 5 3-- 5 4-- 5 + [11] 1-- 6 2-- 6 3-- 6 4-- 6 5-- 6 1-- 7 2-- 7 3-- 7 4-- 7 5-- 7 + [21] 6-- 7 1-- 8 2-- 8 3-- 8 4-- 8 5-- 8 6-- 8 7-- 8 1-- 9 2-- 9 + [31] 3-- 9 4-- 9 5-- 9 6-- 9 7-- 9 8-- 9 1--10 2--10 3--10 4--10 + [41] 5--10 6--10 7--10 8--10 9--10 1--11 2--11 3--11 4--11 5--11 + [51] 6--11 7--11 8--11 9--11 10--11 1--12 2--12 3--12 4--12 5--12 + [61] 6--12 7--12 8--12 9--12 10--12 11--12 1--13 2--13 3--13 4--13 + [71] 5--13 6--13 7--13 8--13 9--13 10--13 11--13 12--13 1--14 2--14 + + ... omitted several edges + +# hsbm_list_game_impl errors + + Code + hsbm_list_game_impl(n = -1, mlist = c(2, 3), rholist = list(0.5, 0.5), Clist = list( + matrix(1, 2, 2), matrix(1, 2, 2)), p = 0.5) + Condition + Error in `hsbm_list_game_impl()`: + ! At vendor/cigraph/src/games/sbm.c:xx : `n' must be positive for HSBM. Invalid value + +# correlated_game_impl basic + + Code + correlated_game_impl(old_graph = g, corr = 0.5) + Output + IGRAPH U--- 5 3 -- Correlated random graph + + attr: name (g/c), corr (g/n), p (g/n) + + edges: + [1] 1--3 3--4 2--5 + +# correlated_game_impl errors + + Code + correlated_game_impl(old_graph = NULL, corr = 0.5) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# correlated_pair_game_impl basic + + Code + correlated_pair_game_impl(n = 5, corr = 0.5, p = 0.5) + Output + $graph1 + IGRAPH U--- 5 7 -- + + edges: + [1] 1--2 1--3 2--3 1--4 2--4 1--5 4--5 + + $graph2 + IGRAPH U--- 5 7 -- + + edges: + [1] 1--2 1--3 2--3 1--4 2--4 1--5 3--5 + + +--- + + Code + correlated_pair_game_impl(n = 5, corr = 0.5, p = 0.5, directed = TRUE) + Output + $graph1 + IGRAPH D--- 5 10 -- + + edges: + [1] 4->1 5->1 2->5 4->2 5->2 3->5 1->4 2->4 4->5 5->4 + + $graph2 + IGRAPH D--- 5 9 -- + + edges: + [1] 1->5 2->1 2->5 4->2 4->3 1->4 2->4 4->5 5->4 + + +# correlated_pair_game_impl errors + + Code + correlated_pair_game_impl(n = -1, corr = 0.5, p = 0.5) + Condition + Error in `correlated_pair_game_impl()`: + ! At vendor/cigraph/src/games/erdos_renyi.c:xx : Invalid number of vertices. Invalid value + +# dot_product_game_impl basic + + Code + dot_product_game_impl(vecs = matrix(0.5, 5, 2)) + Condition + Warning in `dot_product_game_impl()`: + At vendor/cigraph/src/games/dotproduct.c:90 : Greater than 1 connection probability in dot-product graph. + Output + IGRAPH U--- 2 1 -- + + edge: + [1] 1--2 + +--- + + Code + dot_product_game_impl(vecs = matrix(0.5, 5, 2), directed = TRUE) + Condition + Warning in `dot_product_game_impl()`: + At vendor/cigraph/src/games/dotproduct.c:90 : Greater than 1 connection probability in dot-product graph. + Output + IGRAPH D--- 2 2 -- + + edges: + [1] 1->2 2->1 + +# dot_product_game_impl errors + + Code + dot_product_game_impl(vecs = NULL) + Condition + Error in `dot_product_game_impl()`: + ! REAL() can only be applied to a 'numeric', not a 'NULL' + +# sample_sphere_surface_impl basic + + Code + sample_sphere_surface_impl(dim = 3, n = 5) + Output + [,1] [,2] [,3] [,4] [,5] + [1,] 0.87877523 0.8206548 0.1430028 0.6349227 0.99933629 + [2,] 0.05165973 0.5261159 0.1145481 0.2979741 0.02649327 + [3,] 0.47443162 0.2229974 0.9830712 0.7128005 0.02500179 + +--- + + Code + sample_sphere_surface_impl(dim = 3, n = 5, radius = 2, positive = FALSE) + Output + [,1] [,2] [,3] [,4] [,5] + [1,] -0.4904253 -1.4825368 -0.5141332 1.95644246 0.369407 + [2,] -1.6787252 1.1329528 -0.7872709 -0.41498660 1.953509 + [3,] -0.9702395 0.7200713 1.7651832 -0.01090904 0.217584 + +# sample_sphere_surface_impl errors + + Code + sample_sphere_surface_impl(dim = -1, n = 5) + Condition + Error in `sample_sphere_surface_impl()`: + ! At vendor/cigraph/src/games/dotproduct.c:xx : Sphere must be at least two dimensional to sample from surface. Invalid value + +# sample_sphere_volume_impl basic + + Code + sample_sphere_volume_impl(dim = 3, n = 5) + Output + [,1] [,2] [,3] [,4] [,5] + [1,] 0.67165090 0.6105364 0.09806950 0.4132698 0.73325518 + [2,] 0.03948371 0.3914105 0.07855561 0.1939507 0.01943923 + [3,] 0.36260970 0.1659017 0.67417787 0.4639603 0.01834487 + +--- + + Code + sample_sphere_volume_impl(dim = 3, n = 5, radius = 2, positive = FALSE) + Output + [,1] [,2] [,3] [,4] [,5] + [1,] 1.903629152 -1.3795904 -1.2061886 0.9035986 -1.1692436 + [2,] -0.159619927 0.2402815 -0.1258477 0.1842403 -1.4940836 + [3,] 0.003829883 1.2440192 0.6204597 1.5776103 0.4096058 + +# sample_sphere_volume_impl errors + + Code + sample_sphere_volume_impl(dim = -1, n = 5) + Condition + Error in `sample_sphere_volume_impl()`: + ! At vendor/cigraph/src/games/dotproduct.c:xx : Sphere must be at least two dimensional to sample from surface. Invalid value + +# sample_dirichlet_impl basic + + Code + sample_dirichlet_impl(n = 5, alpha = c(1, 1, 1)) + Output + [,1] [,2] [,3] [,4] [,5] + [1,] 0.6298008 0.4168413 0.29594281 0.2432340 0.1516815 + [2,] 0.1093984 0.3461600 0.08924333 0.4251328 0.3561426 + [3,] 0.2608008 0.2369988 0.61481386 0.3316331 0.4921759 + +# sample_dirichlet_impl errors + + Code + sample_dirichlet_impl(n = -1, alpha = c(1, 1, 1)) + Condition + Error in `sample_dirichlet_impl()`: + ! At vendor/cigraph/src/games/dotproduct.c:xx : Number of samples should be non-negative, got -1. Invalid value + +# are_adjacent_impl basic + + Code + are_adjacent_impl(graph = g, v1 = 1, v2 = 2) + Output + [1] TRUE + +# are_adjacent_impl errors + + Code + are_adjacent_impl(graph = NULL, v1 = 1, v2 = 2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# closeness_impl basic + + Code + closeness_impl(graph = g) + Output + $res + [1] 0.3333333 0.5000000 0.3333333 + + $reachable_count + [1] 2 2 2 + + $all_reachable + [1] TRUE + + +--- + + Code + closeness_impl(graph = g, mode = "in", normalized = TRUE) + Output + $res + [1] 0.6666667 1.0000000 0.6666667 + + $reachable_count + [1] 2 2 2 + + $all_reachable + [1] TRUE + + +--- + + Code + closeness_impl(graph = g, vids = V(g), mode = c("out", "in", "all", "total")) + Output + $res + [1] 0.1666667 0.1666667 0.1666667 0.1666667 0.1666667 + + $reachable_count + [1] 4 4 4 4 4 + + $all_reachable + [1] TRUE + + +# closeness_impl errors + + Code + closeness_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# closeness_cutoff_impl basic + + Code + closeness_cutoff_impl(graph = g, cutoff = 2) + Output + $res + [1] 0.3333333 0.5000000 0.3333333 + + $reachable_count + [1] 2 2 2 + + $all_reachable + [1] TRUE + + +--- + + Code + closeness_cutoff_impl(graph = g, mode = "in", normalized = TRUE, cutoff = 1) + Output + $res + [1] 1 1 1 + + $reachable_count + [1] 1 2 1 + + $all_reachable + [1] FALSE + + +# closeness_cutoff_impl errors + + Code + closeness_cutoff_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# get_shortest_path_impl basic + + Code + get_shortest_path_impl(graph = g, from = 1, to = 3) + Output + $vertices + + 3/3 vertices: + [1] 1 2 3 + + $edges + + 2/2 edges: + [1] 1--2 2--3 + + +# get_shortest_path_impl errors + + Code + get_shortest_path_impl(graph = NULL, from = 1, to = 3) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# get_shortest_path_bellman_ford_impl basic + + Code + get_shortest_path_bellman_ford_impl(graph = g, from = 1, to = 3) + Output + $vertices + + 3/3 vertices: + [1] 1 2 3 + + $edges + + 2/2 edges: + [1] 1--2 2--3 + + +# get_shortest_path_bellman_ford_impl errors + + Code + get_shortest_path_bellman_ford_impl(graph = NULL, from = 1, to = 3) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# get_shortest_path_dijkstra_impl basic + + Code + get_shortest_path_dijkstra_impl(graph = g, from = 1, to = 3) + Output + $vertices + + 3/3 vertices: + [1] 1 2 3 + + $edges + + 2/2 edges: + [1] 1--2 2--3 + + +# get_shortest_path_dijkstra_impl errors + + Code + get_shortest_path_dijkstra_impl(graph = NULL, from = 1, to = 3) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# get_all_shortest_paths_impl basic + + Code + get_all_shortest_paths_impl(graph = g, from = 1, to = 3) + Output + $vpaths + $vpaths[[1]] + + 3/3 vertices: + [1] 1 2 3 + + + $epaths + $epaths[[1]] + + 2/2 edges: + [1] 1--2 2--3 + + + $nrgeo + [1] 1 1 1 + + +# get_all_shortest_paths_impl errors + + Code + get_all_shortest_paths_impl(graph = NULL, from = 1, to = 3) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# get_all_shortest_paths_dijkstra_impl basic + + Code + get_all_shortest_paths_dijkstra_impl(graph = g, from = 1, to = 3) + Output + $vpaths + $vpaths[[1]] + + 3/3 vertices: + [1] 1 2 3 + + + $epaths + $epaths[[1]] + + 2/2 edges: + [1] 1--2 2--3 + + + $nrgeo + [1] 1 1 1 + + +# get_all_shortest_paths_dijkstra_impl errors + + Code + get_all_shortest_paths_dijkstra_impl(graph = NULL, from = 1, to = 3) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# voronoi_impl basic + + Code + voronoi_impl(graph = g, generators = 1) + Output + $membership + [1] 0 0 0 + + $distances + [1] 0 1 2 + + +--- + + Code + voronoi_impl(graph = g, generators = 1, mode = "in", tiebreaker = "first") + Output + $membership + [1] 0 0 0 + + $distances + [1] 0 1 2 + + +--- + + Code + voronoi_impl(graph = g, generators = c(1, 5), mode = c("out", "in", "all")) + Output + $membership + [1] 0 0 0 1 1 1 1 1 0 0 + + $distances + [1] 0 1 2 1 0 1 2 3 2 1 + + +# voronoi_impl errors + + Code + voronoi_impl(graph = NULL, generators = 1) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# get_all_simple_paths_impl basic + + Code + get_all_simple_paths_impl(graph = g, from = 1, to = 3) + Output + + 3/3 vertices: + [1] 1 2 3 + +# get_all_simple_paths_impl errors + + Code + get_all_simple_paths_impl(graph = NULL, from = 1, to = 3) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# get_k_shortest_paths_impl basic + + Code + get_k_shortest_paths_impl(graph = g, from = 1, to = 3, k = 2) + Output + $vpaths + $vpaths[[1]] + + 3/3 vertices: + [1] 1 2 3 + + + $epaths + $epaths[[1]] + + 2/2 edges: + [1] 1--2 2--3 + + + +# get_k_shortest_paths_impl errors + + Code + get_k_shortest_paths_impl(graph = NULL, from = 1, to = 3, k = 2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# get_widest_path_impl basic + + Code + get_widest_path_impl(graph = g, from = 1, to = 3, weights = c(1, 2)) + Output + $vertices + + 3/3 vertices: + [1] 1 2 3 + + $edges + + 2/2 edges: + [1] 1--2 2--3 + + +# get_widest_path_impl errors + + Code + get_widest_path_impl(graph = NULL, from = 1, to = 3) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# get_widest_paths_impl basic + + Code + get_widest_paths_impl(graph = g, from = 1, to = 3, weights = c(1, 2)) + Output + $vertices + $vertices[[1]] + + 3/3 vertices: + [1] 1 2 3 + + + $edges + $edges[[1]] + + 2/2 edges: + [1] 1--2 2--3 + + + $parents + [1] -1 0 1 + + $inbound_edges + [1] -1 0 1 + + +# get_widest_paths_impl errors + + Code + get_widest_paths_impl(graph = NULL, from = 1, to = 3) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# spanner_impl basic + + Code + spanner_impl(graph = g, stretch = 2) + Output + + 2/2 edges: + [1] 1--2 2--3 + +--- + + Code + spanner_impl(graph = g, stretch = 2) + Output + + 5/5 edges: + [1] 1--2 2--3 3--4 4--5 1--5 + +# spanner_impl errors + + Code + spanner_impl(graph = NULL, stretch = 2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# betweenness_cutoff_impl basic + + Code + betweenness_cutoff_impl(graph = g, cutoff = 2) + Output + [1] 0 1 0 + +# betweenness_cutoff_impl errors + + Code + betweenness_cutoff_impl(graph = NULL, cutoff = 2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# betweenness_subset_impl basic + + Code + betweenness_subset_impl(graph = g) + Output + [1] 0 1 0 + +# betweenness_subset_impl errors + + Code + betweenness_subset_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# edge_betweenness_impl basic + + Code + edge_betweenness_impl(graph = g) + Output + [1] 2 2 + +--- + + Code + edge_betweenness_impl(graph = g, directed = FALSE) + Output + [1] 4 4 4 4 + +# edge_betweenness_impl errors + + Code + edge_betweenness_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# edge_betweenness_cutoff_impl basic + + Code + edge_betweenness_cutoff_impl(graph = g, cutoff = 2) + Output + [1] 2 2 + +# edge_betweenness_cutoff_impl errors + + Code + edge_betweenness_cutoff_impl(graph = NULL, cutoff = 2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# edge_betweenness_subset_impl basic + + Code + edge_betweenness_subset_impl(graph = g) + Output + [1] 2 2 + +# edge_betweenness_subset_impl errors + + Code + edge_betweenness_subset_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# harmonic_centrality_cutoff_impl basic + + Code + harmonic_centrality_cutoff_impl(graph = g, cutoff = 2) + Output + [1] 1.5 2.0 1.5 + +# harmonic_centrality_cutoff_impl errors + + Code + harmonic_centrality_cutoff_impl(graph = NULL, cutoff = 2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# personalized_pagerank_impl basic + + Code + personalized_pagerank_impl(graph = g) + Output + $vector + [1] 0.2567568 0.4864865 0.2567568 + + $value + [1] 1 + + $options + NULL + + +--- + + Code + personalized_pagerank_impl(graph = g, algo = "arpack", damping = 0.9) + Output + $vector + [1] 0.2543860 0.4912281 0.2543860 + + $value + [1] 1 + + $options + $options$bmat + [1] "I" + + $options$n + [1] 3 + + $options$which + [1] "LR" + + $options$nev + [1] 1 + + $options$tol + [1] 0 + + $options$ncv + [1] 0 + + $options$ldv + [1] 0 + + $options$ishift + [1] 1 + + $options$maxiter + [1] 3000 + + $options$nb + [1] 1 + + $options$mode + [1] 1 + + $options$start + [1] 1 + + $options$sigma + [1] 0 + + $options$sigmai + [1] 0 + + $options$info + [1] 0 + + $options$iter + [1] 1 + + $options$nconv + [1] 1 + + $options$numop + [1] 3 + + $options$numopb + [1] 0 + + $options$numreo + [1] 3 + + + +# personalized_pagerank_impl errors + + Code + personalized_pagerank_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# personalized_pagerank_vs_impl basic + + Code + personalized_pagerank_vs_impl(graph = g, reset_vids = 1) + Output + [1] 0.3452703 0.4594595 0.1952703 + +--- + + Code + personalized_pagerank_vs_impl(graph = g, algo = "arpack", reset_vids = 1, + details = TRUE) + Output + $vector + [1] 0.3452703 0.4594595 0.1952703 + + $value + [1] 1 + + $options + $options$bmat + [1] "I" + + $options$n + [1] 3 + + $options$which + [1] "LR" + + $options$nev + [1] 1 + + $options$tol + [1] 0 + + $options$ncv + [1] 0 + + $options$ldv + [1] 0 + + $options$ishift + [1] 1 + + $options$maxiter + [1] 3000 + + $options$nb + [1] 1 + + $options$mode + [1] 1 + + $options$start + [1] 1 + + $options$sigma + [1] 0 + + $options$sigmai + [1] 0 + + $options$info + [1] 0 + + $options$iter + [1] 1 + + $options$nconv + [1] 1 + + $options$numop + [1] 3 + + $options$numopb + [1] 0 + + $options$numreo + [1] 3 + + + +# personalized_pagerank_vs_impl errors + + Code + personalized_pagerank_vs_impl(graph = NULL, reset_vids = 1) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# induced_subgraph_impl basic + + Code + induced_subgraph_impl(graph = g, vids = 1:2) + Output + IGRAPH U--- 2 1 -- + + edge: + [1] 1--2 + +# induced_subgraph_impl errors + + Code + induced_subgraph_impl(graph = NULL, vids = 1:2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# subgraph_from_edges_impl basic + + Code + subgraph_from_edges_impl(graph = g, eids = 1) + Output + IGRAPH U--- 2 1 -- + + edge: + [1] 1--2 + +# subgraph_from_edges_impl errors + + Code + subgraph_from_edges_impl(graph = NULL, eids = 1) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# reverse_edges_impl basic + + Code + reverse_edges_impl(graph = g) + Output + IGRAPH U--- 3 2 -- + + edges: + [1] 1--2 2--3 + +# reverse_edges_impl errors + + Code + reverse_edges_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# path_length_hist_impl basic + + Code + path_length_hist_impl(graph = g) + Output + $res + [1] 2 1 + + $unconnected + [1] 0 + + +--- + + Code + path_length_hist_impl(graph = g, directed = FALSE) + Output + $res + [1] 2 1 + + $unconnected + [1] 0 + + +# path_length_hist_impl errors + + Code + path_length_hist_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# simplify_impl basic + + Code + simplify_impl(graph = g) + Output + IGRAPH U--- 3 2 -- + + edges: + [1] 1--2 2--3 + +--- + + Code + simplify_impl(graph = g, remove_multiple = FALSE, remove_loops = FALSE) + Output + IGRAPH U--- 3 2 -- + + edges: + [1] 1--2 2--3 + +# simplify_impl errors + + Code + simplify_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# transitivity_undirected_impl basic + + Code + transitivity_undirected_impl(graph = g) + Output + [1] 0 + +--- + + Code + transitivity_undirected_impl(graph = g, mode = "zero") + Output + [1] 0 + +# transitivity_undirected_impl errors + + Code + transitivity_undirected_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# transitivity_local_undirected_impl basic + + Code + transitivity_local_undirected_impl(graph = g) + Output + [1] NaN 0 NaN + +--- + + Code + transitivity_local_undirected_impl(graph = g, mode = "zero") + Output + [1] 0 0 0 + +# transitivity_local_undirected_impl errors + + Code + transitivity_local_undirected_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# transitivity_avglocal_undirected_impl basic + + Code + transitivity_avglocal_undirected_impl(graph = g) + Output + [1] 0 + +--- + + Code + transitivity_avglocal_undirected_impl(graph = g, mode = "zero") + Output + [1] 0 + +# transitivity_avglocal_undirected_impl errors + + Code + transitivity_avglocal_undirected_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# transitivity_barrat_impl basic + + Code + transitivity_barrat_impl(graph = g) + Condition + Warning in `transitivity_barrat_impl()`: + At vendor/cigraph/src/properties/triangles.c:913 : No weights given for Barrat's transitivity, unweighted version is used. + Output + [1] NaN 0 NaN + +--- + + Code + transitivity_barrat_impl(graph = g, mode = "zero") + Condition + Warning in `transitivity_barrat_impl()`: + At vendor/cigraph/src/properties/triangles.c:913 : No weights given for Barrat's transitivity, unweighted version is used. + Output + [1] 0 0 0 + +# transitivity_barrat_impl errors + + Code + transitivity_barrat_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# ecc_impl basic + + Code + ecc_impl(graph = g) + Output + [1] NaN 0 NaN + +--- + + Code + ecc_impl(graph = g, k = 3, offset = TRUE, normalize = FALSE) + Output + [1] 1 1 1 + +# ecc_impl errors + + Code + ecc_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# reciprocity_impl basic + + Code + reciprocity_impl(graph = g) + Output + [1] 1 + +--- + + Code + reciprocity_impl(graph = g, ignore_loops = FALSE, mode = "ratio") + Output + [1] 1 + +# reciprocity_impl errors + + Code + reciprocity_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# maxdegree_impl basic + + Code + maxdegree_impl(graph = g) + Output + [1] 2 + +--- + + Code + maxdegree_impl(graph = g, mode = "in", loops = FALSE) + Output + [1] 2 + +# maxdegree_impl errors + + Code + maxdegree_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# density_impl basic + + Code + density_impl(graph = g) + Output + [1] 0.6666667 + +--- + + Code + density_impl(graph = g, loops = TRUE) + Output + [1] 0.3333333 + +# density_impl errors + + Code + density_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# mean_degree_impl basic + + Code + mean_degree_impl(graph = g) + Output + [1] 1.333333 + +--- + + Code + mean_degree_impl(graph = g, loops = FALSE) + Output + [1] 1.333333 + +# mean_degree_impl errors + + Code + mean_degree_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# feedback_arc_set_impl basic + + Code + feedback_arc_set_impl(graph = g) + Output + + 0/2 edges: + +--- + + Code + feedback_arc_set_impl(graph = g, algo = "exact_ip") + Output + + 0/2 edges: + +# feedback_arc_set_impl errors + + Code + feedback_arc_set_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# feedback_vertex_set_impl basic + + Code + feedback_vertex_set_impl(graph = g) + Output + + 0/3 vertices: + +# feedback_vertex_set_impl errors + + Code + feedback_vertex_set_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# is_loop_impl basic + + Code + is_loop_impl(graph = g) + Output + [1] FALSE FALSE + +# is_loop_impl errors + + Code + is_loop_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# is_dag_impl basic + + Code + is_dag_impl(graph = g) + Output + [1] FALSE + +# is_dag_impl errors + + Code + is_dag_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# is_acyclic_impl basic + + Code + is_acyclic_impl(graph = g) + Output + [1] TRUE + +# is_acyclic_impl errors + + Code + is_acyclic_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# is_simple_impl basic + + Code + is_simple_impl(graph = g) + Output + [1] TRUE + +# is_simple_impl errors + + Code + is_simple_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# is_multiple_impl basic + + Code + is_multiple_impl(graph = g) + Output + [1] FALSE FALSE + +# is_multiple_impl errors + + Code + is_multiple_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# has_loop_impl basic + + Code + has_loop_impl(graph = g) + Output + [1] FALSE + +# has_loop_impl errors + + Code + has_loop_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# has_multiple_impl basic + + Code + has_multiple_impl(graph = g) + Output + [1] FALSE + +# has_multiple_impl errors + + Code + has_multiple_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# count_loops_impl basic + + Code + count_loops_impl(graph = g) + Output + [1] 0 + +# count_loops_impl errors + + Code + count_loops_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# count_multiple_impl basic + + Code + count_multiple_impl(graph = g) + Output + [1] 1 1 + +# count_multiple_impl errors + + Code + count_multiple_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# is_perfect_impl basic + + Code + is_perfect_impl(graph = g) + Output + [1] TRUE + +# is_perfect_impl errors + + Code + is_perfect_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# eigenvector_centrality_impl basic + + Code + eigenvector_centrality_impl(graph = g) + Output + $vector + [1] 0.7071068 1.0000000 0.7071068 + + $value + [1] 1.414214 + + $options + $options$bmat + [1] "I" + + $options$n + [1] 3 + + $options$which + [1] "LA" + + $options$nev + [1] 1 + + $options$tol + [1] 0 + + $options$ncv + [1] 0 + + $options$ldv + [1] 0 + + $options$ishift + [1] 1 + + $options$maxiter + [1] 3000 + + $options$nb + [1] 1 + + $options$mode + [1] 1 + + $options$start + [1] 1 + + $options$sigma + [1] 0 + + $options$sigmai + [1] 0 + + $options$info + [1] 0 + + $options$iter + [1] 1 + + $options$nconv + [1] 1 + + $options$numop + [1] 3 + + $options$numopb + [1] 0 + + $options$numreo + [1] 3 + + + +--- + + Code + eigenvector_centrality_impl(graph = g, directed = TRUE, scale = FALSE) + Output + $vector + [1] 0.5000000 0.7071068 0.5000000 + + $value + [1] 1.414214 + + $options + $options$bmat + [1] "I" + + $options$n + [1] 3 + + $options$which + [1] "LA" + + $options$nev + [1] 1 + + $options$tol + [1] 0 + + $options$ncv + [1] 0 + + $options$ldv + [1] 0 + + $options$ishift + [1] 1 + + $options$maxiter + [1] 3000 + + $options$nb + [1] 1 + + $options$mode + [1] 1 + + $options$start + [1] 1 + + $options$sigma + [1] 0 + + $options$sigmai + [1] 0 + + $options$info + [1] 0 + + $options$iter + [1] 1 + + $options$nconv + [1] 1 + + $options$numop + [1] 3 + + $options$numopb + [1] 0 + + $options$numreo + [1] 3 + + + +# eigenvector_centrality_impl errors + + Code + eigenvector_centrality_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# hub_and_authority_scores_impl basic + + Code + hub_and_authority_scores_impl(graph = g) + Output + $hub + [1] 1 1 1 1 1 + + $authority + [1] 1 1 1 1 1 + + $value + [1] 16 + + $options + $options$bmat + [1] "I" + + $options$n + [1] 5 + + $options$which + [1] "LA" + + $options$nev + [1] 1 + + $options$tol + [1] 0 + + $options$ncv + [1] 0 + + $options$ldv + [1] 0 + + $options$ishift + [1] 1 + + $options$maxiter + [1] 3000 + + $options$nb + [1] 1 + + $options$mode + [1] 1 + + $options$start + [1] 1 + + $options$sigma + [1] 0 + + $options$sigmai + [1] 0 + + $options$info + [1] 0 + + $options$iter + [1] 1 + + $options$nconv + [1] 1 + + $options$numop + [1] 4 + + $options$numopb + [1] 0 + + $options$numreo + [1] 4 + + + +--- + + Code + hub_and_authority_scores_impl(graph = g, scale = FALSE) + Output + $hub + [1] 0.4472136 0.4472136 0.4472136 0.4472136 0.4472136 + + $authority + [1] 0.4472136 0.4472136 0.4472136 0.4472136 0.4472136 + + $value + [1] 16 + + $options + $options$bmat + [1] "I" + + $options$n + [1] 5 + + $options$which + [1] "LA" + + $options$nev + [1] 1 + + $options$tol + [1] 0 + + $options$ncv + [1] 0 + + $options$ldv + [1] 0 + + $options$ishift + [1] 1 + + $options$maxiter + [1] 3000 + + $options$nb + [1] 1 + + $options$mode + [1] 1 + + $options$start + [1] 1 + + $options$sigma + [1] 0 + + $options$sigmai + [1] 0 + + $options$info + [1] 0 + + $options$iter + [1] 1 + + $options$nconv + [1] 1 + + $options$numop + [1] 4 + + $options$numopb + [1] 0 + + $options$numreo + [1] 4 + + + +# hub_and_authority_scores_impl errors + + Code + hub_and_authority_scores_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# unfold_tree_impl basic + + Code + unfold_tree_impl(graph = g, roots = 1) + Output + $tree + IGRAPH U--- 3 2 -- + + edges: + [1] 1--2 2--3 + + $vertex_index + [1] 1 2 3 + + +--- + + Code + unfold_tree_impl(graph = g, mode = "in", roots = 1) + Output + $tree + IGRAPH U--- 3 2 -- + + edges: + [1] 1--2 2--3 + + $vertex_index + [1] 1 2 3 + + +# unfold_tree_impl errors + + Code + unfold_tree_impl(graph = NULL, roots = 1) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# is_mutual_impl basic + + Code + is_mutual_impl(graph = g) + Output + [1] TRUE TRUE + +--- + + Code + is_mutual_impl(graph = g, loops = FALSE) + Output + [1] TRUE TRUE + +# is_mutual_impl errors + + Code + is_mutual_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# has_mutual_impl basic + + Code + has_mutual_impl(graph = g) + Output + [1] TRUE + +--- + + Code + has_mutual_impl(graph = g, loops = FALSE) + Output + [1] TRUE + +# has_mutual_impl errors + + Code + has_mutual_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# maximum_cardinality_search_impl basic + + Code + maximum_cardinality_search_impl(graph = g) + Output + $alpha + [1] 3 2 1 + + $alpham1 + + 3/3 vertices: + [1] 3 2 1 + + +# maximum_cardinality_search_impl errors + + Code + maximum_cardinality_search_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# avg_nearest_neighbor_degree_impl basic + + Code + avg_nearest_neighbor_degree_impl(graph = g) + Output + $knn + [1] 2 1 2 + + $knnk + [1] 2 1 + + +--- + + Code + avg_nearest_neighbor_degree_impl(graph = g, mode = "in", neighbor_degree_mode = "out") + Output + $knn + [1] 2 1 2 + + $knnk + [1] 2 1 + + +# avg_nearest_neighbor_degree_impl errors + + Code + avg_nearest_neighbor_degree_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# degree_correlation_vector_impl basic + + Code + degree_correlation_vector_impl(graph = g) + Output + [1] NaN 2 1 + +--- + + Code + degree_correlation_vector_impl(graph = g, from_mode = "in", to_mode = "out", + directed_neighbors = FALSE) + Output + [1] NaN 2 1 + +# degree_correlation_vector_impl errors + + Code + degree_correlation_vector_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# rich_club_sequence_impl basic + + Code + rich_club_sequence_impl(graph = g, vertex_order = 1:3) + Output + [1] 0.6666667 1.0000000 NaN + +--- + + Code + rich_club_sequence_impl(graph = g, vertex_order = 1:3, normalized = FALSE, + loops = TRUE, directed = FALSE) + Output + [1] 2 1 0 + +# rich_club_sequence_impl errors + + Code + rich_club_sequence_impl(graph = NULL, vertex_order = 1:3) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# strength_impl basic + + Code + strength_impl(graph = g) + Output + [1] 1 2 1 + +--- + + Code + strength_impl(graph = g, mode = "in", loops = FALSE) + Output + [1] 1 2 1 + +# strength_impl errors + + Code + strength_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# centralization_impl basic + + Code + centralization_impl(scores = c(1, 2, 3)) + Output + [1] Inf + +--- + + Code + centralization_impl(scores = c(1, 2, 3), theoretical_max = 2, normalized = FALSE) + Output + [1] 3 + +# centralization_impl errors + + Code + centralization_impl(scores = package_version("1.2.3")) + Condition + Error in `centralization_impl()`: + ! 'list' object cannot be coerced to type 'double' + +# centralization_degree_impl basic + + Code + centralization_degree_impl(graph = g) + Output + $res + [1] 1 2 1 + + $centralization + [1] 0.3333333 + + $theoretical_max + [1] 6 + + +--- + + Code + centralization_degree_impl(graph = g, mode = "in", loops = FALSE, normalized = FALSE) + Output + $res + [1] 1 2 1 + + $centralization + [1] 2 + + $theoretical_max + [1] 2 + + +# centralization_degree_impl errors + + Code + centralization_degree_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# centralization_degree_tmax_impl basic + + Code + centralization_degree_tmax_impl(nodes = 3, loops = TRUE) + Output + [1] 6 + +--- + + Code + centralization_degree_tmax_impl(nodes = 3, mode = "in", loops = FALSE) + Output + [1] 4 + +# centralization_degree_tmax_impl errors + + Code + centralization_degree_tmax_impl(nodes = -1, loops = TRUE) + Condition + Error in `centralization_degree_tmax_impl()`: + ! At vendor/cigraph/src/centrality/centralization.c:xx : Number of vertices must not be negative. Invalid value + +# centralization_betweenness_impl basic + + Code + centralization_betweenness_impl(graph = g) + Output + $res + [1] 0 1 0 + + $centralization + [1] 1 + + $theoretical_max + [1] 2 + + +--- + + Code + centralization_betweenness_impl(graph = g, directed = FALSE, normalized = FALSE) + Output + $res + [1] 0 1 0 + + $centralization + [1] 2 + + $theoretical_max + [1] 2 + + +# centralization_betweenness_impl errors + + Code + centralization_betweenness_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# centralization_betweenness_tmax_impl basic + + Code + centralization_betweenness_tmax_impl(nodes = 3, directed = TRUE) + Output + [1] 4 + +--- + + Code + centralization_betweenness_tmax_impl(nodes = 3, directed = FALSE) + Output + [1] 2 + +# centralization_betweenness_tmax_impl errors + + Code + centralization_betweenness_tmax_impl(nodes = -1, directed = TRUE) + Condition + Error in `centralization_betweenness_tmax_impl()`: + ! At vendor/cigraph/src/centrality/centralization.c:xx : Number of vertices must not be negative. Invalid value + +# centralization_closeness_impl basic + + Code + centralization_closeness_impl(graph = g) + Output + $res + [1] 0.6666667 1.0000000 0.6666667 + + $centralization + [1] 1 + + $theoretical_max + [1] 0.6666667 + + +--- + + Code + centralization_closeness_impl(graph = g, mode = "in", normalized = FALSE) + Output + $res + [1] 0.6666667 1.0000000 0.6666667 + + $centralization + [1] 0.6666667 + + $theoretical_max + [1] 0.6666667 + + +# centralization_closeness_impl errors + + Code + centralization_closeness_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# centralization_closeness_tmax_impl basic + + Code + centralization_closeness_tmax_impl(nodes = 3) + Output + [1] 1.333333 + +--- + + Code + centralization_closeness_tmax_impl(nodes = 3, mode = "in") + Output + [1] 1.333333 + +# centralization_closeness_tmax_impl errors + + Code + centralization_closeness_tmax_impl(nodes = -1) + Condition + Error in `centralization_closeness_tmax_impl()`: + ! At vendor/cigraph/src/centrality/centralization.c:xx : Number of vertices must not be negative. Invalid value + +# centralization_eigenvector_centrality_impl basic + + Code + centralization_eigenvector_centrality_impl(graph = g) + Output + $vector + [1] 0.7071068 1.0000000 0.7071068 + + $value + [1] 1.414214 + + $options + $options$bmat + [1] "I" + + $options$n + [1] 3 + + $options$which + [1] "LA" + + $options$nev + [1] 1 + + $options$tol + [1] 0 + + $options$ncv + [1] 0 + + $options$ldv + [1] 0 + + $options$ishift + [1] 1 + + $options$maxiter + [1] 3000 + + $options$nb + [1] 1 + + $options$mode + [1] 1 + + $options$start + [1] 1 + + $options$sigma + [1] 0 + + $options$sigmai + [1] 0 + + $options$info + [1] 0 + + $options$iter + [1] 1 + + $options$nconv + [1] 1 + + $options$numop + [1] 3 + + $options$numopb + [1] 0 + + $options$numreo + [1] 3 + + + $centralization + [1] 0.5857864 + + $theoretical_max + [1] 1 + + +--- + + Code + centralization_eigenvector_centrality_impl(graph = g, directed = TRUE, + normalized = FALSE) + Output + $vector + [1] 0.7071068 1.0000000 0.7071068 + + $value + [1] 1.414214 + + $options + $options$bmat + [1] "I" + + $options$n + [1] 3 + + $options$which + [1] "LA" + + $options$nev + [1] 1 + + $options$tol + [1] 0 + + $options$ncv + [1] 0 + + $options$ldv + [1] 0 + + $options$ishift + [1] 1 + + $options$maxiter + [1] 3000 + + $options$nb + [1] 1 + + $options$mode + [1] 1 + + $options$start + [1] 1 + + $options$sigma + [1] 0 + + $options$sigmai + [1] 0 + + $options$info + [1] 0 + + $options$iter + [1] 1 + + $options$nconv + [1] 1 + + $options$numop + [1] 3 + + $options$numopb + [1] 0 + + $options$numreo + [1] 3 + + + $centralization + [1] 0.5857864 + + $theoretical_max + [1] 1 + + +# centralization_eigenvector_centrality_impl errors + + Code + centralization_eigenvector_centrality_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# centralization_eigenvector_centrality_tmax_impl basic + + Code + centralization_eigenvector_centrality_tmax_impl(nodes = 3) + Output + [1] 1 + +--- + + Code + centralization_eigenvector_centrality_tmax_impl(nodes = 3, directed = TRUE) + Output + [1] 2 + +# centralization_eigenvector_centrality_tmax_impl errors + + Code + centralization_eigenvector_centrality_tmax_impl(nodes = -1) + Condition + Error in `centralization_eigenvector_centrality_tmax_impl()`: + ! At vendor/cigraph/src/centrality/centralization.c:xx : Number of vertices must not be negative. Invalid value + +# assortativity_nominal_impl basic + + Code + assortativity_nominal_impl(graph = g, types = c(1, 2, 1)) + Output + [1] -1 + +--- + + Code + assortativity_nominal_impl(graph = g, types = c(1, 2, 1), directed = FALSE, + normalized = FALSE) + Output + [1] -0.5 + +# assortativity_nominal_impl errors + + Code + assortativity_nominal_impl(graph = NULL, types = c(1, 2, 1)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# assortativity_impl basic + + Code + assortativity_impl(graph = g, values = c(1, 2, 1)) + Output + [1] -1 + +--- + + Code + assortativity_impl(graph = g, values = c(1, 2, 1), directed = FALSE, + normalized = FALSE) + Output + [1] -0.25 + +# assortativity_impl errors + + Code + assortativity_impl(graph = NULL, values = c(1, 2, 1)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# assortativity_degree_impl basic + + Code + assortativity_degree_impl(graph = g) + Output + [1] -1 + +--- + + Code + assortativity_degree_impl(graph = g, directed = FALSE) + Output + [1] -1 + +# assortativity_degree_impl errors + + Code + assortativity_degree_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# joint_degree_matrix_impl basic + + Code + joint_degree_matrix_impl(graph = g) + Output + [,1] [,2] + [1,] 0 2 + [2,] 2 0 + +--- + + Code + joint_degree_matrix_impl(graph = g, max_out_degree = 2, max_in_degree = 2) + Output + [,1] [,2] + [1,] 0 2 + [2,] 2 0 + +# joint_degree_matrix_impl errors + + Code + joint_degree_matrix_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# joint_degree_distribution_impl basic + + Code + joint_degree_distribution_impl(graph = g) + Output + [,1] [,2] [,3] + [1,] 0 0.0 0.0 + [2,] 0 0.0 0.5 + [3,] 0 0.5 0.0 + +--- + + Code + joint_degree_distribution_impl(graph = g, from_mode = "in", to_mode = "out", + directed_neighbors = FALSE, normalized = FALSE, max_from_degree = 2, + max_to_degree = 2) + Output + [,1] [,2] [,3] + [1,] 0 0 0 + [2,] 0 0 2 + [3,] 0 2 0 + +# joint_degree_distribution_impl errors + + Code + joint_degree_distribution_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# joint_type_distribution_impl basic + + Code + joint_type_distribution_impl(graph = g, from_types = c(1, 2, 1)) + Output + [,1] [,2] + [1,] 0.0 0.5 + [2,] 0.5 0.0 + +--- + + Code + joint_type_distribution_impl(graph = g, from_types = c(1, 2, 1), to_types = c(1, + 2, 1), directed = FALSE, normalized = FALSE) + Output + [,1] [,2] + [1,] 0 2 + [2,] 2 0 + +# joint_type_distribution_impl errors + + Code + joint_type_distribution_impl(graph = NULL, from_types = c(1, 2, 1)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# contract_vertices_impl basic + + Code + contract_vertices_impl(graph = g, mapping = c(1, 1, 2)) + Output + IGRAPH U--- 2 2 -- + + edges: + [1] 1--1 1--2 + +# contract_vertices_impl errors + + Code + contract_vertices_impl(graph = NULL, mapping = c(1, 1, 2)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# eccentricity_dijkstra_impl basic + + Code + eccentricity_dijkstra_impl(graph = g) + Output + [1] 2 1 2 + +--- + + Code + eccentricity_dijkstra_impl(graph = g, mode = "in") + Output + [1] 2 1 2 + +# eccentricity_dijkstra_impl errors + + Code + eccentricity_dijkstra_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# graph_center_dijkstra_impl basic + + Code + graph_center_dijkstra_impl(graph = g) + Output + + 1/3 vertex: + [1] 2 + +--- + + Code + graph_center_dijkstra_impl(graph = g, mode = "in") + Output + + 1/3 vertex: + [1] 2 + +# graph_center_dijkstra_impl errors + + Code + graph_center_dijkstra_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# radius_dijkstra_impl basic + + Code + radius_dijkstra_impl(graph = g) + Output + [1] 1 + +--- + + Code + radius_dijkstra_impl(graph = g, mode = "in") + Output + [1] 1 + +# radius_dijkstra_impl errors + + Code + radius_dijkstra_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# pseudo_diameter_impl basic + + Code + pseudo_diameter_impl(graph = g, start_vid = 1) + Output + $diameter + [1] 2 + + $from + [1] 0 + + $to + [1] 2 + + +--- + + Code + pseudo_diameter_impl(graph = g, start_vid = 1, directed = FALSE, unconnected = FALSE) + Output + $diameter + [1] 2 + + $from + [1] 0 + + $to + [1] 2 + + +# pseudo_diameter_impl errors + + Code + pseudo_diameter_impl(graph = NULL, start_vid = 1) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# pseudo_diameter_dijkstra_impl basic + + Code + pseudo_diameter_dijkstra_impl(graph = g, start_vid = 1) + Output + $diameter + [1] 2 + + $from + [1] 0 + + $to + [1] 2 + + +--- + + Code + pseudo_diameter_dijkstra_impl(graph = g, start_vid = 1, directed = FALSE, + unconnected = FALSE) + Output + $diameter + [1] 2 + + $from + [1] 0 + + $to + [1] 2 + + +# pseudo_diameter_dijkstra_impl errors + + Code + pseudo_diameter_dijkstra_impl(graph = NULL, start_vid = 1) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# diversity_impl basic + + Code + diversity_impl(graph = g) + Output + [1] 0.0000000 0.9182958 0.0000000 + +# diversity_impl errors + + Code + diversity_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# random_walk_impl basic + + Code + random_walk_impl(graph = g, start = 1, steps = 2) + Output + $vertices + + 3/3 vertices: + [1] 1 2 3 + + $edges + + 2/2 edges: + [1] 1--2 2--3 + + +--- + + Code + random_walk_impl(graph = g, start = 1, steps = 2, mode = "in", stuck = "error") + Output + $vertices + + 3/3 vertices: + [1] 1 2 1 + + $edges + + 2/2 edges: + [1] 1--2 1--2 + + +# random_walk_impl errors + + Code + random_walk_impl(graph = NULL, start = 1, steps = 2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# global_efficiency_impl basic + + Code + global_efficiency_impl(graph = g) + Output + [1] 0.8333333 + +--- + + Code + global_efficiency_impl(graph = g, directed = FALSE) + Output + [1] 0.8333333 + +# global_efficiency_impl errors + + Code + global_efficiency_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# local_efficiency_impl basic + + Code + local_efficiency_impl(graph = g) + Output + [1] 0 0 0 + +--- + + Code + local_efficiency_impl(graph = g, directed = FALSE, mode = "in") + Output + [1] 0 0 0 + +# local_efficiency_impl errors + + Code + local_efficiency_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# average_local_efficiency_impl basic + + Code + average_local_efficiency_impl(graph = g) + Output + [1] 0 + +--- + + Code + average_local_efficiency_impl(graph = g, directed = FALSE, mode = "in") + Output + [1] 0 + +# average_local_efficiency_impl errors + + Code + average_local_efficiency_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# transitive_closure_dag_impl basic + + Code + transitive_closure_dag_impl(graph = g) + Output + IGRAPH D--- 3 3 -- + + edges: + [1] 1->3 1->2 2->3 + +# transitive_closure_dag_impl errors + + Code + transitive_closure_dag_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# transitive_closure_impl basic + + Code + transitive_closure_impl(graph = g) + Output + IGRAPH U--- 3 3 -- + + edges: + [1] 1--2 1--3 2--3 + +# transitive_closure_impl errors + + Code + transitive_closure_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# trussness_impl basic + + Code + trussness_impl(graph = g) + Output + [1] 2 2 + +# trussness_impl errors + + Code + trussness_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# is_graphical_impl basic + + Code + is_graphical_impl(out_deg = c(2, 2, 2)) + Output + [1] TRUE + +--- + + Code + is_graphical_impl(out_deg = c(2, 2, 2), in_deg = c(1, 1, 1), + allowed_edge_types = "all") + Output + [1] FALSE + +# is_graphical_impl errors + + Code + is_graphical_impl(out_deg = "a") + Condition + Warning in `is_graphical_impl()`: + NAs introduced by coercion + Error in `is_graphical_impl()`: + ! At rinterface_extra.c:xx : The value nan is not representable as an integer. Invalid value + +# bfs_simple_impl basic + + Code + bfs_simple_impl(graph = g, root = 1) + Output + $order + + 3/3 vertices: + [1] 1 2 3 + + $layers + [1] 0 1 2 3 + + $parents + [1] -1 0 1 + + +--- + + Code + bfs_simple_impl(graph = g, root = 1, mode = "in") + Output + $order + + 3/3 vertices: + [1] 1 2 3 + + $layers + [1] 0 1 2 3 + + $parents + [1] -1 0 1 + + +# bfs_simple_impl errors + + Code + bfs_simple_impl(graph = NULL, root = 1) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# bipartite_projection_size_impl basic + + Code + bipartite_projection_size_impl(graph = g) + Output + $vcount1 + [1] 2 + + $ecount1 + [1] 1 + + $vcount2 + [1] 2 + + $ecount2 + [1] 1 + + +# bipartite_projection_size_impl errors + + Code + bipartite_projection_size_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# biadjacency_impl basic + + Code + biadjacency_impl(incidence = m) + Output + $graph + IGRAPH U--- 5 4 -- + + edges: + [1] 1--3 1--4 1--5 2--5 + + $types + [1] FALSE FALSE TRUE TRUE TRUE + + +--- + + Code + biadjacency_impl(incidence = m, directed = TRUE, mode = "in", multiple = TRUE) + Output + $graph + IGRAPH D--- 5 4 -- + + edges: + [1] 3->1 4->1 5->1 5->2 + + $types + [1] FALSE FALSE TRUE TRUE TRUE + + +# biadjacency_impl errors + + Code + biadjacency_impl(incidence = "a") + Condition + Warning in `biadjacency_impl()`: + NAs introduced by coercion + Error in `biadjacency_impl()`: + ! REAL() can only be applied to a 'numeric', not a 'character' + +# get_biadjacency_impl basic + + Code + get_biadjacency_impl(graph = g, types = c(TRUE, FALSE, TRUE)) + Output + $res + [,1] [,2] + [1,] 1 1 + + $row_ids + [1] 2 + + $col_ids + [1] 1 3 + + +# get_biadjacency_impl errors + + Code + get_biadjacency_impl(graph = NULL, types = c(TRUE, FALSE, TRUE)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# is_bipartite_impl basic + + Code + is_bipartite_impl(graph = g) + Output + $res + [1] TRUE + + $type + [1] FALSE TRUE FALSE + + +# is_bipartite_impl errors + + Code + is_bipartite_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# bipartite_game_gnp_impl basic + + Code + bipartite_game_gnp_impl(n1 = 2, n2 = 2, p = 0.5) + Output + $graph + IGRAPH U--- 4 4 -- + + edges: + [1] 1--3 2--3 1--4 2--4 + + $types + [1] FALSE FALSE TRUE TRUE + + +--- + + Code + bipartite_game_gnp_impl(n1 = 2, n2 = 2, p = 0.5, directed = TRUE, mode = "in") + Output + $graph + IGRAPH D--- 4 1 -- + + edge: + [1] 3->2 + + $types + [1] FALSE FALSE TRUE TRUE + + +# bipartite_game_gnp_impl errors + + Code + bipartite_game_gnp_impl(n1 = -1, n2 = 2, p = 0.5) + Condition + Error in `bipartite_game_gnp_impl()`: + ! At vendor/cigraph/src/misc/bipartite.c:xx : Invalid number of vertices for bipartite graph. Invalid value + +# bipartite_game_gnm_impl basic + + Code + bipartite_game_gnm_impl(n1 = 2, n2 = 2, m = 1) + Output + $graph + IGRAPH U--- 4 1 -- + + edge: + [1] 2--4 + + $types + [1] FALSE FALSE TRUE TRUE + + +--- + + Code + bipartite_game_gnm_impl(n1 = 2, n2 = 2, m = 1, directed = TRUE, mode = "in") + Output + $graph + IGRAPH D--- 4 1 -- + + edge: + [1] 3->1 + + $types + [1] FALSE FALSE TRUE TRUE + + +# bipartite_game_gnm_impl errors + + Code + bipartite_game_gnm_impl(n1 = -1, n2 = 2, m = 1) + Condition + Error in `bipartite_game_gnm_impl()`: + ! At vendor/cigraph/src/misc/bipartite.c:xx : Invalid number of vertices for bipartite graph. Invalid value + +# get_laplacian_impl basic + + Code + get_laplacian_impl(graph = g) + Output + [,1] [,2] [,3] + [1,] 1 -1 0 + [2,] -1 2 -1 + [3,] 0 -1 1 + +--- + + Code + get_laplacian_impl(graph = g, mode = "in", normalization = "symmetric", + weights = c(1, 2)) + Output + [,1] [,2] [,3] + [1,] 1.0000000 -0.5773503 0.0000000 + [2,] -0.5773503 1.0000000 -0.8164966 + [3,] 0.0000000 -0.8164966 1.0000000 + +# get_laplacian_impl errors + + Code + get_laplacian_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# get_laplacian_sparse_impl basic + + Code + get_laplacian_sparse_impl(graph = g) + Output + $type + [1] "triplet" + + $dim + [1] 3 3 + + $p + [1] 0 1 2 0 1 1 2 + + $i + [1] 0 1 2 1 0 2 1 + + $x + [1] 1 2 1 -1 -1 -1 -1 + + attr(,"class") + [1] "igraph.tmp.sparse" + +--- + + Code + get_laplacian_sparse_impl(graph = g, mode = "in", normalization = "symmetric", + weights = c(1, 2)) + Output + $type + [1] "triplet" + + $dim + [1] 3 3 + + $p + [1] 0 1 2 0 1 1 2 + + $i + [1] 0 1 2 1 0 2 1 + + $x + [1] 1.0000000 1.0000000 1.0000000 -0.5773503 -0.5773503 -0.8164966 -0.8164966 + + attr(,"class") + [1] "igraph.tmp.sparse" + +# get_laplacian_sparse_impl errors + + Code + get_laplacian_sparse_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# connected_components_impl basic + + Code + connected_components_impl(graph = g) + Output + [1] 0 0 0 + +--- + + Code + connected_components_impl(graph = g, mode = "strong", details = TRUE) + Output + $membership + [1] 0 0 0 + + $csize + [1] 3 + + $no + [1] 1 + + +# connected_components_impl errors + + Code + connected_components_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# is_connected_impl basic + + Code + is_connected_impl(graph = g) + Output + [1] TRUE + +--- + + Code + is_connected_impl(graph = g, mode = "strong") + Output + [1] TRUE + +# is_connected_impl errors + + Code + is_connected_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# articulation_points_impl basic + + Code + articulation_points_impl(graph = g) + Output + + 1/3 vertex: + [1] 2 + +# articulation_points_impl errors + + Code + articulation_points_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# biconnected_components_impl basic + + Code + biconnected_components_impl(graph = g) + Output + $no + [1] 2 + + $tree_edges + $tree_edges[[1]] + + 1/2 edge: + [1] 2--3 + + $tree_edges[[2]] + + 1/2 edge: + [1] 1--2 + + + $component_edges + $component_edges[[1]] + + 1/2 edge: + [1] 2--3 + + $component_edges[[2]] + + 1/2 edge: + [1] 1--2 + + + $components + $components[[1]] + + 2/3 vertices: + [1] 3 2 + + $components[[2]] + + 2/3 vertices: + [1] 2 1 + + + $articulation_points + + 1/3 vertex: + [1] 2 + + +# biconnected_components_impl errors + + Code + biconnected_components_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# bridges_impl basic + + Code + bridges_impl(graph = g) + Output + + 2/2 edges: + [1] 2--3 1--2 + +# bridges_impl errors + + Code + bridges_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# is_biconnected_impl basic + + Code + is_biconnected_impl(graph = g) + Output + [1] FALSE + +# is_biconnected_impl errors + + Code + is_biconnected_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# count_reachable_impl basic + + Code + count_reachable_impl(graph = g, mode = "out") + Output + [1] 5 5 5 5 5 + +--- + + Code + count_reachable_impl(graph = g, mode = "in") + Output + [1] 5 5 5 5 5 + +# count_reachable_impl errors + + Code + count_reachable_impl(graph = NULL, mode = "out") + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# bond_percolation_impl basic + + Code + bond_percolation_impl(graph = g) + Output + $giant_size + numeric(0) + + $vetex_count + numeric(0) + + +# bond_percolation_impl errors + + Code + bond_percolation_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# site_percolation_impl basic + + Code + site_percolation_impl(graph = g) + Output + $giant_size + numeric(0) + + $edge_count + numeric(0) + + +# site_percolation_impl errors + + Code + site_percolation_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# edgelist_percolation_impl basic + + Code + edgelist_percolation_impl(edges = matrix(c(1, 2, 2, 3), ncol = 2)) + Output + $giant_size + [1] 2 3 + + $vertex_count + [1] 2 3 + + +# edgelist_percolation_impl errors + + Code + edgelist_percolation_impl(edges = "a") + Condition + Error in `edgelist_percolation_impl()`: + ! REAL() can only be applied to a 'numeric', not a 'character' + +# is_clique_impl basic + + Code + is_clique_impl(graph = g, candidate = 1:2) + Output + [1] TRUE + +--- + + Code + is_clique_impl(graph = g, candidate = 1:2, directed = TRUE) + Output + [1] TRUE + +# is_clique_impl errors + + Code + is_clique_impl(graph = NULL, candidate = 1:2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# cliques_impl basic + + Code + cliques_impl(graph = g) + Output + [[1]] + + 1/3 vertex: + [1] 2 + + [[2]] + + 1/3 vertex: + [1] 3 + + [[3]] + + 2/3 vertices: + [1] 2 3 + + [[4]] + + 1/3 vertex: + [1] 1 + + [[5]] + + 2/3 vertices: + [1] 1 2 + + +--- + + Code + cliques_impl(graph = g, min = 2, max = 2) + Output + [[1]] + + 2/3 vertices: + [1] 2 3 + + [[2]] + + 2/3 vertices: + [1] 1 2 + + +# cliques_impl errors + + Code + cliques_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# clique_size_hist_impl basic + + Code + clique_size_hist_impl(graph = g) + Output + [1] 3 2 + +--- + + Code + clique_size_hist_impl(graph = g, min_size = 2, max_size = 2) + Output + [1] 0 2 + +# clique_size_hist_impl errors + + Code + clique_size_hist_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# largest_cliques_impl basic + + Code + largest_cliques_impl(graph = g) + Output + [[1]] + + 2/3 vertices: + [1] 1 2 + + [[2]] + + 2/3 vertices: + [1] 2 3 + + +# largest_cliques_impl errors + + Code + largest_cliques_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# maximal_cliques_hist_impl basic + + Code + maximal_cliques_hist_impl(graph = g) + Output + [1] 0 2 + +--- + + Code + maximal_cliques_hist_impl(graph = g, min_size = 2, max_size = 2) + Output + [1] 0 2 + +# maximal_cliques_hist_impl errors + + Code + maximal_cliques_hist_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# clique_number_impl basic + + Code + clique_number_impl(graph = g) + Output + [1] 2 + +# clique_number_impl errors + + Code + clique_number_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# weighted_cliques_impl basic + + Code + weighted_cliques_impl(graph = g) + Output + [[1]] + + 1/3 vertex: + [1] 2 + + [[2]] + + 1/3 vertex: + [1] 3 + + [[3]] + + 2/3 vertices: + [1] 2 3 + + [[4]] + + 1/3 vertex: + [1] 1 + + [[5]] + + 2/3 vertices: + [1] 1 2 + + +--- + + Code + weighted_cliques_impl(graph = g, vertex_weights = c(1, 2, 3), min_weight = 1, + max_weight = 3, maximal = TRUE) + Output + [[1]] + + 2/3 vertices: + [1] 1 2 + + +# weighted_cliques_impl errors + + Code + weighted_cliques_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# largest_weighted_cliques_impl basic + + Code + largest_weighted_cliques_impl(graph = g) + Output + [[1]] + + 2/3 vertices: + [1] 1 2 + + [[2]] + + 2/3 vertices: + [1] 2 3 + + +--- + + Code + largest_weighted_cliques_impl(graph = g, vertex_weights = c(1, 2, 3)) + Output + [[1]] + + 2/3 vertices: + [1] 2 3 + + +# largest_weighted_cliques_impl errors + + Code + largest_weighted_cliques_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# weighted_clique_number_impl basic + + Code + weighted_clique_number_impl(graph = g) + Output + [1] 2 + +--- + + Code + weighted_clique_number_impl(graph = g, vertex_weights = c(1, 2, 3)) + Output + [1] 5 + +# weighted_clique_number_impl errors + + Code + weighted_clique_number_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# is_independent_vertex_set_impl basic + + Code + is_independent_vertex_set_impl(graph = g, candidate = 1:2) + Output + [1] FALSE + +# is_independent_vertex_set_impl errors + + Code + is_independent_vertex_set_impl(graph = NULL, candidate = 1:2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# layout_random_impl basic + + Code + layout_random_impl(graph = g) + Output + [,1] [,2] + [1,] 0.91714717 0.7003783 + [2,] -0.84358557 0.6509057 + [3,] -0.08120892 -0.8259847 + +# layout_random_impl errors + + Code + layout_random_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# layout_circle_impl basic + + Code + layout_circle_impl(graph = g) + Output + [,1] [,2] + [1,] 1.0 0.0000000 + [2,] -0.5 0.8660254 + [3,] -0.5 -0.8660254 + +--- + + Code + layout_circle_impl(graph = g, order = 1:3) + Output + [,1] [,2] + [1,] 1.0 0.0000000 + [2,] -0.5 0.8660254 + [3,] -0.5 -0.8660254 + +# layout_circle_impl errors + + Code + layout_circle_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# layout_star_impl basic + + Code + round(layout_star_impl(graph = g), 4) + Output + [,1] [,2] + [1,] 0 0 + [2,] 1 0 + [3,] -1 0 + +--- + + Code + round(layout_star_impl(graph = g, center = 1, order = 3:1), 4) + Output + [,1] [,2] + [1,] 0 0 + [2,] -1 0 + [3,] 1 0 + +# layout_star_impl errors + + Code + layout_star_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# layout_grid_impl basic + + Code + layout_grid_impl(graph = g) + Output + [,1] [,2] + [1,] 0 0 + [2,] 1 0 + [3,] 0 1 + +--- + + Code + layout_grid_impl(graph = g, width = 2) + Output + [,1] [,2] + [1,] 0 0 + [2,] 1 0 + [3,] 0 1 + +# layout_grid_impl errors + + Code + layout_grid_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# layout_grid_3d_impl basic + + Code + layout_grid_3d_impl(graph = g) + Output + [,1] [,2] [,3] + [1,] 0 0 0 + [2,] 1 0 0 + [3,] 0 1 0 + +--- + + Code + layout_grid_3d_impl(graph = g, width = 2, height = 2) + Output + [,1] [,2] [,3] + [1,] 0 0 0 + [2,] 1 0 0 + [3,] 0 1 0 + +# layout_grid_3d_impl errors + + Code + layout_grid_3d_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# roots_for_tree_layout_impl basic + + Code + roots_for_tree_layout_impl(graph = g, mode = "out", heuristic = 1) + Output + + 1/3 vertex: + [1] 2 + +# roots_for_tree_layout_impl errors + + Code + roots_for_tree_layout_impl(graph = NULL, mode = "out", heuristic = 1) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# layout_random_3d_impl basic + + Code + layout_random_3d_impl(graph = g) + Output + [,1] [,2] [,3] + [1,] 0.91714717 0.7003783 0.7338074 + [2,] -0.84358557 0.6509057 0.4644714 + [3,] -0.08120892 -0.8259847 0.5240391 + +# layout_random_3d_impl errors + + Code + layout_random_3d_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# layout_sphere_impl basic + + Code + layout_sphere_impl(graph = g) + Output + [,1] [,2] [,3] + [1,] 0.0000000 0.0000000 -1 + [2,] -0.4861377 0.8738822 0 + [3,] 0.0000000 0.0000000 1 + +--- + + Code + layout_sphere_impl(graph = g) + Output + [,1] [,2] [,3] + [1,] 0.0000000 0.0000000 -1.0 + [2,] -0.2461774 0.8302992 -0.5 + [3,] -0.9468790 -0.3215901 0.0 + [4,] 0.5001161 -0.7070246 0.5 + [5,] 0.0000000 0.0000000 1.0 + +# layout_sphere_impl errors + + Code + layout_sphere_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# layout_sugiyama_impl basic + + Code + layout_sugiyama_impl(graph = g) + Output + $res + [,1] [,2] + [1,] 0.0 1 + [2,] 0.5 0 + [3,] 1.0 1 + + $extd_graph + IGRAPH U--- 3 2 -- + + edges: + [1] 1--2 2--3 + + $extd_to_orig_eids + [1] 1 2 + + +--- + + Code + layout_sugiyama_impl(graph = g, layers = 1:3, hgap = 2, vgap = 2, maxiter = 10, + weights = c(1, 2)) + Output + $res + [,1] [,2] + [1,] 0 0 + [2,] 0 2 + [3,] 0 4 + + $extd_graph + IGRAPH U--- 3 2 -- + + edges: + [1] 1--2 2--3 + + $extd_to_orig_eids + [1] 1 2 + + +# layout_sugiyama_impl errors + + Code + layout_sugiyama_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# layout_mds_impl basic + + Code + layout_mds_impl(graph = g) + Output + [,1] [,2] + [1,] 1 2.807594e-08 + [2,] 0 0.000000e+00 + [3,] -1 2.807594e-08 + +--- + + Code + layout_mds_impl(graph = g, dist = matrix(1:9, nrow = 3), dim = 3) + Output + [,1] [,2] [,3] + [1,] -2.907521 2.32638426 1.444979 + [2,] -3.900013 -1.63291106 2.258035 + [3,] 3.975674 0.09951448 3.271816 + +# layout_mds_impl errors + + Code + layout_mds_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# layout_bipartite_impl basic + + Code + layout_bipartite_impl(graph = g, types = c(TRUE, FALSE, TRUE)) + Output + [,1] [,2] + [1,] 0.0 0 + [2,] 0.5 1 + [3,] 1.0 0 + +--- + + Code + layout_bipartite_impl(graph = g, types = c(TRUE, FALSE, TRUE), hgap = 2, vgap = 2, + maxiter = 10) + Output + [,1] [,2] + [1,] 0 0 + [2,] 1 2 + [3,] 2 0 + +# layout_bipartite_impl errors + + Code + layout_bipartite_impl(graph = NULL, types = c(TRUE, FALSE, TRUE)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# layout_gem_impl basic + + Code + layout_gem_impl(graph = g, res = matrix(0, nrow = 3, ncol = 2)) + Output + [,1] [,2] + [1,] 262.48135 -232.3960 + [2,] -15.77371 195.0729 + [3,] 182.43029 -223.2375 + +--- + + Code + layout_gem_impl(graph = g, res = matrix(0, nrow = 3, ncol = 2), use_seed = TRUE, + maxiter = 10, temp_max = 2, temp_min = 0.1, temp_init = 1) + Output + [,1] [,2] + [1,] -3.512540 -3.4930988 + [2,] 1.774751 0.1310939 + [3,] -1.004480 2.5739849 + +# layout_gem_impl errors + + Code + layout_gem_impl(graph = NULL, res = matrix(0, nrow = 3, ncol = 2)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# layout_davidson_harel_impl basic + + Code + layout_davidson_harel_impl(graph = g, res = matrix(0, nrow = 3, ncol = 2)) + Output + [,1] [,2] + [1,] 1.152116 0.9424808 + [2,] 2.474361 2.5195497 + [3,] 3.849187 4.0402661 + +--- + + Code + layout_davidson_harel_impl(graph = g, res = matrix(0, nrow = 3, ncol = 2), + use_seed = TRUE, maxiter = 10, fineiter = 5, cool_fact = 0.5, weight_node_dist = 2, + weight_border = 1, weight_edge_lengths = 0.1, weight_edge_crossings = 0.2, + weight_node_edge_dist = 0.3) + Output + [,1] [,2] + [1,] -6.609493 -2.155221 + [2,] -8.660255 -3.797365 + [3,] -6.485087 -5.224752 + +# layout_davidson_harel_impl errors + + Code + layout_davidson_harel_impl(graph = NULL, res = matrix(0, nrow = 3, ncol = 2)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# layout_umap_impl basic + + Code + layout_umap_impl(graph = g, res = matrix(0, nrow = 3, ncol = 2), use_seed = TRUE) + Output + [,1] [,2] + [1,] 0 0 + [2,] 0 0 + [3,] 0 0 + +--- + + Code + layout_umap_impl(graph = g, res = matrix(0, nrow = 3, ncol = 2), use_seed = TRUE, + distances = 1:3, min_dist = 0.1, epochs = 10, distances_are_weights = TRUE) + Output + [,1] [,2] + [1,] 0 0 + [2,] 0 0 + [3,] 0 0 + +# layout_umap_impl errors + + Code + layout_umap_impl(graph = NULL, res = matrix(0, nrow = 3, ncol = 2)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# layout_umap_3d_impl basic + + Code + layout_umap_3d_impl(graph = g, res = matrix(0, nrow = 3, ncol = 3), use_seed = TRUE) + Output + [,1] [,2] [,3] + [1,] 0 0 0 + [2,] 0 0 0 + [3,] 0 0 0 + +--- + + Code + layout_umap_3d_impl(graph = g, res = matrix(0, nrow = 3, ncol = 3), use_seed = TRUE, + distances = 1:3, min_dist = 0.1, epochs = 10, distances_are_weights = TRUE) + Output + [,1] [,2] [,3] + [1,] 0 0 0 + [2,] 0 0 0 + [3,] 0 0 0 + +# layout_umap_3d_impl errors + + Code + layout_umap_3d_impl(graph = NULL, res = matrix(0, nrow = 3, ncol = 3)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# layout_umap_compute_weights_impl basic + + Code + layout_umap_compute_weights_impl(graph = g, distances = 1:2, weights = 1:3) + Output + [1] 1 1 + +# layout_umap_compute_weights_impl errors + + Code + layout_umap_compute_weights_impl(graph = NULL, distances = 1:3, weights = 1:3) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# layout_align_impl basic + + Code + layout_align_impl(graph = g, layout = matrix(0, nrow = 3, ncol = 2)) + Output + [,1] [,2] + [1,] 0 0 + [2,] 0 0 + [3,] 0 0 + +# layout_align_impl errors + + Code + layout_align_impl(graph = NULL, layout = matrix(0, nrow = 3, ncol = 2)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# similarity_dice_impl basic + + Code + similarity_dice_impl(graph = g) + Output + [,1] [,2] [,3] + [1,] 1 0 1 + [2,] 0 1 0 + [3,] 1 0 1 + +--- + + Code + similarity_dice_impl(graph = g, vids = 1:2, mode = "in", loops = TRUE) + Output + [,1] [,2] + [1,] 1.0 0.8 + [2,] 0.8 1.0 + +# similarity_dice_impl errors + + Code + similarity_dice_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# similarity_dice_es_impl basic + + Code + similarity_dice_es_impl(graph = g) + Output + [1] 0 0 + +--- + + Code + similarity_dice_es_impl(graph = g, es = 1:2, mode = "in", loops = TRUE) + Output + [1] 0.8 0.8 + +# similarity_dice_es_impl errors + + Code + similarity_dice_es_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# similarity_dice_pairs_impl basic + + Code + similarity_dice_pairs_impl(graph = g, pairs = matrix(c(1, 2, 2, 3), ncol = 2)) + Output + [1] 0 0 + +--- + + Code + similarity_dice_pairs_impl(graph = g, pairs = matrix(c(1, 2, 2, 3), ncol = 2), + mode = "in", loops = TRUE) + Output + [1] 0.6666667 0.8000000 + +# similarity_dice_pairs_impl errors + + Code + similarity_dice_pairs_impl(graph = NULL, pairs = matrix(c(1, 2, 2, 3), ncol = 2)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# similarity_inverse_log_weighted_impl basic + + Code + similarity_inverse_log_weighted_impl(graph = g) + Output + [,1] [,2] [,3] + [1,] 0.000000 0 1.442695 + [2,] 0.000000 0 0.000000 + [3,] 1.442695 0 0.000000 + +--- + + Code + similarity_inverse_log_weighted_impl(graph = g, vids = 1:2, mode = "in") + Output + [,1] [,2] [,3] + [1,] 0 0 1.442695 + [2,] 0 0 0.000000 + +# similarity_inverse_log_weighted_impl errors + + Code + similarity_inverse_log_weighted_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# similarity_jaccard_impl basic + + Code + similarity_jaccard_impl(graph = g) + Output + [,1] [,2] [,3] + [1,] 1 0 1 + [2,] 0 1 0 + [3,] 1 0 1 + +--- + + Code + similarity_jaccard_impl(graph = g, vids = 1:2, mode = "in", loops = TRUE) + Output + [,1] [,2] + [1,] 1.0000000 0.6666667 + [2,] 0.6666667 1.0000000 + +# similarity_jaccard_impl errors + + Code + similarity_jaccard_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# similarity_jaccard_es_impl basic + + Code + similarity_jaccard_es_impl(graph = g) + Output + [1] 0 0 + +--- + + Code + similarity_jaccard_es_impl(graph = g, es = 1:2, mode = "in", loops = TRUE) + Output + [1] 0.6666667 0.6666667 + +# similarity_jaccard_es_impl errors + + Code + similarity_jaccard_es_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# similarity_jaccard_pairs_impl basic + + Code + similarity_jaccard_pairs_impl(graph = g, pairs = matrix(c(1, 2, 2, 3), ncol = 2)) + Output + [1] 0 0 + +--- + + Code + similarity_jaccard_pairs_impl(graph = g, pairs = matrix(c(1, 2, 2, 3), ncol = 2), + mode = "in", loops = TRUE) + Output + [1] 0.5000000 0.6666667 + +# similarity_jaccard_pairs_impl errors + + Code + similarity_jaccard_pairs_impl(graph = NULL, pairs = matrix(c(1, 2, 2, 3), ncol = 2)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# compare_communities_impl basic + + Code + compare_communities_impl(comm1 = c(1, 2, 1), comm2 = c(2, 1, 2)) + Output + [1] 0 + +--- + + Code + compare_communities_impl(comm1 = c(1, 2, 1), comm2 = c(2, 1, 2), method = "nmi") + Output + [1] 1 + +--- + + Code + compare_communities_impl(comm1 = comm1, comm2 = comm2, method = "vi") + Output + [1] 0.5493061 + +# compare_communities_impl errors + + Code + compare_communities_impl(comm1 = "a", comm2 = c(2, 1, 2)) + Condition + Warning in `compare_communities_impl()`: + NAs introduced by coercion + Error in `compare_communities_impl()`: + ! At rinterface_extra.c:xx : The value nan is not representable as an integer. Invalid value + +# modularity_impl basic + + Code + modularity_impl(graph = g, membership = c(1, 2, 1)) + Output + [1] -0.5 + +--- + + Code + modularity_impl(graph = g, membership = c(1, 2, 1), weights = c(1, 2), + resolution = 0.5, directed = FALSE) + Output + [1] -0.25 + +# modularity_impl errors + + Code + modularity_impl(graph = NULL, membership = c(1, 2, 1)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# modularity_matrix_impl basic + + Code + modularity_matrix_impl(graph = g) + Output + [,1] [,2] [,3] + [1,] -0.25 0.5 -0.25 + [2,] 0.50 -1.0 0.50 + [3,] -0.25 0.5 -0.25 + +--- + + Code + modularity_matrix_impl(graph = g, weights = c(1, 2), resolution = 0.5, + directed = FALSE) + Output + [,1] [,2] [,3] + [1,] -0.08333333 0.75 -0.1666667 + [2,] 0.75000000 -0.75 1.5000000 + [3,] -0.16666667 1.50 -0.3333333 + +# modularity_matrix_impl errors + + Code + modularity_matrix_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# community_fluid_communities_impl basic + + Code + community_fluid_communities_impl(graph = g, no_of_communities = 2) + Output + [1] 1 0 0 + +# community_fluid_communities_impl errors + + Code + community_fluid_communities_impl(graph = NULL, no_of_communities = 2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# community_label_propagation_impl basic + + Code + community_label_propagation_impl(graph = g) + Output + [1] 0 0 0 + +--- + + Code + community_label_propagation_impl(graph = g, mode = "in", weights = c(1, 2), + initial = 1:3, fixed = c(TRUE, FALSE, TRUE)) + Output + [1] 0 1 1 + +# community_label_propagation_impl errors + + Code + community_label_propagation_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# community_multilevel_impl basic + + Code + community_multilevel_impl(graph = g) + Output + $membership + [1] 0 0 0 + + $memberships + [,1] [,2] [,3] + [1,] 0 0 0 + + $modularity + [1] 0 + + +--- + + Code + community_multilevel_impl(graph = g, weights = c(1, 2), resolution = 0.5) + Output + $membership + [1] 0 0 0 + + $memberships + [,1] [,2] [,3] + [1,] 0 0 0 + + $modularity + [1] 0.5 + + +# community_multilevel_impl errors + + Code + community_multilevel_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# community_optimal_modularity_impl basic + + Code + community_optimal_modularity_impl(graph = g) + Output + $modularity + [1] 0 + + $membership + [1] 0 0 0 + + +--- + + Code + community_optimal_modularity_impl(graph = g, weights = c(1, 2)) + Output + $modularity + [1] 1.850372e-17 + + $membership + [1] 0 0 0 + + +# community_optimal_modularity_impl errors + + Code + community_optimal_modularity_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# community_leiden_impl basic + + Code + community_leiden_impl(graph = g, weights = c(1, 2), vertex_weights = c(1, 2, 3), + resolution = 0.5, beta = 0.1, start = TRUE, n_iterations = 1, membership = 1:3) + Output + $membership + [1] 0 1 2 + + $nb_clusters + [1] 3 + + $quality + [1] -1.166667 + + +# community_leiden_impl errors + + Code + community_leiden_impl(graph = NULL, resolution = 1) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# split_join_distance_impl basic + + Code + split_join_distance_impl(comm1 = c(1, 2, 1), comm2 = c(2, 1, 2)) + Output + $distance12 + [1] 0 + + $distance21 + [1] 0 + + +# split_join_distance_impl errors + + Code + split_join_distance_impl(comm1 = "a", comm2 = c(2, 1, 2)) + Condition + Warning in `split_join_distance_impl()`: + NAs introduced by coercion + Error in `split_join_distance_impl()`: + ! At rinterface_extra.c:xx : The value nan is not representable as an integer. Invalid value + +# community_infomap_impl basic + + Code + community_infomap_impl(graph = g) + Output + $membership + [1] 0 0 0 + + $codelength + [1] 1.512987 + + +--- + + Code + community_infomap_impl(graph = g, e_weights = c(1, 2), v_weights = c(1, 2, 3), + nb_trials = 2) + Output + $membership + [1] 0 0 0 + + $codelength + [1] 1.462254 + + +# community_infomap_impl errors + + Code + community_infomap_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# graphlets_impl basic + + Code + graphlets_impl(graph = g) + Output + $cliques + $cliques[[1]] + + 2/3 vertices: + [1] 2 3 + + $cliques[[2]] + + 2/3 vertices: + [1] 1 2 + + + $Mu + [1] 0.6665667 0.3332333 + + +--- + + Code + graphlets_impl(graph = g, weights = c(3, 4), niter = 10) + Output + $cliques + $cliques[[1]] + + 2/3 vertices: + [1] 2 3 + + $cliques[[2]] + + 2/3 vertices: + [1] 1 2 + + + $Mu + [1] 1.333233 0.999900 + + +# graphlets_impl errors + + Code + graphlets_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# hrg_fit_impl basic + + Code + hrg_fit_impl(graph = g1) + Output + $left + [1] -2 0 + + $right + [1] 1 2 + + $prob + [1] 1 0 + + $edges + [1] 2 0 + + $vertices + [1] 3 2 + + +# hrg_fit_impl errors + + Code + hrg_fit_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# hrg_sample_impl basic + + Code + hrg_sample_impl(hrg = hrg_model) + Output + IGRAPH U--- 10 45 -- + + edges: + [1] 1-- 2 1-- 3 1-- 4 1-- 5 1-- 6 1-- 7 1-- 8 1-- 9 1--10 2-- 3 2-- 4 2-- 5 + [13] 2-- 6 2-- 7 2-- 8 2-- 9 2--10 3-- 4 3-- 5 3-- 6 3-- 7 3-- 8 3-- 9 3--10 + [25] 4-- 5 4-- 6 4-- 7 4-- 8 4-- 9 4--10 5-- 6 5-- 7 5-- 8 5-- 9 5--10 6-- 7 + [37] 6-- 8 6-- 9 6--10 7-- 8 7-- 9 7--10 8-- 9 8--10 9--10 + +# hrg_sample_impl errors + + Code + hrg_sample_impl(hrg = NULL) + Condition + Error in `hrg_sample_impl()`: + ! At vendor/cigraph/src/hrg/hrg_types.cc:xx : Assertion failed: n >= 0. This is an unexpected igraph error; please report this as a bug, along with the steps to reproduce it. + Please restart your R session to avoid crashes or other surprising behavior. + +# hrg_sample_many_impl basic + + Code + hrg_sample_many_impl(hrg = hrg_model, num_samples = 2) + Output + [[1]] + IGRAPH U--- 10 45 -- + + edges: + [1] 1-- 2 1-- 3 1-- 4 1-- 5 1-- 6 1-- 7 1-- 8 1-- 9 1--10 2-- 3 2-- 4 2-- 5 + [13] 2-- 6 2-- 7 2-- 8 2-- 9 2--10 3-- 4 3-- 5 3-- 6 3-- 7 3-- 8 3-- 9 3--10 + [25] 4-- 5 4-- 6 4-- 7 4-- 8 4-- 9 4--10 5-- 6 5-- 7 5-- 8 5-- 9 5--10 6-- 7 + [37] 6-- 8 6-- 9 6--10 7-- 8 7-- 9 7--10 8-- 9 8--10 9--10 + + [[2]] + IGRAPH U--- 10 45 -- + + edges: + [1] 1-- 2 1-- 3 1-- 4 1-- 5 1-- 6 1-- 7 1-- 8 1-- 9 1--10 2-- 3 2-- 4 2-- 5 + [13] 2-- 6 2-- 7 2-- 8 2-- 9 2--10 3-- 4 3-- 5 3-- 6 3-- 7 3-- 8 3-- 9 3--10 + [25] 4-- 5 4-- 6 4-- 7 4-- 8 4-- 9 4--10 5-- 6 5-- 7 5-- 8 5-- 9 5--10 6-- 7 + [37] 6-- 8 6-- 9 6--10 7-- 8 7-- 9 7--10 8-- 9 8--10 9--10 + + +# hrg_sample_many_impl errors + + Code + hrg_sample_many_impl(hrg = NULL, num_samples = 2) + Condition + Error in `hrg_sample_many_impl()`: + ! At vendor/cigraph/src/hrg/hrg_types.cc:xx : Assertion failed: n >= 0. This is an unexpected igraph error; please report this as a bug, along with the steps to reproduce it. + Please restart your R session to avoid crashes or other surprising behavior. + +# hrg_game_impl basic + + Code + hrg_game_impl(hrg = hrg_model) + Output + IGRAPH U--- 10 45 -- Hierarchical random graph model + + attr: name (g/c) + + edges: + [1] 1-- 2 1-- 3 1-- 4 1-- 5 1-- 6 1-- 7 1-- 8 1-- 9 1--10 2-- 3 2-- 4 2-- 5 + [13] 2-- 6 2-- 7 2-- 8 2-- 9 2--10 3-- 4 3-- 5 3-- 6 3-- 7 3-- 8 3-- 9 3--10 + [25] 4-- 5 4-- 6 4-- 7 4-- 8 4-- 9 4--10 5-- 6 5-- 7 5-- 8 5-- 9 5--10 6-- 7 + [37] 6-- 8 6-- 9 6--10 7-- 8 7-- 9 7--10 8-- 9 8--10 9--10 + +# hrg_game_impl errors + + Code + hrg_game_impl(hrg = NULL) + Condition + Error in `hrg_game_impl()`: + ! At vendor/cigraph/src/hrg/hrg_types.cc:xx : Assertion failed: n >= 0. This is an unexpected igraph error; please report this as a bug, along with the steps to reproduce it. + Please restart your R session to avoid crashes or other surprising behavior. + +# hrg_consensus_impl errors + + Code + hrg_consensus_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# hrg_predict_impl errors + + Code + hrg_predict_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# hrg_create_impl basic + + Code + hrg_create_impl(graph = g, prob = rep(0.5, 2)) + Output + Hierarchical random graph, at level 3: + g1 p=0.5 1 + '- g2 p=0.5 2 3 + +# hrg_create_impl errors + + Code + hrg_create_impl(graph = g, prob = 0.5) + Condition + Error in `hrg_create_impl()`: + ! At vendor/cigraph/src/hrg/hrg.cc:xx : HRG probability vector size (1) should be equal to the number of internal nodes (2). Invalid value + +# hrg_resize_impl basic + + Code + hrg_resize_impl(hrg = hrg_model, newsize = 5) + Output + $left + [1] 0 -9 -6 -2 + + $right + [1] -4 4 7 -8 + + $prob + [1] 1 1 1 1 + + $edges + [1] 9 6 3 14 + + $vertices + [1] 10 7 4 9 + + +# hrg_resize_impl errors + + Code + hrg_resize_impl(hrg = -1, newsize = 2) + Condition + Error in `hrg_resize_impl()`: + ! At rinterface_extra.c:xx : The value nan is not representable as an integer. Invalid value + +# hrg_size_impl basic + + Code + hrg_size_impl(hrg = hrg_model) + Output + [1] 10 + +# hrg_size_impl errors + + Code + hrg_size_impl(hrg = -1) + Condition + Error in `hrg_size_impl()`: + ! At rinterface_extra.c:xx : The value nan is not representable as an integer. Invalid value + +# from_hrg_dendrogram_impl basic + + Code + from_hrg_dendrogram_impl(hrg = hrg_model) + Output + $graph + IGRAPH D--- 19 18 -- + + edges: + [1] 11-> 1 11->14 12->19 12-> 5 13->16 13-> 8 14->12 14->18 15-> 3 15-> 6 + [11] 16->15 16->10 17->13 17-> 4 18-> 7 18-> 9 19-> 2 19->17 + + $prob + [1] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 1 1 1 1 1 1 1 1 1 + + +# from_hrg_dendrogram_impl errors + + Code + from_hrg_dendrogram_impl(hrg = -1) + Condition + Error in `from_hrg_dendrogram_impl()`: + ! At rinterface_extra.c:xx : The value nan is not representable as an integer. Invalid value + +# get_adjacency_sparse_impl basic + + Code + get_adjacency_sparse_impl(graph = g) + Output + $type + [1] "triplet" + + $dim + [1] 3 3 + + $p + [1] 0 1 1 2 + + $i + [1] 1 0 2 1 + + $x + [1] 1 1 1 1 + + attr(,"class") + [1] "igraph.tmp.sparse" + +--- + + Code + get_adjacency_sparse_impl(graph = g, type = "upper", weights = c(1, 2), loops = "none") + Output + $type + [1] "triplet" + + $dim + [1] 3 3 + + $p + [1] 1 2 + + $i + [1] 0 1 + + $x + [1] 1 2 + + attr(,"class") + [1] "igraph.tmp.sparse" + +# get_adjacency_sparse_impl errors + + Code + get_adjacency_sparse_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# get_stochastic_impl basic + + Code + get_stochastic_impl(graph = g) + Output + [,1] [,2] [,3] + [1,] 0.0 1 0.0 + [2,] 0.5 0 0.5 + [3,] 0.0 1 0.0 + +--- + + Code + get_stochastic_impl(graph = g, column_wise = TRUE, weights = c(1, 2)) + Output + [,1] [,2] [,3] + [1,] 0 0.3333333 0 + [2,] 1 0.0000000 1 + [3,] 0 0.6666667 0 + +# get_stochastic_impl errors + + Code + get_stochastic_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# get_stochastic_sparse_impl basic + + Code + get_stochastic_sparse_impl(graph = g) + Output + $type + [1] "triplet" + + $dim + [1] 3 3 + + $p + [1] 0 1 1 2 + + $i + [1] 1 0 2 1 + + $x + [1] 0.5 1.0 1.0 0.5 + + attr(,"class") + [1] "igraph.tmp.sparse" + +--- + + Code + get_stochastic_sparse_impl(graph = g, column_wise = TRUE, weights = c(1, 2)) + Output + $type + [1] "triplet" + + $dim + [1] 3 3 + + $p + [1] 0 1 1 2 + + $i + [1] 1 0 2 1 + + $x + [1] 1.0000000 0.3333333 0.6666667 1.0000000 + + attr(,"class") + [1] "igraph.tmp.sparse" + +# get_stochastic_sparse_impl errors + + Code + get_stochastic_sparse_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# to_directed_impl basic + + Code + to_directed_impl(graph = g) + Output + IGRAPH D--- 3 4 -- + + edges: + [1] 1->2 2->3 2->1 3->2 + +--- + + Code + to_directed_impl(graph = g, mode = "acyclic") + Output + IGRAPH D--- 3 2 -- + + edges: + [1] 1->2 2->3 + +# to_directed_impl errors + + Code + to_directed_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# to_undirected_impl basic + + Code + to_undirected_impl(graph = g) + Output + IGRAPH U--- 3 2 -- + + edges: + [1] 1--2 2--3 + +--- + + Code + to_undirected_impl(graph = g, mode = "mutual", edge_attr_comb = "sum") + Output + IGRAPH U--- 3 2 -- + + edges: + [1] 1--2 2--3 + +# to_undirected_impl errors + + Code + to_undirected_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# motifs_randesu_impl basic + + Code + motifs_randesu_impl(graph = g) + Output + [1] NaN NaN 1 0 + +--- + + Code + motifs_randesu_impl(graph = g, size = 4, cut_prob = rep(0.1, 4)) + Output + [1] NaN NaN NaN NaN 0 NaN 0 0 0 0 0 + +# motifs_randesu_impl errors + + Code + motifs_randesu_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# motifs_randesu_estimate_impl basic + + Code + motifs_randesu_estimate_impl(graph = g, size = 3, sample_size = 2) + Output + [1] 3 + +--- + + Code + motifs_randesu_estimate_impl(graph = g, size = 4, cut_prob = rep(0.1, 4), + sample_size = 2, sample = 1:2) + Output + [1] 3 + +# motifs_randesu_estimate_impl errors + + Code + motifs_randesu_estimate_impl(graph = NULL, size = 3, sample_size = 2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# motifs_randesu_no_impl basic + + Code + motifs_randesu_no_impl(graph = g) + Output + [1] 1 + +--- + + Code + motifs_randesu_no_impl(graph = g, size = 4, cut_prob = c(0.1, 0.1, 0.1, 0.1)) + Output + [1] 0 + +# motifs_randesu_no_impl errors + + Code + motifs_randesu_no_impl(graph = g, size = 3, cut_prob = c(0.1)) + Condition + Error in `motifs_randesu_no_impl()`: + ! At vendor/cigraph/src/misc/motifs.c:xx : Cut probability vector size (1) must agree with motif size (3). Invalid value + +# dyad_census_impl basic + + Code + dyad_census_impl(graph = g) + Output + $mut + [1] 2 + + $asym + [1] 0 + + $null + [1] 1 + + +# dyad_census_impl errors + + Code + dyad_census_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# triad_census_impl basic + + Code + triad_census_impl(graph = g) + Condition + Warning in `triad_census_impl()`: + At vendor/cigraph/src/misc/motifs.c:1157 : Triad census called on an undirected graph. All connections will be treated as mutual. + Output + [1] 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 + +# triad_census_impl errors + + Code + triad_census_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# count_adjacent_triangles_impl basic + + Code + count_adjacent_triangles_impl(graph = g) + Output + [1] 0 0 0 + +--- + + Code + count_adjacent_triangles_impl(graph = g, vids = 1:2) + Output + [1] 0 0 + +# count_adjacent_triangles_impl errors + + Code + count_adjacent_triangles_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# count_triangles_impl basic + + Code + count_triangles_impl(graph = g) + Output + [1] 0 + +# count_triangles_impl errors + + Code + count_triangles_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# local_scan_0_impl basic + + Code + local_scan_0_impl(graph = g) + Output + [1] 1 2 1 + +--- + + Code + local_scan_0_impl(graph = g, weights = c(1, 2), mode = "in") + Output + [1] 1 3 2 + +# local_scan_0_impl errors + + Code + local_scan_0_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# local_scan_0_them_impl basic + + Code + local_scan_0_them_impl(us = g1, them = g2) + Output + [1] 1 2 1 + +--- + + Code + local_scan_0_them_impl(us = g1, them = g2, weights_them = c(1, 2), mode = "in") + Output + [1] 1 3 2 + +# local_scan_0_them_impl errors + + Code + local_scan_0_them_impl(us = NULL, them = them) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# local_scan_1_ecount_impl basic + + Code + local_scan_1_ecount_impl(graph = g) + Output + [1] 1 2 1 + +--- + + Code + local_scan_1_ecount_impl(graph = g, weights = c(1, 2), mode = "in") + Output + [1] 1 3 2 + +# local_scan_1_ecount_impl errors + + Code + local_scan_1_ecount_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# local_scan_1_ecount_them_impl basic + + Code + local_scan_1_ecount_them_impl(us = g1, them = g2) + Output + [1] 1 2 1 + +--- + + Code + local_scan_1_ecount_them_impl(us = g1, them = g2, weights_them = c(1, 2), mode = "in") + Output + [1] 1 3 2 + +# local_scan_1_ecount_them_impl errors + + Code + local_scan_1_ecount_them_impl(us = NULL, them = them) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# local_scan_k_ecount_impl basic + + Code + local_scan_k_ecount_impl(graph = g, k = 1) + Output + [1] 1 2 1 + +--- + + Code + local_scan_k_ecount_impl(graph = g, k = 1, weights = c(1, 2), mode = "in") + Output + [1] 1 3 2 + +# local_scan_k_ecount_impl errors + + Code + local_scan_k_ecount_impl(graph = NULL, k = 1) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# local_scan_k_ecount_them_impl basic + + Code + local_scan_k_ecount_them_impl(us = g1, them = g2, k = 1) + Output + [1] 1 2 1 + +--- + + Code + local_scan_k_ecount_them_impl(us = g1, them = g2, k = 1, weights_them = c(1, 2), + mode = "in") + Output + [1] 1 3 2 + +# local_scan_k_ecount_them_impl errors + + Code + local_scan_k_ecount_them_impl(us = NULL, them = them, k = 1) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# local_scan_neighborhood_ecount_impl basic + + Code + local_scan_neighborhood_ecount_impl(graph = g, neighborhoods = list(1:2, 2:3, 2: + 4, 2)) + Output + [1] 1 1 2 0 + +--- + + Code + local_scan_neighborhood_ecount_impl(graph = g, weights = c(1, 2, 3), + neighborhoods = list(1:2, 1:3, 2:4, 1)) + Output + [1] 1 3 5 0 + +# local_scan_neighborhood_ecount_impl errors + + Code + local_scan_neighborhood_ecount_impl(graph = NULL, neighborhoods = list(1:2, 2:3)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# local_scan_subset_ecount_impl basic + + Code + local_scan_subset_ecount_impl(graph = g, subsets = list(c(1, 2), c(2, 3))) + Output + [1] 1 1 + +--- + + Code + local_scan_subset_ecount_impl(graph = g, weights = c(1, 2, 3), subsets = list(c( + 1, 2), c(2, 3))) + Output + [1] 1 2 + +# local_scan_subset_ecount_impl errors + + Code + local_scan_subset_ecount_impl(graph = g, subsets = list(1:2, letters[2:3])) + Condition + Error in `.x - 1`: + ! non-numeric argument to binary operator + +# list_triangles_impl basic + + Code + list_triangles_impl(graph = g) + Output + + 0/3 vertices: + +# list_triangles_impl errors + + Code + list_triangles_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# join_impl basic + + Code + join_impl(left = g1, right = g2) + Output + IGRAPH U--- 6 13 -- + + edges: + [1] 1--2 2--3 4--5 5--6 1--4 1--5 1--6 2--4 2--5 2--6 3--4 3--5 3--6 + +# join_impl errors + + Code + join_impl(left = NULL, right = right) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# induced_subgraph_map_impl basic + + Code + induced_subgraph_map_impl(graph = g, vids = 1:2, impl = "auto") + Output + $res + IGRAPH U--- 2 1 -- + + edge: + [1] 1--2 + + $map + [1] 2 3 1 + + $invmap + [1] 1 2 + + +--- + + Code + induced_subgraph_map_impl(graph = g, vids = 1:2, impl = "copy_and_delete") + Output + $res + IGRAPH U--- 2 1 -- + + edge: + [1] 1--2 + + $map + [1] 2 3 1 + + $invmap + [1] 1 2 + + +# induced_subgraph_map_impl errors + + Code + induced_subgraph_map_impl(graph = NULL, vids = 1:2, impl = "auto") + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# mycielskian_impl basic + + Code + mycielskian_impl(graph = g) + Output + IGRAPH U--- 7 9 -- + + edges: + [1] 1--2 2--3 1--5 2--4 2--6 3--5 4--7 5--7 6--7 + +--- + + Code + mycielskian_impl(graph = g, k = 2) + Output + IGRAPH U--- 15 34 -- + + edges: + [1] 1-- 2 2-- 3 1-- 5 2-- 4 2-- 6 3-- 5 4-- 7 5-- 7 6-- 7 1-- 9 + [11] 2-- 8 2--10 3-- 9 1--12 5-- 8 2--11 4-- 9 2--13 6-- 9 3--12 + [21] 5--10 4--14 7--11 5--14 7--12 6--14 7--13 8--15 9--15 10--15 + [31] 11--15 12--15 13--15 14--15 + +# mycielskian_impl errors + + Code + mycielskian_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# product_impl basic + + Code + product_impl(g1 = g1, g2 = g2) + Output + IGRAPH U--- 9 12 -- + + edges: + [1] 1--4 2--5 3--6 4--7 5--8 6--9 1--2 4--5 7--8 2--3 5--6 8--9 + +--- + + Code + product_impl(g1 = g1, g2 = g2, type = "tensor") + Output + IGRAPH U--- 9 8 -- + + edges: + [1] 1--5 2--4 2--6 3--5 4--8 5--7 5--9 6--8 + +# product_impl errors + + Code + product_impl(g1 = NULL, g2 = g2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# rooted_product_impl basic + + Code + rooted_product_impl(g1 = g1, g2 = g2, root = 1) + Output + IGRAPH U--- 9 8 -- + + edges: + [1] 1--4 4--7 1--2 4--5 7--8 2--3 5--6 8--9 + +# rooted_product_impl errors + + Code + rooted_product_impl(g1 = NULL, g2 = g2, root = 1) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# gomory_hu_tree_impl basic + + Code + gomory_hu_tree_impl(graph = g) + Output + $tree + IGRAPH U--- 3 2 -- + + edges: + [1] 1--2 2--3 + + $flows + [1] 1 1 + + +--- + + Code + gomory_hu_tree_impl(graph = g, capacity = c(1, 2)) + Output + $tree + IGRAPH U--- 3 2 -- + + edges: + [1] 1--2 2--3 + + $flows + [1] 1 2 + + +# gomory_hu_tree_impl errors + + Code + gomory_hu_tree_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# maxflow_impl basic + + Code + maxflow_impl(graph = g, source = 1, target = 3) + Output + $value + [1] 1 + + $flow + [1] 1 1 + + $cut + + 1/2 edge: + [1] 2--3 + + $partition1 + + 2/3 vertices: + [1] 1 2 + + $partition2 + + 1/3 vertex: + [1] 3 + + $stats + $stats$nopush + [1] 1 + + $stats$norelabel + [1] 0 + + $stats$nogap + [1] 0 + + $stats$nogapnodes + [1] 0 + + $stats$nobfs + [1] 1 + + + +--- + + Code + maxflow_impl(graph = g, source = 1, target = 3, capacity = c(1, 2)) + Output + $value + [1] 1 + + $flow + [1] 1 1 + + $cut + + 1/2 edge: + [1] 1--2 + + $partition1 + + 1/3 vertex: + [1] 1 + + $partition2 + + 2/3 vertices: + [1] 2 3 + + $stats + $stats$nopush + [1] 1 + + $stats$norelabel + [1] 0 + + $stats$nogap + [1] 0 + + $stats$nogapnodes + [1] 0 + + $stats$nobfs + [1] 1 + + + +# maxflow_impl errors + + Code + maxflow_impl(graph = NULL, source = 1, target = 3) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# residual_graph_impl basic + + Code + residual_graph_impl(graph = g, capacity = c(1, 2), flow = c(1, 2)) + Output + $residual + IGRAPH D--- 3 0 -- + + edges: + + $residual_capacity + numeric(0) + + +# residual_graph_impl errors + + Code + residual_graph_impl(graph = NULL, capacity = c(1, 2), flow = c(1, 2)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# reverse_residual_graph_impl basic + + Code + reverse_residual_graph_impl(graph = g, capacity = c(1, 2), flow = c(1, 2)) + Output + IGRAPH D--- 3 2 -- + + edges: + [1] 2->1 3->2 + +# reverse_residual_graph_impl errors + + Code + reverse_residual_graph_impl(graph = NULL, capacity = c(1, 2), flow = c(1, 2)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# st_mincut_impl basic + + Code + st_mincut_impl(graph = g, source = 1, target = 3) + Output + $value + [1] 1 + + $cut + + 1/2 edge: + [1] 2--3 + + $partition1 + + 2/3 vertices: + [1] 1 2 + + $partition2 + + 1/3 vertex: + [1] 3 + + +--- + + Code + st_mincut_impl(graph = g, source = 1, target = 3, capacity = c(1, 2)) + Output + $value + [1] 1 + + $cut + + 1/2 edge: + [1] 1--2 + + $partition1 + + 1/3 vertex: + [1] 1 + + $partition2 + + 2/3 vertices: + [1] 2 3 + + +# st_mincut_impl errors + + Code + st_mincut_impl(graph = NULL, source = 1, target = 3) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# dominator_tree_impl basic + + Code + dominator_tree_impl(graph = g, root = 1) + Output + $dom + [1] 0 1 2 + + $domtree + IGRAPH D--- 3 2 -- + + edges: + [1] 1->2 2->3 + + $leftout + + 0/3 vertices: + + +--- + + Code + dominator_tree_impl(graph = g, root = 1, mode = "in") + Output + $dom + [1] 0 -1 -1 + + $domtree + IGRAPH D--- 3 0 -- + + edges: + + $leftout + + 2/3 vertices: + [1] 2 3 + + +# dominator_tree_impl errors + + Code + dominator_tree_impl(graph = NULL, root = 1) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# all_st_cuts_impl basic + + Code + all_st_cuts_impl(graph = g, source = 1, target = 3) + Output + $cuts + $cuts[[1]] + + 1/2 edge: + [1] 1->2 + + $cuts[[2]] + + 1/2 edge: + [1] 2->3 + + + $partition1s + $partition1s[[1]] + + 1/3 vertex: + [1] 1 + + $partition1s[[2]] + + 2/3 vertices: + [1] 1 2 + + + +# all_st_cuts_impl errors + + Code + all_st_cuts_impl(graph = NULL, source = 1, target = 3) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# all_st_mincuts_impl basic + + Code + all_st_mincuts_impl(graph = g, source = 1, target = 3) + Output + $value + [1] 1 + + $cuts + $cuts[[1]] + + 1/2 edge: + [1] 1->2 + + $cuts[[2]] + + 1/2 edge: + [1] 2->3 + + + $partition1s + $partition1s[[1]] + + 1/3 vertex: + [1] 1 + + $partition1s[[2]] + + 2/3 vertices: + [1] 1 2 + + + +--- + + Code + all_st_mincuts_impl(graph = g, source = 1, target = 3, capacity = c(1, 2)) + Output + $value + [1] 1 + + $cuts + $cuts[[1]] + + 1/2 edge: + [1] 1->2 + + + $partition1s + $partition1s[[1]] + + 1/3 vertex: + [1] 1 + + + +# all_st_mincuts_impl errors + + Code + all_st_mincuts_impl(graph = NULL, source = 1, target = 3) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# even_tarjan_reduction_impl basic + + Code + even_tarjan_reduction_impl(graph = g) + Output + $graphbar + IGRAPH D--- 6 7 -- + + edges: + [1] 1->4 2->5 3->6 5->1 4->2 6->2 5->3 + + $capacity + [1] 1 1 1 3 3 3 3 + + +# even_tarjan_reduction_impl errors + + Code + even_tarjan_reduction_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# is_separator_impl basic + + Code + is_separator_impl(graph = g, candidate = 1:2) + Output + [1] FALSE + +# is_separator_impl errors + + Code + is_separator_impl(graph = NULL, candidate = 1:2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# is_minimal_separator_impl basic + + Code + is_minimal_separator_impl(graph = g, candidate = 1:2) + Output + [1] FALSE + +# is_minimal_separator_impl errors + + Code + is_minimal_separator_impl(graph = NULL, candidate = 1:2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# all_minimal_st_separators_impl basic + + Code + all_minimal_st_separators_impl(graph = g) + Output + [[1]] + + 1/3 vertex: + [1] 2 + + +# all_minimal_st_separators_impl errors + + Code + all_minimal_st_separators_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# minimum_size_separators_impl basic + + Code + minimum_size_separators_impl(graph = g) + Output + [[1]] + + 1/3 vertex: + [1] 2 + + +# minimum_size_separators_impl errors + + Code + minimum_size_separators_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# isoclass_impl basic + + Code + isoclass_impl(graph = g) + Output + [1] 2 + +# isoclass_impl errors + + Code + isoclass_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# isomorphic_impl basic + + Code + isomorphic_impl(graph1 = g1, graph2 = g2) + Output + [1] TRUE + +# isomorphic_impl errors + + Code + isomorphic_impl(graph1 = NULL, graph2 = graph2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# isoclass_subgraph_impl basic + + Code + isoclass_subgraph_impl(graph = g, vids = c(1, 2, 3)) + Output + [1] 2 + +# isoclass_subgraph_impl errors + + Code + isoclass_subgraph_impl(graph = NULL, vids = 1:2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# isoclass_create_impl basic + + Code + isoclass_create_impl(size = 3, number = 1) + Output + IGRAPH D--- 3 1 -- + + edge: + [1] 2->1 + +--- + + Code + isoclass_create_impl(size = 3, number = 1, directed = FALSE) + Output + IGRAPH U--- 3 1 -- + + edge: + [1] 1--2 + +# isoclass_create_impl errors + + Code + isoclass_create_impl(size = "a", number = 1) + Condition + Warning in `isoclass_create_impl()`: + NAs introduced by coercion + Error in `isoclass_create_impl()`: + ! At rinterface_extra.c:xx : The value nan is not representable as an integer. Invalid value + +# isomorphic_vf2_impl basic + + Code + isomorphic_vf2_impl(graph1 = g1, graph2 = g2) + Output + $iso + [1] TRUE + + $map12 + [1] 1 2 3 + + $map21 + [1] 1 2 3 + + +--- + + Code + isomorphic_vf2_impl(graph1 = g1, graph2 = g2, vertex_color1 = c(1, 2, 3), + vertex_color2 = c(1, 2, 3), edge_color1 = c(1, 2), edge_color2 = c(1, 2)) + Output + $iso + [1] TRUE + + $map12 + [1] 1 2 3 + + $map21 + [1] 1 2 3 + + +# isomorphic_vf2_impl errors + + Code + isomorphic_vf2_impl(graph1 = NULL, graph2 = graph2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# count_isomorphisms_vf2_impl basic + + Code + count_isomorphisms_vf2_impl(graph1 = g1, graph2 = g2) + Output + [1] 2 + +--- + + Code + count_isomorphisms_vf2_impl(graph1 = g1, graph2 = g2, vertex_color1 = c(1, 2, 3), + vertex_color2 = c(1, 2, 3), edge_color1 = c(1, 2), edge_color2 = c(1, 2)) + Output + [1] 1 + +# count_isomorphisms_vf2_impl errors + + Code + count_isomorphisms_vf2_impl(graph1 = NULL, graph2 = graph2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# get_isomorphisms_vf2_impl basic + + Code + get_isomorphisms_vf2_impl(graph1 = g1, graph2 = g2) + Output + [[1]] + [1] 0 1 2 + + [[2]] + [1] 2 1 0 + + +--- + + Code + get_isomorphisms_vf2_impl(graph1 = g1, graph2 = g2, vertex_color1 = c(1, 2, 3), + vertex_color2 = c(1, 2, 3), edge_color1 = c(1, 2), edge_color2 = c(1, 2)) + Output + [[1]] + [1] 0 1 2 + + +# get_isomorphisms_vf2_impl errors + + Code + get_isomorphisms_vf2_impl(graph1 = NULL, graph2 = graph2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# subisomorphic_impl basic + + Code + subisomorphic_impl(graph1 = g1, graph2 = g2) + Output + [1] TRUE + +# subisomorphic_impl errors + + Code + subisomorphic_impl(graph1 = NULL, graph2 = graph2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# subisomorphic_vf2_impl basic + + Code + subisomorphic_vf2_impl(graph1 = g1, graph2 = g2) + Output + $iso + [1] TRUE + + $map12 + [1] 1 2 3 + + $map21 + [1] 1 2 3 + + +--- + + Code + subisomorphic_vf2_impl(graph1 = g1, graph2 = g2, vertex_color1 = c(1, 2, 3), + vertex_color2 = c(1, 2, 3), edge_color1 = c(1, 2), edge_color2 = c(1, 2)) + Output + $iso + [1] TRUE + + $map12 + [1] 1 2 3 + + $map21 + [1] 1 2 3 + + +# subisomorphic_vf2_impl errors + + Code + subisomorphic_vf2_impl(graph1 = NULL, graph2 = graph2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# count_subisomorphisms_vf2_impl basic + + Code + count_subisomorphisms_vf2_impl(graph1 = g1, graph2 = g2) + Output + [1] 2 + +--- + + Code + count_subisomorphisms_vf2_impl(graph1 = g1, graph2 = g2, vertex_color1 = c(1, 2, + 3), vertex_color2 = c(1, 2, 3), edge_color1 = c(1, 2), edge_color2 = c(1, 2)) + Output + [1] 1 + +# count_subisomorphisms_vf2_impl errors + + Code + count_subisomorphisms_vf2_impl(graph1 = NULL, graph2 = graph2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# get_subisomorphisms_vf2_impl basic + + Code + get_subisomorphisms_vf2_impl(graph1 = g1, graph2 = g2) + Output + [[1]] + [1] 0 1 2 + + [[2]] + [1] 2 1 0 + + +--- + + Code + get_subisomorphisms_vf2_impl(graph1 = g1, graph2 = g2, vertex_color1 = c(1, 2, + 3), vertex_color2 = c(1, 2, 3), edge_color1 = c(1, 2), edge_color2 = c(1, 2)) + Output + [[1]] + [1] 0 1 2 + + +# get_subisomorphisms_vf2_impl errors + + Code + get_subisomorphisms_vf2_impl(graph1 = NULL, graph2 = graph2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# canonical_permutation_impl basic + + Code + canonical_permutation_impl(graph = g) + Output + $labeling + [1] 2 3 1 + + $info + $info$nof_nodes + [1] 3 + + $info$nof_leaf_nodes + [1] 3 + + $info$nof_bad_nodes + [1] 0 + + $info$nof_canupdates + [1] 1 + + $info$max_level + [1] 1 + + $info$group_size + [1] "2" + + + +--- + + Code + canonical_permutation_impl(graph = g, colors = c(1, 2, 3), sh = "fl") + Output + $labeling + [1] 1 2 3 + + $info + $info$nof_nodes + [1] 1 + + $info$nof_leaf_nodes + [1] 1 + + $info$nof_bad_nodes + [1] 0 + + $info$nof_canupdates + [1] 0 + + $info$max_level + [1] 0 + + $info$group_size + [1] "1" + + + +# canonical_permutation_impl errors + + Code + canonical_permutation_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# permute_vertices_impl basic + + Code + permute_vertices_impl(graph = g, permutation = 3:1) + Output + IGRAPH U--- 3 2 -- + + edges: + [1] 2--3 1--2 + +# permute_vertices_impl errors + + Code + permute_vertices_impl(graph = NULL, permutation = 3:1) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# isomorphic_bliss_impl basic + + Code + isomorphic_bliss_impl(graph1 = g1, graph2 = g2) + Output + $iso + [1] TRUE + + $map12 + [1] 1 2 3 + + $map21 + [1] 1 2 3 + + $info1 + $info1$nof_nodes + [1] 3 + + $info1$nof_leaf_nodes + [1] 3 + + $info1$nof_bad_nodes + [1] 0 + + $info1$nof_canupdates + [1] 1 + + $info1$max_level + [1] 1 + + $info1$group_size + [1] "2" + + + $info2 + $info2$nof_nodes + [1] 3 + + $info2$nof_leaf_nodes + [1] 3 + + $info2$nof_bad_nodes + [1] 0 + + $info2$nof_canupdates + [1] 1 + + $info2$max_level + [1] 1 + + $info2$group_size + [1] "2" + + + +--- + + Code + isomorphic_bliss_impl(graph1 = g1, graph2 = g2, colors1 = c(1, 2, 3), colors2 = c( + 1, 2, 3), sh = "fl") + Output + $iso + [1] TRUE + + $map12 + [1] 1 2 3 + + $map21 + [1] 1 2 3 + + $info1 + $info1$nof_nodes + [1] 1 + + $info1$nof_leaf_nodes + [1] 1 + + $info1$nof_bad_nodes + [1] 0 + + $info1$nof_canupdates + [1] 0 + + $info1$max_level + [1] 0 + + $info1$group_size + [1] "1" + + + $info2 + $info2$nof_nodes + [1] 1 + + $info2$nof_leaf_nodes + [1] 1 + + $info2$nof_bad_nodes + [1] 0 + + $info2$nof_canupdates + [1] 0 + + $info2$max_level + [1] 0 + + $info2$group_size + [1] "1" + + + +# isomorphic_bliss_impl errors + + Code + isomorphic_bliss_impl(graph1 = NULL, graph2 = graph2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# count_automorphisms_impl basic + + Code + count_automorphisms_impl(graph = g) + Output + $nof_nodes + [1] 3 + + $nof_leaf_nodes + [1] 3 + + $nof_bad_nodes + [1] 0 + + $nof_canupdates + [1] 1 + + $max_level + [1] 1 + + $group_size + [1] "2" + + +--- + + Code + count_automorphisms_impl(graph = g, colors = c(1, 2, 3), sh = "fl") + Output + $nof_nodes + [1] 1 + + $nof_leaf_nodes + [1] 1 + + $nof_bad_nodes + [1] 0 + + $nof_canupdates + [1] 0 + + $max_level + [1] 0 + + $group_size + [1] "1" + + +# count_automorphisms_impl errors + + Code + count_automorphisms_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# automorphism_group_impl basic + + Code + automorphism_group_impl(graph = g) + Output + [[1]] + + 3/3 vertices: + [1] 3 2 1 + + +--- + + Code + automorphism_group_impl(graph = g, colors = c(1, 2, 3), sh = "fl", details = TRUE) + Output + $generators + list() + + $info + $info$nof_nodes + [1] 1 + + $info$nof_leaf_nodes + [1] 1 + + $info$nof_bad_nodes + [1] 0 + + $info$nof_canupdates + [1] 0 + + $info$max_level + [1] 0 + + $info$group_size + [1] "1" + + + +# automorphism_group_impl errors + + Code + automorphism_group_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# simplify_and_colorize_impl basic + + Code + simplify_and_colorize_impl(graph = g) + Output + $res + IGRAPH U--- 3 2 -- + + edges: + [1] 1--2 2--3 + + $vertex_color + [1] 0 0 0 + + $edge_color + [1] 1 1 + + +# simplify_and_colorize_impl errors + + Code + simplify_and_colorize_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# graph_count_impl basic + + Code + graph_count_impl(n = 3) + Output + [1] 4 + +--- + + Code + graph_count_impl(n = 3, directed = TRUE) + Output + [1] 16 + +# graph_count_impl errors + + Code + graph_count_impl(n = "a") + Condition + Warning in `graph_count_impl()`: + NAs introduced by coercion + Error in `graph_count_impl()`: + ! At rinterface_extra.c:xx : The value nan is not representable as an integer. Invalid value + +# is_matching_impl basic + + Code + is_matching_impl(graph = g, matching = 1:2) + Output + [1] FALSE + +--- + + Code + is_matching_impl(graph = g, types = c(TRUE, FALSE, TRUE), matching = 1:2) + Output + [1] FALSE + +# is_matching_impl errors + + Code + is_matching_impl(graph = NULL, matching = 1:2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# is_maximal_matching_impl basic + + Code + is_maximal_matching_impl(graph = g, matching = 1:2) + Output + [1] FALSE + +--- + + Code + is_maximal_matching_impl(graph = g, types = c(TRUE, FALSE, TRUE), matching = 1: + 2) + Output + [1] FALSE + +# is_maximal_matching_impl errors + + Code + is_maximal_matching_impl(graph = NULL, matching = 1:2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# maximum_bipartite_matching_impl basic + + Code + maximum_bipartite_matching_impl(graph = g, types = c(TRUE, FALSE, TRUE)) + Output + $matching_size + [1] 1 + + $matching_weight + [1] 1 + + $matching + [1] 2 1 0 + + +--- + + Code + maximum_bipartite_matching_impl(graph = g, types = c(TRUE, FALSE, TRUE), + weights = c(1, 2), eps = 1e-05) + Output + $matching_size + [1] 1 + + $matching_weight + [1] 2 + + $matching + [1] 0 3 2 + + +# maximum_bipartite_matching_impl errors + + Code + maximum_bipartite_matching_impl(graph = NULL, types = c(TRUE, FALSE, TRUE)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# adjacency_spectral_embedding_impl basic + + Code + adjacency_spectral_embedding_impl(graph = g, no = 2) + Output + $X + [,1] [,2] + [1,] 0.6718598 -0.4487712 + [2,] 1.1328501 0.5323058 + [3,] 0.6718598 -0.4487712 + + $Y + [,1] [,2] + [1,] 0.6718598 -0.4487712 + [2,] 1.1328501 0.5323058 + [3,] 0.6718598 -0.4487712 + + $D + [1] 2.1861407 -0.6861407 + + $options + $options$bmat + [1] "I" + + $options$n + [1] 3 + + $options$which + [1] "LM" + + $options$nev + [1] 2 + + $options$tol + [1] 0 + + $options$ncv + [1] 3 + + $options$ldv + [1] 0 + + $options$ishift + [1] 1 + + $options$maxiter + [1] 3000 + + $options$nb + [1] 1 + + $options$mode + [1] 1 + + $options$start + [1] 1 + + $options$sigma + [1] 0 + + $options$sigmai + [1] 0 + + $options$info + [1] 0 + + $options$iter + [1] 1 + + $options$nconv + [1] 2 + + $options$numop + [1] 3 + + $options$numopb + [1] 0 + + $options$numreo + [1] 2 + + + +--- + + Code + adjacency_spectral_embedding_impl(graph = g, no = 2, weights = c(1, 2), which = "la", + scaled = FALSE, cvec = c(1, 2, 3), options = list(maxiter = 10)) + Output + $X + [,1] [,2] + [1,] 0.1720265 -0.7864357 + [2,] 0.6311790 -0.3743620 + [3,] 0.7563200 0.4912963 + + $Y + [,1] [,2] + [1,] 0.1720265 -0.7864357 + [2,] 0.6311790 -0.3743620 + [3,] 0.7563200 0.4912963 + + $D + [1] 4.669079 1.476024 + + $options + $options$bmat + [1] "I" + + $options$n + [1] 3 + + $options$which + [1] "LA" + + $options$nev + [1] 2 + + $options$tol + [1] 0 + + $options$ncv + [1] 3 + + $options$ldv + [1] 0 + + $options$ishift + [1] 1 + + $options$maxiter + [1] 10 + + $options$nb + [1] 1 + + $options$mode + [1] 1 + + $options$start + [1] 1 + + $options$sigma + [1] 0 + + $options$sigmai + [1] 0 + + $options$info + [1] 0 + + $options$iter + [1] 1 + + $options$nconv + [1] 2 + + $options$numop + [1] 3 + + $options$numopb + [1] 0 + + $options$numreo + [1] 2 + + + +# adjacency_spectral_embedding_impl errors + + Code + adjacency_spectral_embedding_impl(graph = NULL, no = 2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# laplacian_spectral_embedding_impl basic + + Code + laplacian_spectral_embedding_impl(graph = g, no = 2) + Output + $X + [,1] [,2] + [1,] -0.7071068 -0.7071068 + [2,] 1.4142136 0.0000000 + [3,] -0.7071068 0.7071068 + + $Y + [,1] [,2] + [1,] -0.7071068 -0.7071068 + [2,] 1.4142136 0.0000000 + [3,] -0.7071068 0.7071068 + + $D + [1] 3 1 + + $options + $options$bmat + [1] "I" + + $options$n + [1] 3 + + $options$which + [1] "LM" + + $options$nev + [1] 2 + + $options$tol + [1] 0 + + $options$ncv + [1] 3 + + $options$ldv + [1] 0 + + $options$ishift + [1] 1 + + $options$maxiter + [1] 3000 + + $options$nb + [1] 1 + + $options$mode + [1] 1 + + $options$start + [1] 1 + + $options$sigma + [1] 0 + + $options$sigmai + [1] 0 + + $options$info + [1] 0 + + $options$iter + [1] 1 + + $options$nconv + [1] 2 + + $options$numop + [1] 3 + + $options$numopb + [1] 0 + + $options$numreo + [1] 3 + + + +# laplacian_spectral_embedding_impl errors + + Code + laplacian_spectral_embedding_impl(graph = NULL, no = 2) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# eigen_adjacency_impl basic + + Code + eigen_adjacency_impl(graph = g) + Output + $options + $options$bmat + [1] "I" + + $options$n + [1] 3 + + $options$which + [1] "LM" + + $options$nev + [1] 1 + + $options$tol + [1] 0 + + $options$ncv + [1] 2 + + $options$ldv + [1] 0 + + $options$ishift + [1] 1 + + $options$maxiter + [1] 3000 + + $options$nb + [1] 1 + + $options$mode + [1] 1 + + $options$start + [1] 0 + + $options$sigma + [1] 0 + + $options$sigmai + [1] 0 + + $options$info + [1] 0 + + $options$iter + [1] 29 + + $options$nconv + [1] 1 + + $options$numop + [1] 30 + + $options$numopb + [1] 0 + + $options$numreo + [1] 16 + + + $values + [1] -1.414214 + + $vectors + [,1] + [1,] -0.5000000 + [2,] 0.7071068 + [3,] -0.5000000 + + $cmplxvalues + complex(0) + + $cmplxvectors + <0 x 0 matrix> + + +--- + + Code + eigen_adjacency_impl(graph = g, algorithm = "lapack", which = list(which = "LA"), + options = list(maxiter = 10)) + Condition + Error in `eigen_adjacency_impl()`: + ! At vendor/cigraph/src/linalg/eigen.c:xx : 'LAPACK' algorithm not implemented yet, Unimplemented function call + +# eigen_adjacency_impl errors + + Code + eigen_adjacency_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# power_law_fit_impl basic + + Code + power_law_fit_impl(data = c(1, 2, 3)) + Output + $continuous + [1] FALSE + + $alpha + [1] 1.646771 + + $xmin + [1] 1 + + $logLik + [1] -5.272517 + + $KS.stat + [1] 0.2640998 + + +--- + + Code + power_law_fit_impl(data = c(1, 2, 3), xmin = 1, force_continuous = TRUE) + Output + $continuous + [1] TRUE + + $alpha + [1] 2.116221 + + $xmin + [1] 1 + + $logLik + [1] -3.461912 + + $KS.stat + [1] 0.3533555 + + +# power_law_fit_impl errors + + Code + power_law_fit_impl(data = "a") + Condition + Warning in `power_law_fit_impl()`: + NAs introduced by coercion + Error in `power_law_fit_impl()`: + ! At vendor/cigraph/src/misc/power_law_fit.c:xx : xmin must be greater than zero, Invalid value + +# sir_impl basic + + Code + sir_impl(graph = g, beta = 0.1, gamma = 0.1) + Output + [[1]] + [[1]]$times + [1] 0.000000 6.326537 8.018361 8.809852 9.405480 17.386752 + + [[1]]$NS + [1] 2 1 0 0 0 0 + + [[1]]$NI + [1] 1 2 3 2 1 0 + + [[1]]$NR + [1] 0 0 0 1 2 3 + + + [[2]] + [[2]]$times + [1] 0.000000 3.674354 13.783038 13.921168 + + [[2]]$NS + [1] 2 1 1 1 + + [[2]]$NI + [1] 1 2 1 0 + + [[2]]$NR + [1] 0 0 1 2 + + + [[3]] + [[3]]$times + [1] 0.000000 3.277542 7.521770 16.781182 18.515742 29.375613 + + [[3]]$NS + [1] 2 1 0 0 0 0 + + [[3]]$NI + [1] 1 2 3 2 1 0 + + [[3]]$NR + [1] 0 0 0 1 2 3 + + + [[4]] + [[4]]$times + [1] 0.0000000 0.3027921 + + [[4]]$NS + [1] 2 2 + + [[4]]$NI + [1] 1 0 + + [[4]]$NR + [1] 0 1 + + + [[5]] + [[5]]$times + [1] 0.000000 3.559451 5.615586 20.582742 + + [[5]]$NS + [1] 2 1 1 1 + + [[5]]$NI + [1] 1 2 1 0 + + [[5]]$NR + [1] 0 0 1 2 + + + [[6]] + [[6]]$times + [1] 0.0000000 0.7300885 0.7328203 1.2536518 1.9258569 5.1406208 + + [[6]]$NS + [1] 2 1 0 0 0 0 + + [[6]]$NI + [1] 1 2 3 2 1 0 + + [[6]]$NR + [1] 0 0 0 1 2 3 + + + [[7]] + [[7]]$times + [1] 0.000000 0.865533 + + [[7]]$NS + [1] 2 2 + + [[7]]$NI + [1] 1 0 + + [[7]]$NR + [1] 0 1 + + + [[8]] + [[8]]$times + [1] 0.00000 10.68605 + + [[8]]$NS + [1] 2 2 + + [[8]]$NI + [1] 1 0 + + [[8]]$NR + [1] 0 1 + + + [[9]] + [[9]]$times + [1] 0.000000 2.185910 7.669126 16.635095 21.440723 23.497554 + + [[9]]$NS + [1] 2 1 0 0 0 0 + + [[9]]$NI + [1] 1 2 3 2 1 0 + + [[9]]$NR + [1] 0 0 0 1 2 3 + + + [[10]] + [[10]]$times + [1] 0.000000 4.105424 4.424244 22.891743 24.099505 32.514828 + + [[10]]$NS + [1] 2 1 1 0 0 0 + + [[10]]$NI + [1] 1 2 1 2 1 0 + + [[10]]$NR + [1] 0 0 1 1 2 3 + + + [[11]] + [[11]]$times + [1] 0.00000 4.93042 21.00935 21.07441 23.37619 41.26694 + + [[11]]$NS + [1] 2 1 0 0 0 0 + + [[11]]$NI + [1] 1 2 3 2 1 0 + + [[11]]$NR + [1] 0 0 0 1 2 3 + + + [[12]] + [[12]]$times + [1] 0.00000 15.47343 26.09187 38.01744 43.76847 50.41068 + + [[12]]$NS + [1] 2 1 0 0 0 0 + + [[12]]$NI + [1] 1 2 3 2 1 0 + + [[12]]$NR + [1] 0 0 0 1 2 3 + + + [[13]] + [[13]]$times + [1] 0.000000 3.540437 + + [[13]]$NS + [1] 2 2 + + [[13]]$NI + [1] 1 0 + + [[13]]$NR + [1] 0 1 + + + [[14]] + [[14]]$times + [1] 0.000000 7.081426 7.638086 11.569527 + + [[14]]$NS + [1] 2 1 1 1 + + [[14]]$NI + [1] 1 2 1 0 + + [[14]]$NR + [1] 0 0 1 2 + + + [[15]] + [[15]]$times + [1] 0.00000 15.60443 15.66654 20.19745 22.11224 42.62196 + + [[15]]$NS + [1] 2 1 0 0 0 0 + + [[15]]$NI + [1] 1 2 3 2 1 0 + + [[15]]$NR + [1] 0 0 0 1 2 3 + + + [[16]] + [[16]]$times + [1] 0.000000 3.239708 17.193626 18.833130 19.040959 35.199892 + + [[16]]$NS + [1] 2 1 1 0 0 0 + + [[16]]$NI + [1] 1 2 1 2 1 0 + + [[16]]$NR + [1] 0 0 1 1 2 3 + + + [[17]] + [[17]]$times + [1] 0.0000000 0.2300489 1.8970602 6.9851496 16.0587095 28.8528567 + + [[17]]$NS + [1] 2 1 0 0 0 0 + + [[17]]$NI + [1] 1 2 3 2 1 0 + + [[17]]$NR + [1] 0 0 0 1 2 3 + + + [[18]] + [[18]]$times + [1] 0.000000 4.674879 5.319832 17.366640 63.357258 86.262883 + + [[18]]$NS + [1] 2 1 1 0 0 0 + + [[18]]$NI + [1] 1 2 1 2 1 0 + + [[18]]$NR + [1] 0 0 1 1 2 3 + + + [[19]] + [[19]]$times + [1] 0.000000 1.972293 + + [[19]]$NS + [1] 2 2 + + [[19]]$NI + [1] 1 0 + + [[19]]$NR + [1] 0 1 + + + [[20]] + [[20]]$times + [1] 0.000000 3.177922 + + [[20]]$NS + [1] 2 2 + + [[20]]$NI + [1] 1 0 + + [[20]]$NR + [1] 0 1 + + + [[21]] + [[21]]$times + [1] 0.000000 1.994279 2.508129 8.208209 28.478526 36.256169 + + [[21]]$NS + [1] 2 1 0 0 0 0 + + [[21]]$NI + [1] 1 2 3 2 1 0 + + [[21]]$NR + [1] 0 0 0 1 2 3 + + + [[22]] + [[22]]$times + [1] 0.000000 5.226609 14.744785 16.304309 + + [[22]]$NS + [1] 2 1 1 1 + + [[22]]$NI + [1] 1 2 1 0 + + [[22]]$NR + [1] 0 0 1 2 + + + [[23]] + [[23]]$times + [1] 0.000000 3.254634 13.673154 21.069828 + + [[23]]$NS + [1] 2 1 1 1 + + [[23]]$NI + [1] 1 2 1 0 + + [[23]]$NR + [1] 0 0 1 2 + + + [[24]] + [[24]]$times + [1] 0.00000 18.01982 18.36106 44.55144 + + [[24]]$NS + [1] 2 1 1 1 + + [[24]]$NI + [1] 1 2 1 0 + + [[24]]$NR + [1] 0 0 1 2 + + + [[25]] + [[25]]$times + [1] 0.00000 18.09036 30.47469 36.51570 + + [[25]]$NS + [1] 2 1 1 1 + + [[25]]$NI + [1] 1 2 1 0 + + [[25]]$NR + [1] 0 0 1 2 + + + [[26]] + [[26]]$times + [1] 0.00000 11.21296 + + [[26]]$NS + [1] 2 2 + + [[26]]$NI + [1] 1 0 + + [[26]]$NR + [1] 0 1 + + + [[27]] + [[27]]$times + [1] 0.000000 1.605373 + + [[27]]$NS + [1] 2 2 + + [[27]]$NI + [1] 1 0 + + [[27]]$NR + [1] 0 1 + + + [[28]] + [[28]]$times + [1] 0.000000 3.448751 12.086502 17.941228 + + [[28]]$NS + [1] 2 1 1 1 + + [[28]]$NI + [1] 1 2 1 0 + + [[28]]$NR + [1] 0 0 1 2 + + + [[29]] + [[29]]$times + [1] 0.000000 8.277924 + + [[29]]$NS + [1] 2 2 + + [[29]]$NI + [1] 1 0 + + [[29]]$NR + [1] 0 1 + + + [[30]] + [[30]]$times + [1] 0.000000 9.146159 + + [[30]]$NS + [1] 2 2 + + [[30]]$NI + [1] 1 0 + + [[30]]$NR + [1] 0 1 + + + [[31]] + [[31]]$times + [1] 0.00000000 0.07833588 + + [[31]]$NS + [1] 2 2 + + [[31]]$NI + [1] 1 0 + + [[31]]$NR + [1] 0 1 + + + [[32]] + [[32]]$times + [1] 0.000000 7.825191 + + [[32]]$NS + [1] 2 2 + + [[32]]$NI + [1] 1 0 + + [[32]]$NR + [1] 0 1 + + + [[33]] + [[33]]$times + [1] 0.0000000 0.4018017 + + [[33]]$NS + [1] 2 2 + + [[33]]$NI + [1] 1 0 + + [[33]]$NR + [1] 0 1 + + + [[34]] + [[34]]$times + [1] 0.000000 1.433794 + + [[34]]$NS + [1] 2 2 + + [[34]]$NI + [1] 1 0 + + [[34]]$NR + [1] 0 1 + + + [[35]] + [[35]]$times + [1] 0.00000000 0.06959151 2.61176819 2.76819228 + + [[35]]$NS + [1] 2 1 1 1 + + [[35]]$NI + [1] 1 2 1 0 + + [[35]]$NR + [1] 0 0 1 2 + + + [[36]] + [[36]]$times + [1] 0.000000 1.539839 17.502742 21.550799 31.779748 59.056912 + + [[36]]$NS + [1] 2 1 0 0 0 0 + + [[36]]$NI + [1] 1 2 3 2 1 0 + + [[36]]$NR + [1] 0 0 0 1 2 3 + + + [[37]] + [[37]]$times + [1] 0.000000 8.878624 + + [[37]]$NS + [1] 2 2 + + [[37]]$NI + [1] 1 0 + + [[37]]$NR + [1] 0 1 + + + [[38]] + [[38]]$times + [1] 0.000000 6.855525 + + [[38]]$NS + [1] 2 2 + + [[38]]$NI + [1] 1 0 + + [[38]]$NR + [1] 0 1 + + + [[39]] + [[39]]$times + [1] 0.000000 2.628739 3.809460 7.051204 + + [[39]]$NS + [1] 2 1 1 1 + + [[39]]$NI + [1] 1 2 1 0 + + [[39]]$NR + [1] 0 0 1 2 + + + [[40]] + [[40]]$times + [1] 0.000000 2.484282 + + [[40]]$NS + [1] 2 2 + + [[40]]$NI + [1] 1 0 + + [[40]]$NR + [1] 0 1 + + + [[41]] + [[41]]$times + [1] 0.0000000 0.8248393 + + [[41]]$NS + [1] 2 2 + + [[41]]$NI + [1] 1 0 + + [[41]]$NR + [1] 0 1 + + + [[42]] + [[42]]$times + [1] 0.000000 2.300359 3.886947 6.810196 7.223496 28.297207 + + [[42]]$NS + [1] 2 1 0 0 0 0 + + [[42]]$NI + [1] 1 2 3 2 1 0 + + [[42]]$NR + [1] 0 0 0 1 2 3 + + + [[43]] + [[43]]$times + [1] 0.00000 5.52241 10.93993 29.15486 + + [[43]]$NS + [1] 2 1 1 1 + + [[43]]$NI + [1] 1 2 1 0 + + [[43]]$NR + [1] 0 0 1 2 + + + [[44]] + [[44]]$times + [1] 0.000000 9.526317 12.154710 21.171748 + + [[44]]$NS + [1] 2 1 1 1 + + [[44]]$NI + [1] 1 2 1 0 + + [[44]]$NR + [1] 0 0 1 2 + + + [[45]] + [[45]]$times + [1] 0.000000 4.448428 + + [[45]]$NS + [1] 2 2 + + [[45]]$NI + [1] 1 0 + + [[45]]$NR + [1] 0 1 + + + [[46]] + [[46]]$times + [1] 0.0000000 0.0560511 + + [[46]]$NS + [1] 2 2 + + [[46]]$NI + [1] 1 0 + + [[46]]$NR + [1] 0 1 + + + [[47]] + [[47]]$times + [1] 0.00000 11.57560 12.20970 12.58732 26.47299 36.19628 + + [[47]]$NS + [1] 2 1 0 0 0 0 + + [[47]]$NI + [1] 1 2 3 2 1 0 + + [[47]]$NR + [1] 0 0 0 1 2 3 + + + [[48]] + [[48]]$times + [1] 0.000000 3.687231 + + [[48]]$NS + [1] 2 2 + + [[48]]$NI + [1] 1 0 + + [[48]]$NR + [1] 0 1 + + + [[49]] + [[49]]$times + [1] 0.0000000 0.3436458 1.0908931 1.4640857 + + [[49]]$NS + [1] 2 1 1 1 + + [[49]]$NI + [1] 1 2 1 0 + + [[49]]$NR + [1] 0 0 1 2 + + + [[50]] + [[50]]$times + [1] 0.000000 1.536136 + + [[50]]$NS + [1] 2 2 + + [[50]]$NI + [1] 1 0 + + [[50]]$NR + [1] 0 1 + + + [[51]] + [[51]]$times + [1] 0.000000 2.021208 + + [[51]]$NS + [1] 2 2 + + [[51]]$NI + [1] 1 0 + + [[51]]$NR + [1] 0 1 + + + [[52]] + [[52]]$times + [1] 0.00000 4.29424 + + [[52]]$NS + [1] 2 2 + + [[52]]$NI + [1] 1 0 + + [[52]]$NR + [1] 0 1 + + + [[53]] + [[53]]$times + [1] 0.000000 1.884908 5.139700 8.417338 12.272436 15.154107 + + [[53]]$NS + [1] 2 1 0 0 0 0 + + [[53]]$NI + [1] 1 2 3 2 1 0 + + [[53]]$NR + [1] 0 0 0 1 2 3 + + + [[54]] + [[54]]$times + [1] 0.0000000 0.1997796 + + [[54]]$NS + [1] 2 2 + + [[54]]$NI + [1] 1 0 + + [[54]]$NR + [1] 0 1 + + + [[55]] + [[55]]$times + [1] 0.0000000 0.1825065 + + [[55]]$NS + [1] 2 2 + + [[55]]$NI + [1] 1 0 + + [[55]]$NR + [1] 0 1 + + + [[56]] + [[56]]$times + [1] 0.000000 1.913698 2.656593 7.598135 + + [[56]]$NS + [1] 2 1 1 1 + + [[56]]$NI + [1] 1 2 1 0 + + [[56]]$NR + [1] 0 0 1 2 + + + [[57]] + [[57]]$times + [1] 0.000000 3.435708 + + [[57]]$NS + [1] 2 2 + + [[57]]$NI + [1] 1 0 + + [[57]]$NR + [1] 0 1 + + + [[58]] + [[58]]$times + [1] 0.000000 0.583133 5.284710 10.065112 18.657681 21.137430 + + [[58]]$NS + [1] 2 1 1 0 0 0 + + [[58]]$NI + [1] 1 2 1 2 1 0 + + [[58]]$NR + [1] 0 0 1 1 2 3 + + + [[59]] + [[59]]$times + [1] 0.000000 8.526031 + + [[59]]$NS + [1] 2 2 + + [[59]]$NI + [1] 1 0 + + [[59]]$NR + [1] 0 1 + + + [[60]] + [[60]]$times + [1] 0.000000 3.470768 + + [[60]]$NS + [1] 2 2 + + [[60]]$NI + [1] 1 0 + + [[60]]$NR + [1] 0 1 + + + [[61]] + [[61]]$times + [1] 0.000000 2.311806 + + [[61]]$NS + [1] 2 2 + + [[61]]$NI + [1] 1 0 + + [[61]]$NR + [1] 0 1 + + + [[62]] + [[62]]$times + [1] 0.000000 5.603495 + + [[62]]$NS + [1] 2 2 + + [[62]]$NI + [1] 1 0 + + [[62]]$NR + [1] 0 1 + + + [[63]] + [[63]]$times + [1] 0.0000000 0.2376974 + + [[63]]$NS + [1] 2 2 + + [[63]]$NI + [1] 1 0 + + [[63]]$NR + [1] 0 1 + + + [[64]] + [[64]]$times + [1] 0.000000 1.164209 4.169140 7.017509 + + [[64]]$NS + [1] 2 1 1 1 + + [[64]]$NI + [1] 1 2 1 0 + + [[64]]$NR + [1] 0 0 1 2 + + + [[65]] + [[65]]$times + [1] 0.000000 6.415227 6.561435 14.007083 + + [[65]]$NS + [1] 2 1 1 1 + + [[65]]$NI + [1] 1 2 1 0 + + [[65]]$NR + [1] 0 0 1 2 + + + [[66]] + [[66]]$times + [1] 0.00000 14.28491 31.69273 39.51170 + + [[66]]$NS + [1] 2 1 1 1 + + [[66]]$NI + [1] 1 2 1 0 + + [[66]]$NR + [1] 0 0 1 2 + + + [[67]] + [[67]]$times + [1] 0.000000 3.592755 4.363836 11.200455 + + [[67]]$NS + [1] 2 1 1 1 + + [[67]]$NI + [1] 1 2 1 0 + + [[67]]$NR + [1] 0 0 1 2 + + + [[68]] + [[68]]$times + [1] 0.000000 8.044133 10.227368 12.702160 16.225120 23.696870 + + [[68]]$NS + [1] 2 1 1 0 0 0 + + [[68]]$NI + [1] 1 2 1 2 1 0 + + [[68]]$NR + [1] 0 0 1 1 2 3 + + + [[69]] + [[69]]$times + [1] 0.000000 3.324148 + + [[69]]$NS + [1] 2 2 + + [[69]]$NI + [1] 1 0 + + [[69]]$NR + [1] 0 1 + + + [[70]] + [[70]]$times + [1] 0.000000 6.316816 + + [[70]]$NS + [1] 2 2 + + [[70]]$NI + [1] 1 0 + + [[70]]$NR + [1] 0 1 + + + [[71]] + [[71]]$times + [1] 0.000000 7.473339 7.757794 15.139281 + + [[71]]$NS + [1] 2 1 1 1 + + [[71]]$NI + [1] 1 2 1 0 + + [[71]]$NR + [1] 0 0 1 2 + + + [[72]] + [[72]]$times + [1] 0.000000 4.073649 6.034897 8.135670 + + [[72]]$NS + [1] 2 1 1 1 + + [[72]]$NI + [1] 1 2 1 0 + + [[72]]$NR + [1] 0 0 1 2 + + + [[73]] + [[73]]$times + [1] 0.00000 1.60059 + + [[73]]$NS + [1] 2 2 + + [[73]]$NI + [1] 1 0 + + [[73]]$NR + [1] 0 1 + + + [[74]] + [[74]]$times + [1] 0.000000 1.497596 + + [[74]]$NS + [1] 2 2 + + [[74]]$NI + [1] 1 0 + + [[74]]$NR + [1] 0 1 + + + [[75]] + [[75]]$times + [1] 0.000000 1.916758 + + [[75]]$NS + [1] 2 2 + + [[75]]$NI + [1] 1 0 + + [[75]]$NR + [1] 0 1 + + + [[76]] + [[76]]$times + [1] 0.0000000 0.8368377 4.1462512 14.4447646 + + [[76]]$NS + [1] 2 1 1 1 + + [[76]]$NI + [1] 1 2 1 0 + + [[76]]$NR + [1] 0 0 1 2 + + + [[77]] + [[77]]$times + [1] 0.000000 8.546053 9.275575 11.920068 14.117820 14.371987 + + [[77]]$NS + [1] 2 1 0 0 0 0 + + [[77]]$NI + [1] 1 2 3 2 1 0 + + [[77]]$NR + [1] 0 0 0 1 2 3 + + + [[78]] + [[78]]$times + [1] 0.000000 2.730273 6.669293 7.301694 14.402306 22.580301 + + [[78]]$NS + [1] 2 1 0 0 0 0 + + [[78]]$NI + [1] 1 2 3 2 1 0 + + [[78]]$NR + [1] 0 0 0 1 2 3 + + + [[79]] + [[79]]$times + [1] 0.00000 13.02458 + + [[79]]$NS + [1] 2 2 + + [[79]]$NI + [1] 1 0 + + [[79]]$NR + [1] 0 1 + + + [[80]] + [[80]]$times + [1] 0.000000 4.655717 10.847343 15.188912 38.570735 51.548959 + + [[80]]$NS + [1] 2 1 0 0 0 0 + + [[80]]$NI + [1] 1 2 3 2 1 0 + + [[80]]$NR + [1] 0 0 0 1 2 3 + + + [[81]] + [[81]]$times + [1] 0.000000 7.919139 12.774389 13.210280 20.037088 27.652380 + + [[81]]$NS + [1] 2 1 0 0 0 0 + + [[81]]$NI + [1] 1 2 3 2 1 0 + + [[81]]$NR + [1] 0 0 0 1 2 3 + + + [[82]] + [[82]]$times + [1] 0.000000 4.565727 4.640174 5.827227 8.181199 13.514984 + + [[82]]$NS + [1] 2 1 0 0 0 0 + + [[82]]$NI + [1] 1 2 3 2 1 0 + + [[82]]$NR + [1] 0 0 0 1 2 3 + + + [[83]] + [[83]]$times + [1] 0.0000000 0.4331829 + + [[83]]$NS + [1] 2 2 + + [[83]]$NI + [1] 1 0 + + [[83]]$NR + [1] 0 1 + + + [[84]] + [[84]]$times + [1] 0.0000000 0.5663187 + + [[84]]$NS + [1] 2 2 + + [[84]]$NI + [1] 1 0 + + [[84]]$NR + [1] 0 1 + + + [[85]] + [[85]]$times + [1] 0.000000 4.717821 7.368033 15.405952 20.251957 28.844191 + + [[85]]$NS + [1] 2 1 0 0 0 0 + + [[85]]$NI + [1] 1 2 3 2 1 0 + + [[85]]$NR + [1] 0 0 0 1 2 3 + + + [[86]] + [[86]]$times + [1] 0.00000 10.41346 13.17259 31.58865 35.49247 39.20284 + + [[86]]$NS + [1] 2 1 1 0 0 0 + + [[86]]$NI + [1] 1 2 1 2 1 0 + + [[86]]$NR + [1] 0 0 1 1 2 3 + + + [[87]] + [[87]]$times + [1] 0.000000 7.800903 + + [[87]]$NS + [1] 2 2 + + [[87]]$NI + [1] 1 0 + + [[87]]$NR + [1] 0 1 + + + [[88]] + [[88]]$times + [1] 0.000000 1.164975 2.214760 3.395779 4.269503 6.277390 + + [[88]]$NS + [1] 2 1 0 0 0 0 + + [[88]]$NI + [1] 1 2 3 2 1 0 + + [[88]]$NR + [1] 0 0 0 1 2 3 + + + [[89]] + [[89]]$times + [1] 0.000000 1.419246 5.241578 10.249121 + + [[89]]$NS + [1] 2 1 1 1 + + [[89]]$NI + [1] 1 2 1 0 + + [[89]]$NR + [1] 0 0 1 2 + + + [[90]] + [[90]]$times + [1] 0.000000 4.015171 + + [[90]]$NS + [1] 2 2 + + [[90]]$NI + [1] 1 0 + + [[90]]$NR + [1] 0 1 + + + [[91]] + [[91]]$times + [1] 0.00000 10.95119 10.95895 13.37237 15.94527 20.47069 + + [[91]]$NS + [1] 2 1 0 0 0 0 + + [[91]]$NI + [1] 1 2 3 2 1 0 + + [[91]]$NR + [1] 0 0 0 1 2 3 + + + [[92]] + [[92]]$times + [1] 0.000000 1.719506 + + [[92]]$NS + [1] 2 2 + + [[92]]$NI + [1] 1 0 + + [[92]]$NR + [1] 0 1 + + + [[93]] + [[93]]$times + [1] 0.00000 20.34997 23.10320 33.53507 37.61908 42.59392 + + [[93]]$NS + [1] 2 1 0 0 0 0 + + [[93]]$NI + [1] 1 2 3 2 1 0 + + [[93]]$NR + [1] 0 0 0 1 2 3 + + + [[94]] + [[94]]$times + [1] 0.000000 2.981562 4.220980 4.501876 5.930935 17.597979 + + [[94]]$NS + [1] 2 1 0 0 0 0 + + [[94]]$NI + [1] 1 2 3 2 1 0 + + [[94]]$NR + [1] 0 0 0 1 2 3 + + + [[95]] + [[95]]$times + [1] 0.0000000 0.8570038 6.2225289 7.4542303 + + [[95]]$NS + [1] 2 1 1 1 + + [[95]]$NI + [1] 1 2 1 0 + + [[95]]$NR + [1] 0 0 1 2 + + + [[96]] + [[96]]$times + [1] 0.00000 10.99346 + + [[96]]$NS + [1] 2 2 + + [[96]]$NI + [1] 1 0 + + [[96]]$NR + [1] 0 1 + + + [[97]] + [[97]]$times + [1] 0.000000 6.324172 10.943694 11.370294 + + [[97]]$NS + [1] 2 1 1 1 + + [[97]]$NI + [1] 1 2 1 0 + + [[97]]$NR + [1] 0 0 1 2 + + + [[98]] + [[98]]$times + [1] 0.00000000 0.07582625 1.04605163 3.19140611 3.57055288 9.94371399 + + [[98]]$NS + [1] 2 1 1 0 0 0 + + [[98]]$NI + [1] 1 2 1 2 1 0 + + [[98]]$NR + [1] 0 0 1 1 2 3 + + + [[99]] + [[99]]$times + [1] 0.000000 1.910419 + + [[99]]$NS + [1] 2 2 + + [[99]]$NI + [1] 1 0 + + [[99]]$NR + [1] 0 1 + + + [[100]] + [[100]]$times + [1] 0.000000 2.446835 + + [[100]]$NS + [1] 2 2 + + [[100]]$NI + [1] 1 0 + + [[100]]$NR + [1] 0 1 + + + attr(,"class") + [1] "sir" + +--- + + Code + sir_impl(graph = g, beta = 0.1, gamma = 0.1, no_sim = 2) + Output + [[1]] + [[1]]$times + [1] 0.0000000 0.5059133 5.9903814 8.4444363 + + [[1]]$NS + [1] 2 1 1 1 + + [[1]]$NI + [1] 1 2 1 0 + + [[1]]$NR + [1] 0 0 1 2 + + + [[2]] + [[2]]$times + [1] 0.000000 4.481524 + + [[2]]$NS + [1] 2 2 + + [[2]]$NI + [1] 1 0 + + [[2]]$NR + [1] 0 1 + + + attr(,"class") + [1] "sir" + +# sir_impl errors + + Code + sir_impl(graph = NULL, beta = 0.1, gamma = 0.1) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# convex_hull_2d_impl basic + + Code + convex_hull_2d_impl(data = matrix(1:6, ncol = 2)) + Output + $resverts + [1] 1 3 + + $rescoords + [,1] [,2] + [1,] 1 4 + [2,] 3 6 + + +# convex_hull_2d_impl errors + + Code + convex_hull_2d_impl(data = "a") + Condition + Warning in `convex_hull_2d_impl()`: + NAs introduced by coercion + Error in `convex_hull_2d_impl()`: + ! REAL() can only be applied to a 'numeric', not a 'character' + +# dim_select_impl basic + + Code + dim_select_impl(sv = c(1, 2, 3)) + Output + [1] 1 + +# dim_select_impl errors + + Code + dim_select_impl(sv = NULL) + Condition + Error in `dim_select_impl()`: + ! At vendor/cigraph/src/misc/embedding.c:xx : Need at least one singular value for dimensionality selection, Invalid value + +# solve_lsap_impl basic + + Code + solve_lsap_impl(c = matrix(1:4, ncol = 2), n = 2) + Output + [1] 0 1 + +# solve_lsap_impl errors + + Code + solve_lsap_impl(c = "a", n = 2) + Condition + Warning in `solve_lsap_impl()`: + NAs introduced by coercion + Error in `solve_lsap_impl()`: + ! REAL() can only be applied to a 'numeric', not a 'character' + +# find_cycle_impl basic + + Code + find_cycle_impl(graph = g) + Output + $vertices + + 0/3 vertices: + + $edges + + 0/2 edges: + + +--- + + Code + find_cycle_impl(graph = g, mode = "in") + Output + $vertices + + 0/3 vertices: + + $edges + + 0/2 edges: + + +# find_cycle_impl errors + + Code + find_cycle_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# simple_cycles_impl basic + + Code + simple_cycles_impl(graph = g) + Output + $vertices + list() + + $edges + list() + + +--- + + Code + simple_cycles_impl(graph = g, mode = "in", min_cycle_length = 2, + max_cycle_length = 3) + Output + $vertices + list() + + $edges + list() + + +# simple_cycles_impl errors + + Code + simple_cycles_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# is_eulerian_impl basic + + Code + is_eulerian_impl(graph = g) + Output + $has_path + [1] TRUE + + $has_cycle + [1] FALSE + + +# is_eulerian_impl errors + + Code + is_eulerian_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# eulerian_path_impl basic + + Code + eulerian_path_impl(graph = g) + Output + $epath + + 2/2 edges: + [1] 1--2 2--3 + + $vpath + + 3/3 vertices: + [1] 1 2 3 + + +# eulerian_path_impl errors + + Code + eulerian_path_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# eulerian_cycle_impl basic + + Code + eulerian_cycle_impl(graph = g1) + Condition + Error in `eulerian_cycle_impl()`: + ! At vendor/cigraph/src/paths/eulerian.c:xx : The graph does not have an Eulerian cycle. Input problem has no solution + +--- + + Code + eulerian_cycle_impl(graph = g2) + Output + $epath + + 4/4 edges: + [1] 1--2 2--3 3--4 1--4 + + $vpath + + 5/4 vertices: + [1] 1 2 3 4 1 + + +# eulerian_cycle_impl errors + + Code + eulerian_cycle_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# fundamental_cycles_impl basic + + Code + fundamental_cycles_impl(graph = g, start = 1) + Output + list() + +--- + + Code + fundamental_cycles_impl(graph = g, start = 1, bfs_cutoff = 2, weights = c(1, 2)) + Output + list() + +# fundamental_cycles_impl errors + + Code + fundamental_cycles_impl(graph = NULL, start = 1) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# minimum_cycle_basis_impl basic + + Code + minimum_cycle_basis_impl(graph = g) + Output + list() + +--- + + Code + minimum_cycle_basis_impl(graph = g, bfs_cutoff = 2, complete = FALSE, + use_cycle_order = FALSE, weights = c(1, 2)) + Output + list() + +# minimum_cycle_basis_impl errors + + Code + minimum_cycle_basis_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# is_tree_impl basic + + Code + is_tree_impl(graph = g) + Output + [1] TRUE + +--- + + Code + is_tree_impl(graph = g, mode = "in", details = TRUE) + Output + $res + [1] TRUE + + $root + + 1/3 vertex: + [1] 1 + + +# is_tree_impl errors + + Code + is_tree_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# is_forest_impl basic + + Code + is_forest_impl(graph = g) + Output + [1] TRUE + +--- + + Code + is_forest_impl(graph = g, mode = "in", details = TRUE) + Output + $res + [1] TRUE + + $roots + + 1/3 vertex: + [1] 1 + + +# is_forest_impl errors + + Code + is_forest_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# from_prufer_impl basic + + Code + from_prufer_impl(prufer = 1:2) + Output + IGRAPH U--- 4 3 -- Tree from Prufer sequence + + attr: name (g/c), prufer (g/n) + + edges: + [1] 1--3 1--2 2--4 + +# from_prufer_impl errors + + Code + from_prufer_impl(prufer = "a") + Condition + Warning in `from_prufer_impl()`: + NAs introduced by coercion + Error in `from_prufer_impl()`: + ! At rinterface_extra.c:xx : The value nan is not representable as an integer. Invalid value + +# to_prufer_impl basic + + Code + to_prufer_impl(graph = g) + Output + [1] 2 + +# to_prufer_impl errors + + Code + to_prufer_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# tree_from_parent_vector_impl basic + + Code + tree_from_parent_vector_impl(parents = c(-1, 1, 2, 3)) + Output + IGRAPH D--- 4 3 -- + + edges: + [1] 1->2 2->3 3->4 + +--- + + Code + tree_from_parent_vector_impl(parents = c(-1, 1, 2, 3), type = "in") + Output + IGRAPH D--- 4 3 -- + + edges: + [1] 2->1 3->2 4->3 + +# tree_from_parent_vector_impl errors + + Code + tree_from_parent_vector_impl(parents = "a") + Condition + Warning in `tree_from_parent_vector_impl()`: + NAs introduced by coercion + Error in `tree_from_parent_vector_impl()`: + ! At rinterface_extra.c:xx : The value nan is not representable as an integer. Invalid value + +# is_complete_impl basic + + Code + is_complete_impl(graph = g) + Output + [1] FALSE + +# is_complete_impl errors + + Code + is_complete_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# random_spanning_tree_impl basic + + Code + random_spanning_tree_impl(graph = g, vid = 1) + Output + + 2/2 edges: + [1] 1--2 2--3 + +# random_spanning_tree_impl errors + + Code + random_spanning_tree_impl(graph = NULL, vid = 1) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# tree_game_impl basic + + Code + tree_game_impl(n = 3) + Output + IGRAPH U--- 3 2 -- + + edges: + [1] 2--3 1--2 + +--- + + Code + tree_game_impl(n = 3, directed = TRUE, method = "lerw") + Output + IGRAPH D--- 3 2 -- + + edges: + [1] 3->1 1->2 + +# tree_game_impl errors + + Code + tree_game_impl(n = "a") + Condition + Warning in `tree_game_impl()`: + NAs introduced by coercion + Error in `tree_game_impl()`: + ! At rinterface_extra.c:xx : The value nan is not representable as an integer. Invalid value + +# vertex_coloring_greedy_impl basic + + Code + vertex_coloring_greedy_impl(graph = g) + Output + [1] 2 1 2 + +--- + + Code + vertex_coloring_greedy_impl(graph = g, heuristic = "dsatur") + Output + [1] 2 1 2 + +# vertex_coloring_greedy_impl errors + + Code + vertex_coloring_greedy_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# is_vertex_coloring_impl basic + + Code + is_vertex_coloring_impl(graph = g, types = c(1, 2, 3)) + Output + [1] TRUE + +# is_vertex_coloring_impl errors + + Code + is_vertex_coloring_impl(graph = NULL, types = c(1, 2, 3)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# is_bipartite_coloring_impl basic + + Code + is_bipartite_coloring_impl(graph = g, types = c(TRUE, FALSE, TRUE)) + Output + [1] TRUE + +# is_bipartite_coloring_impl errors + + Code + is_bipartite_coloring_impl(graph = NULL, types = c(TRUE, FALSE, TRUE)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# is_edge_coloring_impl basic + + Code + is_edge_coloring_impl(graph = g, types = c(1, 2)) + Output + [1] TRUE + +--- + + Code + is_edge_coloring_impl(graph = g) + Output + [1] TRUE + +# is_edge_coloring_impl errors + + Code + is_edge_coloring_impl(graph = NULL, types = c(1, 2)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# deterministic_optimal_imitation_impl basic + + Code + deterministic_optimal_imitation_impl(graph = g, vid = 1, quantities = c(1, 2, 3), + strategies = c(1, 2, 3)) + Output + [1] 2 2 3 + +--- + + Code + deterministic_optimal_imitation_impl(graph = g, vid = 1, optimality = "minimum", + quantities = c(1, 2, 3), strategies = c(1, 2, 3), mode = "in") + Output + [1] 1 2 3 + +# deterministic_optimal_imitation_impl errors + + Code + deterministic_optimal_imitation_impl(graph = NULL, vid = 1, quantities = c(1, 2, + 3), strategies = c(1, 2, 3)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# moran_process_impl basic + + Code + moran_process_impl(graph = g, weights = c(1, 1), quantities = c(1, 2, 3), + strategies = c(1, 2, 3), mode = "in") + Output + $quantities + [1] 1 3 3 + + $strategies + [1] 1 3 3 + + +# moran_process_impl errors + + Code + moran_process_impl(graph = NULL, quantities = c(1, 2, 3), strategies = c(1, 2, + 3)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# roulette_wheel_imitation_impl basic + + Code + roulette_wheel_imitation_impl(graph = g, vid = 1, is_local = TRUE, quantities = c( + 1, 2, 3), strategies = c(1, 2, 3)) + Output + [1] 1 2 3 + +--- + + Code + roulette_wheel_imitation_impl(graph = g, vid = 1, is_local = FALSE, quantities = c( + 1, 2, 3), strategies = c(1, 2, 3), mode = "in") + Output + [1] 3 2 3 + +# roulette_wheel_imitation_impl errors + + Code + roulette_wheel_imitation_impl(graph = NULL, vid = 1, is_local = TRUE, + quantities = c(1, 2, 3), strategies = c(1, 2, 3)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# stochastic_imitation_impl basic + + Code + stochastic_imitation_impl(graph = g, vid = 1, algo = 1, quantities = c(1, 2, 3), + strategies = c(1, 2, 3)) + Output + [1] 1 2 3 + +--- + + Code + stochastic_imitation_impl(graph = g, vid = 1, algo = 2, quantities = c(1, 2, 3), + strategies = c(1, 2, 3), mode = "in") + Output + [1] 1 2 3 + +# stochastic_imitation_impl errors + + Code + stochastic_imitation_impl(graph = NULL, vid = 1, algo = 1, quantities = c(1, 2, + 3), strategies = c(1, 2, 3)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# invalidate_cache_impl basic + + Code + invalidate_cache_impl(graph = g) + Output + IGRAPH U--- 3 2 -- + + edges: + [1] 1--2 2--3 + +# invalidate_cache_impl errors + + Code + invalidate_cache_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# vertex_path_from_edge_path_impl basic + + Code + vertex_path_from_edge_path_impl(graph = g, start = 1, edge_path = c(1, 2)) + Output + + 3/3 vertices: + [1] 1 2 3 + +--- + + Code + vertex_path_from_edge_path_impl(graph = g, start = 1, edge_path = c(1), mode = "in") + Output + + 2/3 vertices: + [1] 1 2 + +# vertex_path_from_edge_path_impl errors + + Code + vertex_path_from_edge_path_impl(graph = NULL, start = 1, edge_path = c(1, 2)) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# version_impl basic + + Code + version_impl_clean() + Output + [1] "0.10.17" + +# version_impl errors + + Code + version_impl("invalid") + Condition + Error in `version_impl()`: + ! unused argument ("invalid") + +# ecount_impl basic + + Code + ecount_impl(graph = g) + Output + [1] 0 + +--- + + Code + ecount_impl(graph = g) + Output + [1] 3 + +# ecount_impl errors + + Code + ecount_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# is_directed_impl basic + + Code + is_directed_impl(graph = g) + Output + [1] TRUE + +--- + + Code + is_directed_impl(graph = g) + Output + [1] FALSE + +# is_directed_impl errors + + Code + is_directed_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# edges_impl basic + + Code + edges_impl(graph = g, eids = E(g)) + Output + + 6/4 vertices: + [1] 1 2 2 3 3 4 + +--- + + Code + edges_impl(graph = g, eids = c(1, 3)) + Output + + 4/4 vertices: + [1] 1 2 3 4 + +# edges_impl errors + + Code + edges_impl(graph = NULL, eids = 1) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# add_vertices_impl basic + + Code + vcount(g_new) + Output + [1] 5 + +# add_vertices_impl errors + + Code + add_vertices_impl(graph = NULL, nv = 1) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# delete_edges_impl basic + + Code + ecount(g_new) + Output + [1] 1 + +# delete_edges_impl errors + + Code + delete_edges_impl(graph = NULL, edges = 1) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# delete_vertices_impl basic + + Code + vcount(g_new) + Output + [1] 2 + +# delete_vertices_impl errors + + Code + delete_vertices_impl(graph = NULL, vertices = 1) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# incident_impl basic + + Code + incident_impl(graph = g, vid = 2, mode = "out") + Output + + 1/3 edge: + [1] 2->3 + +--- + + Code + incident_impl(graph = g, vid = 2, mode = "in") + Output + + 1/3 edge: + [1] 1->2 + +--- + + Code + incident_impl(graph = g, vid = 2, mode = "all") + Output + + 2/3 edges: + [1] 1->2 2->3 + +# incident_impl errors + + Code + incident_impl(graph = NULL, vid = 1) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# famous_impl basic + + Code + famous_impl(name = "Zachary") + Output + IGRAPH U--- 34 78 -- + + edges: + [1] 1-- 2 1-- 3 1-- 4 1-- 5 1-- 6 1-- 7 1-- 8 1-- 9 1--11 1--12 + [11] 1--13 1--14 1--18 1--20 1--22 1--32 2-- 3 2-- 4 2-- 8 2--14 + [21] 2--18 2--20 2--22 2--31 3-- 4 3-- 8 3--28 3--29 3--33 3--10 + [31] 3-- 9 3--14 4-- 8 4--13 4--14 5-- 7 5--11 6-- 7 6--11 6--17 + [41] 7--17 9--31 9--33 9--34 10--34 14--34 15--33 15--34 16--33 16--34 + [51] 19--33 19--34 20--34 21--33 21--34 23--33 23--34 24--26 24--28 24--33 + [61] 24--34 24--30 25--26 25--28 25--32 26--32 27--30 27--34 28--34 29--32 + [71] 29--34 30--33 30--34 31--33 31--34 32--33 32--34 33--34 + +# famous_impl errors + + Code + famous_impl(name = "NonexistentGraph") + Condition + Error in `famous_impl()`: + ! At vendor/cigraph/src/constructors/famous.c:xx : NonexistentGraph is not a known graph. See the documentation for valid graph names. Invalid value + +# constraint_impl errors + + Code + constraint_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# cocitation_impl errors + + Code + cocitation_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# bibcoupling_impl errors + + Code + bibcoupling_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# girth_impl basic + + Code + result$girth + Output + [1] 5 + +# girth_impl errors + + Code + girth_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# coreness_impl basic + + Code + coreness_impl(graph = g) + Output + [1] 2 2 2 1 + +# coreness_impl errors + + Code + coreness_impl(graph = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# union_impl basic + + Code + union_impl(left = g1, right = g2) + Output + $res + IGRAPH D--- 4 4 -- + + edges: + [1] 1->2 1->3 2->3 3->4 + + $edge_map_left + [1] 1 3 + + $edge_map_right + [1] 2 4 + + +# union_impl errors + + Code + union_impl(left = NULL, right = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# intersection_impl basic + + Code + intersection_impl(left = g1, right = g2) + Output + $res + IGRAPH D--- 3 2 -- + + edges: + [1] 1->2 2->3 + + $edge_map_left + [1] 1 2 + + $edge_map_right + [1] 1 2 + + +# intersection_impl errors + + Code + intersection_impl(left = NULL, right = NULL) + Condition + Error in `ensure_igraph()`: + ! Must provide a graph object (provided `NULL`). + +# star_impl basic + + Code + star_impl(n = 5, mode = "out", center = 0) + Output + IGRAPH D--- 5 4 -- + + edges: + [1] 1->2 1->3 1->4 1->5 + +--- + + Code + star_impl(n = 6, mode = "in", center = 1) + Output + IGRAPH D--- 6 5 -- + + edges: + [1] 1->2 3->2 4->2 5->2 6->2 + +--- + + Code + star_impl(n = 4, mode = "undirected", center = 0) + Output + IGRAPH U--- 4 3 -- + + edges: + [1] 1--2 1--3 1--4 + +# ring_impl basic + + Code + ring_impl(n = 5, directed = FALSE, mutual = FALSE, circular = TRUE) + Output + IGRAPH U--- 5 5 -- + + edges: + [1] 1--2 2--3 3--4 4--5 1--5 + +--- + + Code + ring_impl(n = 4, directed = TRUE, mutual = FALSE, circular = FALSE) + Output + IGRAPH D--- 4 3 -- + + edges: + [1] 1->2 2->3 3->4 + +# full_impl basic + + Code + full_impl(n = 4, directed = FALSE, loops = FALSE) + Output + IGRAPH U--- 4 6 -- + + edges: + [1] 1--2 1--3 1--4 2--3 2--4 3--4 + +--- + + Code + full_impl(n = 3, directed = TRUE, loops = FALSE) + Output + IGRAPH D--- 3 6 -- + + edges: + [1] 1->2 1->3 2->1 2->3 3->1 3->2 + +# kary_tree_impl basic + + Code + kary_tree_impl(n = 7, children = 2, type = c("out", "in", "undirected")) + Output + IGRAPH D--- 7 6 -- + + edges: + [1] 1->2 1->3 2->4 2->5 3->6 3->7 + +--- + + Code + kary_tree_impl(n = 10, children = 3, type = c("in", "out", "undirected")) + Output + IGRAPH D--- 10 9 -- + + edges: + [1] 2->1 3->1 4->1 5->2 6->2 7->2 8->3 9->3 10->3 + +# barabasi_game_impl basic + + Code + barabasi_game_impl(n = 10, power = 1, m = 2, directed = FALSE, algo = "bag") + Output + IGRAPH U--- 10 18 -- + + edges: + [1] 1-- 2 1-- 2 2-- 3 1-- 3 2-- 4 2-- 4 2-- 5 2-- 5 4-- 6 2-- 6 2-- 7 1-- 7 + [13] 3-- 8 2-- 8 8-- 9 5-- 9 6--10 5--10 + +--- + + Code + barabasi_game_impl(n = 10, power = 1, m = 2, directed = FALSE, algo = "psumtree") + Output + IGRAPH U--- 10 17 -- + + edges: + [1] 1-- 2 1-- 3 2-- 3 1-- 4 2-- 4 2-- 5 4-- 5 1-- 6 3-- 6 6-- 7 3-- 7 6-- 8 + [13] 2-- 8 3-- 9 5-- 9 2--10 6--10 + +# grg_game_impl basic + + Code + grg_game_impl(nodes = 10, radius = 0.3, torus = FALSE) + Output + $graph + IGRAPH U--- 10 12 -- + + edges: + [1] 3-- 5 3-- 6 5-- 6 5-- 7 5-- 8 6-- 8 7-- 8 7-- 9 7--10 8-- 9 8--10 9--10 + + $x + [1] 0.08565451 0.15145413 0.45222514 0.45939554 0.55956278 0.61872370 + [7] 0.76201957 0.82545284 0.86690370 0.95857358 + + $y + [1] 0.07820721 0.85018913 0.08700766 0.73223568 0.33212277 0.14562638 + [7] 0.53326474 0.32235478 0.49679861 0.31410636 + + +# watts_strogatz_game_impl basic + + Code + watts_strogatz_game_impl(dim = 1, size = 10, nei = 2, p = 0.1) + Output + IGRAPH U--- 10 20 -- + + edges: + [1] 1-- 2 2-- 6 2-- 3 4-- 5 5-- 6 6-- 7 7-- 8 8-- 9 9--10 1--10 1-- 8 1-- 9 + [13] 2--10 2-- 4 3-- 5 4-- 6 5-- 7 6-- 8 7-- 9 8--10 + +# distances_impl basic + + Code + distances_impl(graph = g, from = V(g), to = V(g), mode = c("out", "in", "all", + "total")) + Output + [,1] [,2] [,3] [,4] [,5] + [1,] 0 1 2 2 1 + [2,] 1 0 1 2 2 + [3,] 2 1 0 1 2 + [4,] 2 2 1 0 1 + [5,] 1 2 2 1 0 + +# diameter_impl basic + + Code + diameter_impl(graph = g, directed = FALSE, unconnected = TRUE) + Output + $res + [1] 5 + + $from + [1] 0 + + $to + [1] 5 + + $vertex_path + [1] 0 1 2 3 4 5 + + $edge_path + [1] 0 1 2 3 4 + + +# get_shortest_paths_impl basic + + Code + get_shortest_paths_impl(graph = g, from = 1, to = 3, mode = c("out", "in", + "all", "total")) + Output + $vertices + $vertices[[1]] + + 3/5 vertices: + [1] 1 2 3 + + + $edges + $edges[[1]] + + 2/5 edges: + [1] 1--2 2--3 + + + $parents + [1] -1 0 1 -2 0 + + $inbound_edges + [1] -1 0 1 -1 4 + + +# subcomponent_impl basic + + Code + subcomponent_impl(graph = g, v = 1, mode = c("all", "out", "in")) + Output + + 3/6 vertices, named: + [1] A B C + +# betweenness_impl basic + + Code + betweenness_impl(graph = g, vids = V(g), directed = FALSE) + Output + [1] 6 0 0 0 0 + +# harmonic_centrality_impl basic + + Code + harmonic_centrality_impl(graph = g, vids = V(g), mode = c("out", "in", "all", + "total")) + Output + [1] 4.0 2.5 2.5 2.5 2.5 + +# pagerank_impl basic + + Code + pagerank_impl(graph = g, vids = V(g), directed = TRUE, damping = 0.85) + Output + $vector + [1] 0.2 0.2 0.2 0.2 0.2 + + $value + [1] 1 + + $options + NULL + + +# hub_score_impl basic + + Code + hub_score_impl(graph = g, scale = TRUE, weights = NULL) + Output + $vector + [1] 1.0000000 0.2500078 0.2500078 0.2500078 0.2500078 + + $value + [1] 4 + + $options + $options$bmat + [1] "I" + + $options$n + [1] 5 + + $options$which + [1] "LA" + + $options$nev + [1] 1 + + $options$tol + [1] 0 + + $options$ncv + [1] 0 + + $options$ldv + [1] 0 + + $options$ishift + [1] 1 + + $options$maxiter + [1] 3000 + + $options$nb + [1] 1 + + $options$mode + [1] 1 + + $options$start + [1] 1 + + $options$sigma + [1] 0 + + $options$sigmai + [1] 0 + + $options$info + [1] 0 + + $options$iter + [1] 1 + + $options$nconv + [1] 1 + + $options$numop + [1] 4 + + $options$numopb + [1] 0 + + $options$numreo + [1] 4 + + + +# authority_score_impl basic + + Code + authority_score_impl(graph = g, scale = TRUE, weights = NULL) + Output + $vector + [1] 1.0000000 0.9999686 0.9999686 0.9999686 0.9999686 + + $value + [1] 4 + + $options + $options$bmat + [1] "I" + + $options$n + [1] 5 + + $options$which + [1] "LA" + + $options$nev + [1] 1 + + $options$tol + [1] 0 + + $options$ncv + [1] 0 + + $options$ldv + [1] 0 + + $options$ishift + [1] 1 + + $options$maxiter + [1] 3000 + + $options$nb + [1] 1 + + $options$mode + [1] 1 + + $options$start + [1] 1 + + $options$sigma + [1] 0 + + $options$sigmai + [1] 0 + + $options$info + [1] 0 + + $options$iter + [1] 1 + + $options$nconv + [1] 1 + + $options$numop + [1] 4 + + $options$numopb + [1] 0 + + $options$numreo + [1] 4 + + + +# community_walktrap_impl basic + + Code + community_walktrap_impl(graph = g, steps = 4) + Output + $merges + [,1] [,2] + [1,] 4 5 + [2,] 1 2 + [3,] 3 6 + [4,] 0 7 + [5,] 8 9 + + $modularity + [1] -0.17346939 -0.07142857 0.03061224 0.19387755 0.35714286 0.00000000 + + $membership + [1] 0 0 0 1 1 1 + + +# community_fastgreedy_impl basic + + Code + community_fastgreedy_impl(graph = g) + Output + $merges + [,1] [,2] + [1,] 2 1 + [2,] 0 6 + [3,] 5 4 + [4,] 3 8 + [5,] 9 7 + + $modularity + [1] -1.734694e-01 -7.142857e-02 9.183673e-02 1.938776e-01 3.571429e-01 + [6] 5.551115e-17 + + $membership + [1] 1 1 1 0 0 0 + + +# community_edge_betweenness_impl basic + + Code + community_edge_betweenness_impl(graph = g, directed = FALSE) + Output + $removed_edges + [1] 2 0 1 3 4 5 6 + + $edge_betweenness + [1] 9 1 2 1 1 2 1 + + $merges + [,1] [,2] + [1,] 5 4 + [2,] 6 3 + [3,] 2 1 + [4,] 8 0 + [5,] 7 9 + + $bridges + [1] 7 6 4 3 1 + + $modularity + [1] -0.17346939 -0.07142857 0.09183673 0.19387755 0.35714286 0.00000000 + + $membership + [1] 0 0 0 1 1 1 + + +# edge_connectivity_impl basic + + Code + edge_connectivity_impl(graph = g) + Output + [1] 2 + +# vertex_connectivity_impl basic + + Code + vertex_connectivity_impl(graph = g) + Output + [1] 2 + +# create_bipartite_impl basic + + Code + create_bipartite_impl(types = c(FALSE, FALSE, TRUE, TRUE), edges = c(0, 2, 0, 3, + 1, 2, 1, 3), directed = FALSE) + Output + IGRAPH U--- 4 4 -- + + edges: + [1] 1--3 1--4 2--3 2--4 + +# bipartite_game_impl basic + + Code + bipartite_game_impl(type = "gnp", n1 = 5, n2 = 5, p = 0.3, directed = FALSE) + Output + $graph + IGRAPH U--- 10 10 -- + + edges: + [1] 1-- 6 2-- 6 4-- 6 5-- 6 1-- 7 4-- 7 4-- 8 3-- 9 3--10 4--10 + + $types + [1] FALSE FALSE FALSE FALSE FALSE TRUE TRUE TRUE TRUE TRUE + + +--- + + Code + bipartite_game_impl(type = "gnm", n1 = 5, n2 = 5, m = 10, directed = FALSE) + Output + $graph + IGRAPH U--- 10 10 -- + + edges: + [1] 1-- 6 3-- 7 5-- 7 1-- 8 3-- 8 4-- 8 2-- 9 5-- 9 2--10 3--10 + + $types + [1] FALSE FALSE FALSE FALSE FALSE TRUE TRUE TRUE TRUE TRUE + + +# decompose_impl basic + + Code + decompose_impl(graph = g, mode = c("weak", "strong")) + Output + [[1]] + IGRAPH UN-- 3 2 -- + + attr: name (v/c) + + edges (vertex names): + [1] A--B B--C + + [[2]] + IGRAPH UN-- 2 1 -- + + attr: name (v/c) + + edge (vertex names): + [1] D--E + + +# neighborhood_impl basic + + Code + neighborhood_impl(graph = g, order = 1, vids = V(g), mode = c("all", "out", + "in")) + Output + [[1]] + + 3/5 vertices: + [1] 1 2 5 + + [[2]] + + 3/5 vertices: + [1] 2 1 3 + + [[3]] + + 3/5 vertices: + [1] 3 2 4 + + [[4]] + + 3/5 vertices: + [1] 4 3 5 + + [[5]] + + 3/5 vertices: + [1] 5 1 4 + + +# neighborhood_size_impl basic + + Code + neighborhood_size_impl(graph = g, order = 1, vids = V(g), mode = c("all", "out", + "in")) + Output + [1] 3 3 3 3 3 + +# get_adjacency_impl basic + + Code + get_adjacency_impl(graph = g, type = c("both", "upper", "lower")) + Output + [,1] [,2] [,3] + [1,] 0 1 1 + [2,] 1 0 1 + [3,] 1 1 0 + +# write_graph_edgelist_impl basic + + Code + content + Output + [1] "0 1" "0 2" "1 2" + +# read_graph_edgelist_impl basic + + Code + read_graph_edgelist_impl(instream = tmp, n = 3, directed = FALSE) + Output + IGRAPH U--- 3 3 -- + + edges: + [1] 1--2 2--3 1--3 + +# degree_sequence_game_impl basic + + Code + degree_sequence_game_impl(out_deg = c(2, 2, 2, 2), method = "configuration") + Output + IGRAPH U--- 4 4 -- + + edges: + [1] 2--4 3--3 1--4 1--2 + +--- + + Code + degree_sequence_game_impl(out_deg = c(2, 2, 2, 2), method = "vl") + Output + IGRAPH U--- 4 4 -- + + edges: + [1] 1--2 1--4 2--3 3--4 + +# connect_neighborhood_impl basic + + Code + connect_neighborhood_impl(graph = g, order = 1, mode = c("all", "out", "in")) + Condition + Warning in `connect_neighborhood_impl()`: + At vendor/cigraph/src/operators/connect_neighborhood.c:85 : Order smaller than two, graph will be unchanged. + Output + IGRAPH U--- 5 5 -- Ring graph + + attr: name (g/c), mutual (g/l), circular (g/l) + + edges: + [1] 1--2 2--3 3--4 4--5 1--5 + +# eccentricity_impl basic + + Code + eccentricity_impl(graph = g, vids = V(g), mode = c("out", "in", "all")) + Output + [1] 2 2 2 2 2 + +# radius_impl basic + + Code + radius_impl(graph = g, mode = c("out", "in", "all")) + Output + [1] 2 + +# graph_center_impl basic + + Code + graph_center_impl(graph = g, mode = c("out", "in", "all")) + Output + + 1/5 vertex: + [1] 1 + +# maximal_cliques_impl basic + + Code + maximal_cliques_impl(graph = g, min_size = 1, max_size = 0) + Output + [[1]] + + 4/4 vertices: + [1] 1 2 4 3 + + +# independent_vertex_sets_impl basic + + Code + independent_vertex_sets_impl(graph = g, min_size = 1, max_size = 0) + Output + [[1]] + + 1/5 vertex: + [1] 1 + + [[2]] + + 1/5 vertex: + [1] 2 + + [[3]] + + 1/5 vertex: + [1] 3 + + [[4]] + + 1/5 vertex: + [1] 4 + + [[5]] + + 1/5 vertex: + [1] 5 + + [[6]] + + 2/5 vertices: + [1] 1 3 + + [[7]] + + 2/5 vertices: + [1] 1 4 + + [[8]] + + 2/5 vertices: + [1] 2 4 + + [[9]] + + 2/5 vertices: + [1] 2 5 + + [[10]] + + 2/5 vertices: + [1] 3 5 + + diff --git a/tools/stimulus/functions-R.yaml b/tools/stimulus/functions-R.yaml index 8d96bfb76f..680a954703 100644 --- a/tools/stimulus/functions-R.yaml +++ b/tools/stimulus/functions-R.yaml @@ -570,6 +570,16 @@ igraph_independence_number: ####################################### igraph_layout_fruchterman_reingold: + PARAMS: |- + GRAPH graph, OPTIONAL INOUT MATRIX coords, + BOOLEAN use_seed=FALSE, INTEGER niter=500, + REAL start_temp=sqrt(vcount(graph)), + LAYOUT_GRID grid=AUTO, OPTIONAL EDGEWEIGHTS weights, + OPTIONAL VECTOR minx, OPTIONAL VECTOR maxx, + OPTIONAL VECTOR miny, OPTIONAL VECTOR maxy, + DEPRECATED coolexp=NULL, DEPRECATED maxdelta=NULL, DEPRECATED area=NULL, + DEPRECATED repulserad=NULL + DEPS: weights ON graph igraph_layout_kamada_kawai: @@ -584,6 +594,17 @@ igraph_layout_reingold_tilford: igraph_layout_reingold_tilford_circular: igraph_layout_fruchterman_reingold_3d: + PARAMS: |- + GRAPH graph, OPTIONAL INOUT MATRIX coords, + BOOLEAN use_seed=FALSE, INTEGER niter=500, + REAL start_temp=sqrt(vcount(graph)), + OPTIONAL EDGEWEIGHTS weights, + OPTIONAL VECTOR minx, OPTIONAL VECTOR maxx, + OPTIONAL VECTOR miny, OPTIONAL VECTOR maxy, + OPTIONAL VECTOR minz, OPTIONAL VECTOR maxz, + DEPRECATED coolexp=NULL, DEPRECATED maxdelta=NULL, DEPRECATED area=NULL, + DEPRECATED repulserad=NULL + DEPS: weights ON graph igraph_layout_kamada_kawai_3d: diff --git a/tools/stimulus/types-RR.yaml b/tools/stimulus/types-RR.yaml index ffb258a404..617e5f6b94 100644 --- a/tools/stimulus/types-RR.yaml +++ b/tools/stimulus/types-RR.yaml @@ -552,7 +552,6 @@ PAGERANKOPT: DEPRECATED: CALL: {} - HEADER: ~ INCONV: if (!missing(%I%)) { warning("Argument `%I%' is deprecated and has no effect") } LSETYPE: From 28456d0c107d79fe5c233bd97dc9352926aa5d24 Mon Sep 17 00:00:00 2001 From: krlmlr Date: Mon, 17 Nov 2025 19:28:57 +0000 Subject: [PATCH 10/10] chore: Auto-update from GitHub Actions Run: https://github.com/igraph/rigraph/actions/runs/19441745029 --- tests/testthat/_snaps/aaa-auto.md | 4 +- tests/testthat/_snaps/aaa-auto.new.md | 11183 ------------------------ 2 files changed, 2 insertions(+), 11185 deletions(-) delete mode 100644 tests/testthat/_snaps/aaa-auto.new.md diff --git a/tests/testthat/_snaps/aaa-auto.md b/tests/testthat/_snaps/aaa-auto.md index ebc98e4a9c..d724e68b6c 100644 --- a/tests/testthat/_snaps/aaa-auto.md +++ b/tests/testthat/_snaps/aaa-auto.md @@ -10729,7 +10729,7 @@ hub_score_impl(graph = g, scale = TRUE, weights = NULL) Output $vector - [1] 1 0 0 0 0 + [1] 1.0000000 0.2500078 0.2500078 0.2500078 0.2500078 $value [1] 4 @@ -10803,7 +10803,7 @@ authority_score_impl(graph = g, scale = TRUE, weights = NULL) Output $vector - [1] 0 1 1 1 1 + [1] 1.0000000 0.9999686 0.9999686 0.9999686 0.9999686 $value [1] 4 diff --git a/tests/testthat/_snaps/aaa-auto.new.md b/tests/testthat/_snaps/aaa-auto.new.md deleted file mode 100644 index d724e68b6c..0000000000 --- a/tests/testthat/_snaps/aaa-auto.new.md +++ /dev/null @@ -1,11183 +0,0 @@ -# empty_impl basic - - Code - empty_impl() - Output - IGRAPH D--- 0 0 -- - + edges: - ---- - - Code - empty_impl(n = 5, directed = FALSE) - Output - IGRAPH U--- 5 0 -- - + edges: - -# empty_impl errors - - Code - empty_impl(n = -1) - Condition - Error in `empty_impl()`: - ! At vendor/cigraph/src/graph/type_indexededgelist.c:xx : Number of vertices must not be negative. Invalid value - -# add_edges_impl basic - - Code - add_edges_impl(graph = g, edges = c(0, 1, 1, 2)) - Output - IGRAPH D--- 3 2 -- - + edges: - [1] 1->2 2->3 - -# add_edges_impl errors - - Code - add_edges_impl(graph = NULL, edges = c(1, 2)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# copy_impl basic - - Code - copy_impl(from = g) - Output - IGRAPH D--- 2 0 -- - + edges: - -# copy_impl errors - - Code - copy_impl(from = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# delete_vertices_idx_impl basic - - Code - delete_vertices_idx_impl(graph = g, vertices = 1) - Output - $graph - IGRAPH D--- 2 0 -- - + edges: - - $idx - [1] 0 1 2 - - $invidx - [1] 1 2 - - -# delete_vertices_idx_impl errors - - Code - delete_vertices_idx_impl(graph = NULL, vertices = 1) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# vcount_impl basic - - Code - vcount_impl(graph = g) - Output - [1] 4 - -# vcount_impl errors - - Code - vcount_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# degree_impl basic - - Code - degree_impl(graph = g) - Output - [1] 0 0 0 - ---- - - Code - degree_impl(graph = g, mode = "in") - Output - [1] 0 0 0 - -# degree_impl errors - - Code - degree_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# get_all_eids_between_impl basic - - Code - get_all_eids_between_impl(graph = g, from = 1, to = 2) - Output - + 0/0 edges: - -# get_all_eids_between_impl errors - - Code - get_all_eids_between_impl(graph = NULL, from = 1, to = 2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# wheel_impl basic - - Code - wheel_impl(n = 5) - Output - IGRAPH D--- 5 8 -- - + edges: - [1] 1->2 1->3 1->4 1->5 2->3 3->4 4->5 5->2 - ---- - - Code - wheel_impl(n = 5, mode = "in", center = 2) - Output - IGRAPH D--- 5 8 -- - + edges: - [1] 1->3 2->3 4->3 5->3 1->2 2->4 4->5 5->1 - -# wheel_impl errors - - Code - wheel_impl(n = -1) - Condition - Error in `wheel_impl()`: - ! At vendor/cigraph/src/constructors/regular.c:xx : Invalid number of vertices. Invalid vertex ID - -# hypercube_impl basic - - Code - hypercube_impl(n = 3) - Output - IGRAPH U--- 8 12 -- - + edges: - [1] 1--2 1--3 1--5 2--4 2--6 3--4 3--7 4--8 5--6 5--7 6--8 7--8 - ---- - - Code - hypercube_impl(n = 3, directed = TRUE) - Output - IGRAPH D--- 8 12 -- - + edges: - [1] 1->2 1->3 1->5 2->4 2->6 3->4 3->7 4->8 5->6 5->7 6->8 7->8 - -# hypercube_impl errors - - Code - hypercube_impl(n = 10000) - Condition - Error in `hypercube_impl()`: - ! At vendor/cigraph/src/constructors/regular.c:xx : The requested hypercube graph dimension (10000) is too high. It must be no greater than 57. Invalid value - -# square_lattice_impl basic - - Code - square_lattice_impl(dimvector = c(2, 2)) - Output - IGRAPH U--- 4 4 -- - + edges: - [1] 1--2 1--3 2--4 3--4 - ---- - - Code - square_lattice_impl(dimvector = c(2, 2), nei = 2, directed = TRUE, mutual = TRUE, - periodic = c(TRUE, TRUE)) - Output - IGRAPH D--- 4 10 -- - + edges: - [1] 1->2 1->3 2->1 2->4 3->4 3->1 4->3 4->2 1->4 2->3 - -# square_lattice_impl errors - - Code - square_lattice_impl(dimvector = -1) - Condition - Error in `square_lattice_impl()`: - ! At vendor/cigraph/src/constructors/regular.c:xx : Invalid dimension vector. Invalid value - -# triangular_lattice_impl basic - - Code - triangular_lattice_impl(dimvector = c(2, 2)) - Output - IGRAPH U--- 4 5 -- - + edges: - [1] 1--2 1--4 1--3 2--4 3--4 - ---- - - Code - triangular_lattice_impl(dimvector = c(2, 2), directed = TRUE, mutual = TRUE) - Output - IGRAPH D--- 4 10 -- - + edges: - [1] 1->2 2->1 1->4 4->1 1->3 3->1 2->4 4->2 3->4 4->3 - -# triangular_lattice_impl errors - - Code - triangular_lattice_impl(dimvector = -1) - Condition - Error in `triangular_lattice_impl()`: - ! At vendor/cigraph/src/constructors/lattices.c:xx : Invalid dimension vector. Invalid value - -# path_graph_impl basic - - Code - path_graph_impl(n = 5) - Output - IGRAPH U--- 5 4 -- - + edges: - [1] 1--2 2--3 3--4 4--5 - ---- - - Code - path_graph_impl(n = 5, directed = TRUE, mutual = TRUE) - Output - IGRAPH D--- 5 8 -- - + edges: - [1] 1->2 2->1 2->3 3->2 3->4 4->3 4->5 5->4 - -# path_graph_impl errors - - Code - path_graph_impl(n = -1) - Condition - Error in `path_graph_impl()`: - ! At vendor/cigraph/src/constructors/regular.c:xx : The number of vertices must be non-negative, got -1. Invalid value - -# cycle_graph_impl basic - - Code - cycle_graph_impl(n = 5) - Output - IGRAPH U--- 5 5 -- - + edges: - [1] 1--2 2--3 3--4 4--5 1--5 - ---- - - Code - cycle_graph_impl(n = 5, directed = TRUE, mutual = TRUE) - Output - IGRAPH D--- 5 10 -- - + edges: - [1] 1->2 2->1 2->3 3->2 3->4 4->3 4->5 5->4 5->1 1->5 - -# cycle_graph_impl errors - - Code - cycle_graph_impl(n = -1) - Condition - Error in `cycle_graph_impl()`: - ! At vendor/cigraph/src/constructors/regular.c:xx : The number of vertices must be non-negative, got -1. Invalid value - -# symmetric_tree_impl basic - - Code - symmetric_tree_impl(branches = 3) - Output - IGRAPH D--- 4 3 -- - + edges: - [1] 1->2 1->3 1->4 - ---- - - Code - symmetric_tree_impl(branches = 3, type = "in") - Output - IGRAPH D--- 4 3 -- - + edges: - [1] 2->1 3->1 4->1 - -# symmetric_tree_impl errors - - Code - symmetric_tree_impl(branches = -1) - Condition - Error in `symmetric_tree_impl()`: - ! At vendor/cigraph/src/constructors/regular.c:xx : The number of branches must be positive at each level. Invalid value - -# regular_tree_impl basic - - Code - regular_tree_impl(h = 2) - Output - IGRAPH U--- 10 9 -- - + edges: - [1] 1-- 2 1-- 3 1-- 4 2-- 5 2-- 6 3-- 7 3-- 8 4-- 9 4--10 - ---- - - Code - regular_tree_impl(h = 2, k = 4, type = "in") - Output - IGRAPH D--- 17 16 -- - + edges: - [1] 2->1 3->1 4->1 5->1 6->2 7->2 8->2 9->3 10->3 11->3 12->4 13->4 - [13] 14->4 15->5 16->5 17->5 - -# regular_tree_impl errors - - Code - regular_tree_impl(h = -1) - Condition - Error in `regular_tree_impl()`: - ! At vendor/cigraph/src/constructors/regular.c:xx : Height of regular tree must be positive, got -1. Invalid value - -# full_citation_impl basic - - Code - full_citation_impl(n = 5) - Output - IGRAPH D--- 5 10 -- - + edges: - [1] 2->1 3->1 3->2 4->1 4->2 4->3 5->1 5->2 5->3 5->4 - ---- - - Code - full_citation_impl(n = 5, directed = FALSE) - Output - IGRAPH U--- 5 10 -- - + edges: - [1] 1--2 1--3 2--3 1--4 2--4 3--4 1--5 2--5 3--5 4--5 - -# full_citation_impl errors - - Code - full_citation_impl(n = -1) - Condition - Error in `full_citation_impl()`: - ! At vendor/cigraph/src/constructors/full.c:xx : Invalid number of vertices. Invalid value - -# atlas_impl basic - - Code - atlas_impl(number = 0) - Output - IGRAPH U--- 0 0 -- - + edges: - ---- - - Code - atlas_impl(number = 5) - Output - IGRAPH U--- 3 1 -- - + edge: - [1] 2--3 - -# atlas_impl errors - - Code - atlas_impl(number = -1) - Condition - Error in `atlas_impl()`: - ! At vendor/cigraph/src/constructors/atlas.c:xx : No such graph in atlas. The graph index must be less than 1253. Invalid value - -# extended_chordal_ring_impl basic - - Code - extended_chordal_ring_impl(nodes = 5, W = matrix(c(1, 2))) - Output - IGRAPH U--- 5 15 -- - + edges: - [1] 1--2 2--3 3--4 4--5 1--5 1--2 1--3 2--3 2--4 3--4 3--5 4--5 1--4 1--5 2--5 - ---- - - Code - extended_chordal_ring_impl(nodes = 5, W = matrix(c(1, 2)), directed = TRUE) - Output - IGRAPH D--- 5 15 -- - + edges: - [1] 1->2 2->3 3->4 4->5 5->1 1->2 1->3 2->3 2->4 3->4 3->5 4->5 4->1 5->1 5->2 - -# extended_chordal_ring_impl errors - - Code - extended_chordal_ring_impl(nodes = -1, W = matrix(c(1, 2))) - Condition - Error in `extended_chordal_ring_impl()`: - ! At vendor/cigraph/src/constructors/regular.c:xx : An extended chordal ring has at least 3 nodes. Invalid value - -# graph_power_impl basic - - Code - graph_power_impl(graph = g, order = 2) - Output - IGRAPH U--- 5 7 -- - + edges: - [1] 1--2 2--3 3--4 4--5 1--3 2--4 3--5 - ---- - - Code - graph_power_impl(graph = g, order = 2, directed = TRUE) - Output - IGRAPH U--- 5 7 -- - + edges: - [1] 1--2 2--3 3--4 4--5 1--3 2--4 3--5 - -# graph_power_impl errors - - Code - graph_power_impl(graph = NULL, order = 2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# linegraph_impl basic - - Code - linegraph_impl(graph = g) - Output - IGRAPH U--- 4 3 -- - + edges: - [1] 1--2 2--3 3--4 - -# linegraph_impl errors - - Code - linegraph_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# de_bruijn_impl basic - - Code - de_bruijn_impl(m = 2, n = 3) - Output - IGRAPH D--- 8 16 -- - + edges: - [1] 1->1 1->2 2->3 2->4 3->5 3->6 4->7 4->8 5->1 5->2 6->3 6->4 7->5 7->6 8->7 - [16] 8->8 - -# de_bruijn_impl errors - - Code - de_bruijn_impl(m = -1, n = 3) - Condition - Error in `de_bruijn_impl()`: - ! At vendor/cigraph/src/constructors/de_bruijn.c:xx : `m' and `n' should be non-negative in a de Bruijn graph, Invalid value - -# kautz_impl basic - - Code - kautz_impl(m = 2, n = 3) - Output - IGRAPH D--- 24 48 -- - + edges: - [1] 1-> 9 1->10 2->11 2->12 3->13 3->14 4->15 4->16 5->17 5->18 - [11] 6->19 6->20 7->21 7->22 8->23 8->24 9-> 1 9-> 2 10-> 3 10-> 4 - [21] 11-> 5 11-> 6 12-> 7 12-> 8 13->17 13->18 14->19 14->20 15->21 15->22 - [31] 16->23 16->24 17-> 1 17-> 2 18-> 3 18-> 4 19-> 5 19-> 6 20-> 7 20-> 8 - [41] 21-> 9 21->10 22->11 22->12 23->13 23->14 24->15 24->16 - -# kautz_impl errors - - Code - kautz_impl(m = -1, n = 3) - Condition - Error in `kautz_impl()`: - ! At vendor/cigraph/src/constructors/kautz.c:xx : `m' and `n' should be non-negative in a Kautz graph, Invalid value - -# lcf_vector_impl basic - - Code - lcf_vector_impl(n = 10, shifts = c(3, -3, 4), repeats = 2) - Output - IGRAPH U--- 10 16 -- LCF graph - + attr: name (g/c) - + edges: - [1] 1-- 2 1-- 4 1--10 2-- 3 2-- 5 2-- 9 3-- 4 3-- 7 4-- 5 4-- 7 5-- 6 6-- 7 - [13] 6--10 7-- 8 8-- 9 9--10 - -# lcf_vector_impl errors - - Code - lcf_vector_impl(n = -1, shifts = c(3, -3, 4), repeats = 2) - Condition - Error in `lcf_vector_impl()`: - ! At vendor/cigraph/src/graph/type_indexededgelist.c:xx : Number of vertices must not be negative. Invalid value - -# mycielski_graph_impl basic - - Code - mycielski_graph_impl(k = 3) - Output - IGRAPH U--- 5 5 -- - + edges: - [1] 1--2 1--4 2--3 3--5 4--5 - -# mycielski_graph_impl errors - - Code - mycielski_graph_impl(k = -1) - Condition - Error in `mycielski_graph_impl()`: - ! At vendor/cigraph/src/constructors/mycielskian.c:xx : The Mycielski graph order must not be negative. Invalid value - -# adjlist_impl basic - - Code - adjlist_impl(adjlist = list(c(2, 3), c(1), c(1)), mode = "out") - Output - IGRAPH D--- 3 4 -- - + edges: - [1] 1->2 1->3 2->1 3->1 - -# adjlist_impl errors - - Code - adjlist_impl(adjlist = -1, mode = "out") - Condition - Error in `adjlist_impl()`: - ! At vendor/cigraph/src/constructors/basic_constructors.c:xx : Invalid (negative or too large) vertex ID. Invalid vertex ID - -# full_bipartite_impl basic - - Code - full_bipartite_impl(n1 = 2, n2 = 3) - Output - $graph - IGRAPH U--- 5 6 -- - + edges: - [1] 1--3 1--4 1--5 2--3 2--4 2--5 - - $types - [1] FALSE FALSE TRUE TRUE TRUE - - ---- - - Code - full_bipartite_impl(n1 = 2, n2 = 3, directed = TRUE, mode = "in") - Output - $graph - IGRAPH D--- 5 6 -- - + edges: - [1] 3->1 4->1 5->1 3->2 4->2 5->2 - - $types - [1] FALSE FALSE TRUE TRUE TRUE - - -# full_bipartite_impl errors - - Code - full_bipartite_impl(n1 = -1, n2 = 3) - Condition - Error in `full_bipartite_impl()`: - ! At vendor/cigraph/src/misc/bipartite.c:xx : Invalid number of vertices for bipartite graph. Invalid value - -# full_multipartite_impl basic - - Code - full_multipartite_impl(n = c(2, 3, 4)) - Output - $graph - IGRAPH U--- 9 26 -- - + edges: - [1] 1--3 1--4 1--5 1--6 1--7 1--8 1--9 2--3 2--4 2--5 2--6 2--7 2--8 2--9 3--6 - [16] 3--7 3--8 3--9 4--6 4--7 4--8 4--9 5--6 5--7 5--8 5--9 - - $types - [1] 1 1 2 2 2 3 3 3 3 - - $name - [1] "Full multipartite graph" - - $n - [1] 2 3 4 - - $mode - [1] 3 - - ---- - - Code - full_multipartite_impl(n = c(2, 3, 4), directed = TRUE, mode = "in") - Output - $graph - IGRAPH D--- 9 26 -- - + edges: - [1] 3->1 4->1 5->1 6->1 7->1 8->1 9->1 3->2 4->2 5->2 6->2 7->2 8->2 9->2 6->3 - [16] 7->3 8->3 9->3 6->4 7->4 8->4 9->4 6->5 7->5 8->5 9->5 - - $types - [1] 1 1 2 2 2 3 3 3 3 - - $name - [1] "Full multipartite graph" - - $n - [1] 2 3 4 - - $mode - [1] 2 - - -# full_multipartite_impl errors - - Code - full_multipartite_impl(n = -1) - Condition - Error in `full_multipartite_impl()`: - ! At vendor/cigraph/src/constructors/full.c:xx : Number of vertices must not be negative in any partition. Invalid value - -# realize_degree_sequence_impl basic - - Code - realize_degree_sequence_impl(out_deg = c(2, 2, 2)) - Output - IGRAPH U--- 3 3 -- Graph from degree sequence - + attr: name (g/c), out_deg (g/n), in_deg (g/x), allowed_edge_types - | (g/n), method (g/n) - + edges: - [1] 2--3 1--3 1--2 - ---- - - Code - realize_degree_sequence_impl(out_deg = c(2, 2, 2), in_deg = c(2, 2, 2), - allowed_edge_types = "simple", method = "largest") - Output - IGRAPH D--- 3 6 -- Graph from degree sequence - + attr: name (g/c), out_deg (g/n), in_deg (g/n), allowed_edge_types - | (g/n), method (g/n) - + edges: - [1] 1->2 1->3 2->1 2->3 3->1 3->2 - -# realize_degree_sequence_impl errors - - Code - realize_degree_sequence_impl(out_deg = -1) - Condition - Error in `realize_degree_sequence_impl()`: - ! At vendor/cigraph/src/misc/degree_sequence.cpp:xx : The sum of degrees must be even for an undirected graph. Invalid value - -# realize_bipartite_degree_sequence_impl basic - - Code - realize_bipartite_degree_sequence_impl(degrees1 = c(2, 2), degrees2 = c(2, 2)) - Output - IGRAPH U--- 4 4 -- Bipartite graph from degree sequence - + attr: name (g/c), degrees1 (g/n), degrees2 (g/n), allowed_edge_types - | (g/n), method (g/n) - + edges: - [1] 2--3 2--4 1--4 1--3 - ---- - - Code - realize_bipartite_degree_sequence_impl(degrees1 = c(2, 2), degrees2 = c(2, 2), - allowed_edge_types = "loops", method = "largest") - Output - IGRAPH U--- 4 4 -- Bipartite graph from degree sequence - + attr: name (g/c), degrees1 (g/n), degrees2 (g/n), allowed_edge_types - | (g/n), method (g/n) - + edges: - [1] 1--3 1--4 2--3 2--4 - -# realize_bipartite_degree_sequence_impl errors - - Code - realize_bipartite_degree_sequence_impl(degrees1 = -1, degrees2 = c(2, 2)) - Condition - Error in `realize_bipartite_degree_sequence_impl()`: - ! At vendor/cigraph/src/misc/degree_sequence.cpp:xx : The given bidegree sequence cannot be realized as a bipartite simple graph. Invalid value - -# circulant_impl basic - - Code - circulant_impl(n = 5, shifts = c(1, 2)) - Output - IGRAPH U--- 5 10 -- Circulant graph - + attr: name (g/c), shifts (g/n) - + edges: - [1] 1--2 2--3 3--4 4--5 1--5 1--3 2--4 3--5 1--4 2--5 - ---- - - Code - circulant_impl(n = 5, shifts = c(1, 2), directed = TRUE) - Output - IGRAPH D--- 5 10 -- Circulant graph - + attr: name (g/c), shifts (g/n) - + edges: - [1] 1->2 2->3 3->4 4->5 5->1 1->3 2->4 3->5 4->1 5->2 - -# circulant_impl errors - - Code - circulant_impl(n = -1, shifts = c(1, 2)) - Condition - Error in `circulant_impl()`: - ! At vendor/cigraph/src/constructors/circulant.c:xx : Number of nodes = -1 must be non-negative. Invalid value - -# generalized_petersen_impl basic - - Code - generalized_petersen_impl(n = 5, k = 2) - Output - IGRAPH U--- 10 15 -- - + edges: - [1] 1-- 2 1-- 6 6-- 8 2-- 3 2-- 7 7-- 9 3-- 4 3-- 8 8--10 4-- 5 4-- 9 6-- 9 - [13] 1-- 5 5--10 7--10 - -# generalized_petersen_impl errors - - Code - generalized_petersen_impl(n = -1, k = 2) - Condition - Error in `generalized_petersen_impl()`: - ! At vendor/cigraph/src/constructors/generalized_petersen.c:xx : n = -1 must be at least 3. Invalid value - -# turan_impl basic - - Code - turan_impl(n = 5, r = 2) - Output - $graph - IGRAPH U--- 5 6 -- - + edges: - [1] 1--4 1--5 2--4 2--5 3--4 3--5 - - $types - [1] 1 1 1 2 2 - - $name - [1] "Turan graph" - - $n - [1] 5 - - $r - [1] 2 - - -# turan_impl errors - - Code - turan_impl(n = -1, r = 2) - Condition - Error in `turan_impl()`: - ! At vendor/cigraph/src/constructors/full.c:xx : Number of vertices must not be negative, got -1. Invalid value - -# erdos_renyi_game_gnp_impl basic - - Code - erdos_renyi_game_gnp_impl(n = 5, p = 0.5) - Output - IGRAPH U--- 5 7 -- - + edges: - [1] 1--2 1--3 2--3 1--4 2--4 1--5 4--5 - ---- - - Code - erdos_renyi_game_gnp_impl(n = 5, p = 0.5, directed = TRUE, loops = TRUE) - Output - IGRAPH D--- 5 12 -- - + edges: - [1] 2->1 3->1 4->1 2->2 1->3 2->3 4->3 1->4 2->4 5->4 3->5 4->5 - -# erdos_renyi_game_gnp_impl errors - - Code - erdos_renyi_game_gnp_impl(n = -1, p = 0.5) - Condition - Error in `erdos_renyi_game_gnp_impl()`: - ! At vendor/cigraph/src/games/erdos_renyi.c:xx : Invalid number of vertices. Invalid value - -# erdos_renyi_game_gnm_impl basic - - Code - erdos_renyi_game_gnm_impl(n = 5, m = 3) - Output - IGRAPH U--- 5 3 -- - + edges: - [1] 3--4 2--5 4--5 - ---- - - Code - erdos_renyi_game_gnm_impl(n = 5, m = 3, directed = TRUE, loops = TRUE) - Output - IGRAPH D--- 5 3 -- - + edges: - [1] 4->3 5->3 3->5 - -# erdos_renyi_game_gnm_impl errors - - Code - erdos_renyi_game_gnm_impl(n = -1, m = 3) - Condition - Error in `erdos_renyi_game_gnm_impl()`: - ! At vendor/cigraph/src/games/erdos_renyi.c:xx : Invalid number of vertices. Invalid value - -# growing_random_game_impl basic - - Code - growing_random_game_impl(n = 5, m = 2) - Output - IGRAPH D--- 5 8 -- Growing random graph - + attr: name (g/c), m (g/n), citation (g/l) - + edges: - [1] 2->2 1->2 3->3 3->3 3->3 1->2 2->2 5->4 - ---- - - Code - growing_random_game_impl(n = 5, m = 2, directed = FALSE, citation = TRUE) - Output - IGRAPH U--- 5 8 -- Growing random graph - + attr: name (g/c), m (g/n), citation (g/l) - + edges: - [1] 1--2 1--2 2--3 1--3 1--4 2--4 1--5 4--5 - ---- - - Code - growing_random_game_impl(n = 10, m = 1, directed = TRUE, citation = FALSE) - Output - IGRAPH D--- 10 9 -- Growing random graph - + attr: name (g/c), m (g/n), citation (g/l) - + edges: - [1] 2->2 2->3 4->4 4->4 3->2 1->3 1->8 5->6 5->4 - -# growing_random_game_impl errors - - Code - growing_random_game_impl(n = -1, m = 2) - Condition - Error in `growing_random_game_impl()`: - ! At vendor/cigraph/src/games/growing_random.c:xx : Invalid number of vertices. Invalid value - -# preference_game_impl basic - - Code - preference_game_impl(nodes = 5, types = 2, type_dist = c(0.5, 0.5), - fixed_sizes = FALSE, pref_matrix = matrix(c(0.5, 0.5, 0.5, 0.5), 2, 2)) - Output - $graph - IGRAPH U--- 5 4 -- - + edges: - [1] 1--3 3--4 1--4 1--5 - - $node_type_vec - [1] 1 0 0 1 1 - - -# preference_game_impl errors - - Code - preference_game_impl(nodes = -1, types = 2, type_dist = c(0.5, 0.5), - fixed_sizes = FALSE, pref_matrix = matrix(c(0.5, 0.5, 0.5, 0.5), 2, 2)) - Condition - Error in `preference_game_impl()`: - ! At vendor/cigraph/src/games/preference.c:xx : The number of vertices must be non-negative. Invalid value - -# asymmetric_preference_game_impl basic - - Code - asymmetric_preference_game_impl(nodes = 5, out_types = 2, in_types = 2, - type_dist_matrix = matrix(c(0.5, 0.5, 0.5, 0.5), 2, 2), pref_matrix = matrix( - c(0.5, 0.5, 0.5, 0.5), 2, 2)) - Output - $graph - IGRAPH D--- 5 9 -- - + edges: - [1] 2->4 4->2 5->2 1->3 4->3 4->5 3->1 1->4 1->5 - - $node_type_out_vec - [1] 1 0 1 1 1 - - $node_type_in_vec - [1] 1 0 0 1 1 - - -# asymmetric_preference_game_impl errors - - Code - asymmetric_preference_game_impl(nodes = -1, out_types = 2, in_types = 2, - type_dist_matrix = matrix(c(0.5, 0.5, 0.5, 0.5), 2, 2), pref_matrix = matrix( - c(0.5, 0.5, 0.5, 0.5), 2, 2)) - Condition - Error in `asymmetric_preference_game_impl()`: - ! At vendor/cigraph/src/games/preference.c:xx : The number of vertices must not be negative. Invalid value - -# rewire_edges_impl basic - - Code - rewire_edges_impl(graph = g, prob = 0.5) - Output - IGRAPH U--- 5 4 -- - + edges: - [1] 2--4 3--4 1--3 2--5 - -# rewire_edges_impl errors - - Code - rewire_edges_impl(graph = NULL, prob = 0.5) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# rewire_directed_edges_impl basic - - Code - rewire_directed_edges_impl(graph = g, prob = 0.5) - Output - IGRAPH D--- 5 4 -- - + edges: - [1] 1->4 2->3 3->2 4->5 - -# rewire_directed_edges_impl errors - - Code - rewire_directed_edges_impl(graph = NULL, prob = 0.5) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# forest_fire_game_impl basic - - Code - forest_fire_game_impl(nodes = 5, fw_prob = 0.5) - Output - IGRAPH D--- 5 9 -- Forest fire model - + attr: name (g/c), fw_prob (g/n), bw_factor (g/n), ambs (g/n) - + edges: - [1] 2->1 3->2 4->2 4->1 4->3 5->1 5->2 5->4 5->3 - ---- - - Code - forest_fire_game_impl(nodes = 5, fw_prob = 0.5, bw_factor = 0.2, ambs = 2, - directed = FALSE) - Output - IGRAPH U--- 5 4 -- Forest fire model - + attr: name (g/c), fw_prob (g/n), bw_factor (g/n), ambs (g/n) - + edges: - [1] 1--2 1--3 1--4 4--5 - -# forest_fire_game_impl errors - - Code - forest_fire_game_impl(nodes = -1, fw_prob = 0.5) - Condition - Error in `forest_fire_game_impl()`: - ! At vendor/cigraph/src/games/forestfire.c:xx : Insufficient memory for forest fire model. Out of memory - -# simple_interconnected_islands_game_impl basic - - Code - simple_interconnected_islands_game_impl(islands_n = 2, islands_size = 3, - islands_pin = 0.5, n_inter = 1) - Output - IGRAPH U--- 6 5 -- Interconnected islands model - + attr: name (g/c), islands_n (g/n), islands_size (g/n), islands_pin - | (g/n), n_inter (g/n) - + edges: - [1] 1--2 1--3 2--3 3--6 5--6 - -# simple_interconnected_islands_game_impl errors - - Code - simple_interconnected_islands_game_impl(islands_n = -1, islands_size = 3, - islands_pin = 0.5, n_inter = 1) - Condition - Error in `simple_interconnected_islands_game_impl()`: - ! At vendor/cigraph/src/games/islands.c:xx : Number of islands cannot be negative, got -1. Invalid value - -# chung_lu_game_impl basic - - Code - chung_lu_game_impl(out_weights = c(2, 2, 2)) - Output - IGRAPH U--- 3 5 -- Chung-Lu model - + attr: name (g/c), variant (g/n) - + edges: - [1] 1--2 1--3 2--2 2--3 3--3 - ---- - - Code - chung_lu_game_impl(out_weights = c(1, 2, 3), in_weights = c(1, 2, 3), loops = FALSE, - variant = "maxent") - Output - IGRAPH D--- 3 1 -- Chung-Lu model - + attr: name (g/c), variant (g/n) - + edge: - [1] 3->1 - -# chung_lu_game_impl errors - - Code - chung_lu_game_impl(out_weights = -1) - Condition - Error in `chung_lu_game_impl()`: - ! At vendor/cigraph/src/games/chung_lu.c:xx : Vertex weights must not be negative in Chung-Lu model, got -1. Invalid value - -# static_fitness_game_impl basic - - Code - static_fitness_game_impl(no_of_edges = 3, fitness_out = c(1, 2, 3)) - Output - IGRAPH U--- 3 3 -- Static fitness model - + attr: name (g/c), loops (g/l), multiple (g/l) - + edges: - [1] 1--2 1--3 2--3 - ---- - - Code - static_fitness_game_impl(no_of_edges = 3, fitness_out = c(1, 2, 3), fitness_in = c( - 1, 2, 3), loops = TRUE, multiple = TRUE) - Output - IGRAPH D--- 3 3 -- Static fitness model - + attr: name (g/c), loops (g/l), multiple (g/l) - + edges: - [1] 1->2 2->3 1->3 - -# static_fitness_game_impl errors - - Code - static_fitness_game_impl(no_of_edges = -1, fitness_out = c(1, 2, 3)) - Condition - Error in `static_fitness_game_impl()`: - ! At vendor/cigraph/src/games/static_fitness.c:xx : Number of edges cannot be negative, got -1. Invalid value - -# static_power_law_game_impl basic - - Code - static_power_law_game_impl(no_of_nodes = 5, no_of_edges = 4, exponent_out = 2.5) - Output - IGRAPH U--- 5 4 -- Static power law model - + attr: name (g/c), exponent_out (g/n), exponent_in (g/n), loops (g/l), - | multiple (g/l), finite_size_correction (g/l) - + edges: - [1] 1--5 2--4 3--5 4--5 - ---- - - Code - static_power_law_game_impl(no_of_nodes = 5, no_of_edges = 4, exponent_out = 2.5, - exponent_in = 2, loops = TRUE, multiple = TRUE, finite_size_correction = FALSE) - Output - IGRAPH D--- 5 4 -- Static power law model - + attr: name (g/c), exponent_out (g/n), exponent_in (g/n), loops (g/l), - | multiple (g/l), finite_size_correction (g/l) - + edges: - [1] 1->1 3->5 1->4 5->1 - -# static_power_law_game_impl errors - - Code - static_power_law_game_impl(no_of_nodes = -1, no_of_edges = 4, exponent_out = 2.5) - Condition - Error in `static_power_law_game_impl()`: - ! At vendor/cigraph/src/games/static_fitness.c:xx : Number of nodes cannot be negative, got -1. Invalid value - -# k_regular_game_impl basic - - Code - k_regular_game_impl(no_of_nodes = 5, k = 2) - Output - IGRAPH U--- 5 5 -- k-regular graph - + attr: name (g/c), k (g/n) - + edges: - [1] 1--3 1--5 2--3 2--4 4--5 - ---- - - Code - k_regular_game_impl(no_of_nodes = 5, k = 2, directed = TRUE, multiple = TRUE) - Output - IGRAPH D--- 5 10 -- k-regular graph - + attr: name (g/c), k (g/n) - + edges: - [1] 3->4 3->3 2->1 5->5 1->5 4->3 5->2 4->1 1->2 2->4 - -# k_regular_game_impl errors - - Code - k_regular_game_impl(no_of_nodes = -1, k = 2) - Condition - Error in `k_regular_game_impl()`: - ! At vendor/cigraph/src/games/k_regular.c:xx : Number of nodes must be non-negative. Invalid value - -# sbm_game_impl basic - - Code - sbm_game_impl(n = 5, pref_matrix = matrix(0.5, 2, 2), block_sizes = c(2, 3)) - Output - IGRAPH U--- 5 6 -- Stochastic block model - + attr: name (g/c), loops (g/l) - + edges: - [1] 1--2 1--3 2--3 1--4 1--5 3--5 - ---- - - Code - sbm_game_impl(n = 5, pref_matrix = matrix(0.5, 2, 2), block_sizes = c(2, 3), - directed = TRUE, loops = TRUE) - Output - IGRAPH D--- 5 14 -- Stochastic block model - + attr: name (g/c), loops (g/l) - + edges: - [1] 1->1 2->1 2->4 1->5 4->1 5->1 5->2 3->3 5->3 3->4 4->4 5->4 3->5 5->5 - -# sbm_game_impl errors - - Code - sbm_game_impl(n = -1, pref_matrix = matrix(0.5, 2, 2), block_sizes = c(2, 3)) - Condition - Error in `sbm_game_impl()`: - ! At vendor/cigraph/src/games/sbm.c:xx : Sum of the block sizes (5) must equal the number of vertices (-1). Invalid value - -# hsbm_game_impl basic - - Code - hsbm_game_impl(n = 6, m = 2, rho = c(0.5, 0.5), C = matrix(1, 2, 2), p = 0.5) - Output - IGRAPH U--- 6 9 -- Hierarchical stochastic block model - + attr: name (g/c), m (g/n), rho (g/n), C (g/n), p (g/n) - + edges: - [1] 1--2 3--4 5--6 1--4 1--5 2--5 1--6 4--5 3--6 - -# hsbm_game_impl errors - - Code - hsbm_game_impl(n = -1, m = 2, rho = 0.5, C = matrix(1, 2, 2), p = 0.5) - Condition - Error in `hsbm_game_impl()`: - ! At vendor/cigraph/src/games/sbm.c:xx : `n' must be positive for HSBM, Invalid value - -# hsbm_list_game_impl basic - - Code - hsbm_list_game_impl(n = 100, mlist = list(50, 50), rholist = list(c(3, 3, 4) / - 10), Clist = list(C), p = 1 / 20) - Output - IGRAPH U--- 100 783 -- Hierarchical stochastic block model - + attr: name (g/c), p (g/n) - + edges: - [1] 1-- 2 1-- 3 2-- 3 1-- 4 2-- 4 3-- 4 1-- 5 2-- 5 3-- 5 4-- 5 - [11] 1-- 6 2-- 6 3-- 6 4-- 6 5-- 6 1-- 7 2-- 7 3-- 7 4-- 7 5-- 7 - [21] 6-- 7 1-- 8 2-- 8 3-- 8 4-- 8 5-- 8 6-- 8 7-- 8 1-- 9 2-- 9 - [31] 3-- 9 4-- 9 5-- 9 6-- 9 7-- 9 8-- 9 1--10 2--10 3--10 4--10 - [41] 5--10 6--10 7--10 8--10 9--10 1--11 2--11 3--11 4--11 5--11 - [51] 6--11 7--11 8--11 9--11 10--11 1--12 2--12 3--12 4--12 5--12 - [61] 6--12 7--12 8--12 9--12 10--12 11--12 1--13 2--13 3--13 4--13 - [71] 5--13 6--13 7--13 8--13 9--13 10--13 11--13 12--13 1--14 2--14 - + ... omitted several edges - -# hsbm_list_game_impl errors - - Code - hsbm_list_game_impl(n = -1, mlist = c(2, 3), rholist = list(0.5, 0.5), Clist = list( - matrix(1, 2, 2), matrix(1, 2, 2)), p = 0.5) - Condition - Error in `hsbm_list_game_impl()`: - ! At vendor/cigraph/src/games/sbm.c:xx : `n' must be positive for HSBM. Invalid value - -# correlated_game_impl basic - - Code - correlated_game_impl(old_graph = g, corr = 0.5) - Output - IGRAPH U--- 5 3 -- Correlated random graph - + attr: name (g/c), corr (g/n), p (g/n) - + edges: - [1] 1--3 3--4 2--5 - -# correlated_game_impl errors - - Code - correlated_game_impl(old_graph = NULL, corr = 0.5) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# correlated_pair_game_impl basic - - Code - correlated_pair_game_impl(n = 5, corr = 0.5, p = 0.5) - Output - $graph1 - IGRAPH U--- 5 7 -- - + edges: - [1] 1--2 1--3 2--3 1--4 2--4 1--5 4--5 - - $graph2 - IGRAPH U--- 5 7 -- - + edges: - [1] 1--2 1--3 2--3 1--4 2--4 1--5 3--5 - - ---- - - Code - correlated_pair_game_impl(n = 5, corr = 0.5, p = 0.5, directed = TRUE) - Output - $graph1 - IGRAPH D--- 5 10 -- - + edges: - [1] 4->1 5->1 2->5 4->2 5->2 3->5 1->4 2->4 4->5 5->4 - - $graph2 - IGRAPH D--- 5 9 -- - + edges: - [1] 1->5 2->1 2->5 4->2 4->3 1->4 2->4 4->5 5->4 - - -# correlated_pair_game_impl errors - - Code - correlated_pair_game_impl(n = -1, corr = 0.5, p = 0.5) - Condition - Error in `correlated_pair_game_impl()`: - ! At vendor/cigraph/src/games/erdos_renyi.c:xx : Invalid number of vertices. Invalid value - -# dot_product_game_impl basic - - Code - dot_product_game_impl(vecs = matrix(0.5, 5, 2)) - Condition - Warning in `dot_product_game_impl()`: - At vendor/cigraph/src/games/dotproduct.c:90 : Greater than 1 connection probability in dot-product graph. - Output - IGRAPH U--- 2 1 -- - + edge: - [1] 1--2 - ---- - - Code - dot_product_game_impl(vecs = matrix(0.5, 5, 2), directed = TRUE) - Condition - Warning in `dot_product_game_impl()`: - At vendor/cigraph/src/games/dotproduct.c:90 : Greater than 1 connection probability in dot-product graph. - Output - IGRAPH D--- 2 2 -- - + edges: - [1] 1->2 2->1 - -# dot_product_game_impl errors - - Code - dot_product_game_impl(vecs = NULL) - Condition - Error in `dot_product_game_impl()`: - ! REAL() can only be applied to a 'numeric', not a 'NULL' - -# sample_sphere_surface_impl basic - - Code - sample_sphere_surface_impl(dim = 3, n = 5) - Output - [,1] [,2] [,3] [,4] [,5] - [1,] 0.87877523 0.8206548 0.1430028 0.6349227 0.99933629 - [2,] 0.05165973 0.5261159 0.1145481 0.2979741 0.02649327 - [3,] 0.47443162 0.2229974 0.9830712 0.7128005 0.02500179 - ---- - - Code - sample_sphere_surface_impl(dim = 3, n = 5, radius = 2, positive = FALSE) - Output - [,1] [,2] [,3] [,4] [,5] - [1,] -0.4904253 -1.4825368 -0.5141332 1.95644246 0.369407 - [2,] -1.6787252 1.1329528 -0.7872709 -0.41498660 1.953509 - [3,] -0.9702395 0.7200713 1.7651832 -0.01090904 0.217584 - -# sample_sphere_surface_impl errors - - Code - sample_sphere_surface_impl(dim = -1, n = 5) - Condition - Error in `sample_sphere_surface_impl()`: - ! At vendor/cigraph/src/games/dotproduct.c:xx : Sphere must be at least two dimensional to sample from surface. Invalid value - -# sample_sphere_volume_impl basic - - Code - sample_sphere_volume_impl(dim = 3, n = 5) - Output - [,1] [,2] [,3] [,4] [,5] - [1,] 0.67165090 0.6105364 0.09806950 0.4132698 0.73325518 - [2,] 0.03948371 0.3914105 0.07855561 0.1939507 0.01943923 - [3,] 0.36260970 0.1659017 0.67417787 0.4639603 0.01834487 - ---- - - Code - sample_sphere_volume_impl(dim = 3, n = 5, radius = 2, positive = FALSE) - Output - [,1] [,2] [,3] [,4] [,5] - [1,] 1.903629152 -1.3795904 -1.2061886 0.9035986 -1.1692436 - [2,] -0.159619927 0.2402815 -0.1258477 0.1842403 -1.4940836 - [3,] 0.003829883 1.2440192 0.6204597 1.5776103 0.4096058 - -# sample_sphere_volume_impl errors - - Code - sample_sphere_volume_impl(dim = -1, n = 5) - Condition - Error in `sample_sphere_volume_impl()`: - ! At vendor/cigraph/src/games/dotproduct.c:xx : Sphere must be at least two dimensional to sample from surface. Invalid value - -# sample_dirichlet_impl basic - - Code - sample_dirichlet_impl(n = 5, alpha = c(1, 1, 1)) - Output - [,1] [,2] [,3] [,4] [,5] - [1,] 0.6298008 0.4168413 0.29594281 0.2432340 0.1516815 - [2,] 0.1093984 0.3461600 0.08924333 0.4251328 0.3561426 - [3,] 0.2608008 0.2369988 0.61481386 0.3316331 0.4921759 - -# sample_dirichlet_impl errors - - Code - sample_dirichlet_impl(n = -1, alpha = c(1, 1, 1)) - Condition - Error in `sample_dirichlet_impl()`: - ! At vendor/cigraph/src/games/dotproduct.c:xx : Number of samples should be non-negative, got -1. Invalid value - -# are_adjacent_impl basic - - Code - are_adjacent_impl(graph = g, v1 = 1, v2 = 2) - Output - [1] TRUE - -# are_adjacent_impl errors - - Code - are_adjacent_impl(graph = NULL, v1 = 1, v2 = 2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# closeness_impl basic - - Code - closeness_impl(graph = g) - Output - $res - [1] 0.3333333 0.5000000 0.3333333 - - $reachable_count - [1] 2 2 2 - - $all_reachable - [1] TRUE - - ---- - - Code - closeness_impl(graph = g, mode = "in", normalized = TRUE) - Output - $res - [1] 0.6666667 1.0000000 0.6666667 - - $reachable_count - [1] 2 2 2 - - $all_reachable - [1] TRUE - - ---- - - Code - closeness_impl(graph = g, vids = V(g), mode = c("out", "in", "all", "total")) - Output - $res - [1] 0.1666667 0.1666667 0.1666667 0.1666667 0.1666667 - - $reachable_count - [1] 4 4 4 4 4 - - $all_reachable - [1] TRUE - - -# closeness_impl errors - - Code - closeness_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# closeness_cutoff_impl basic - - Code - closeness_cutoff_impl(graph = g, cutoff = 2) - Output - $res - [1] 0.3333333 0.5000000 0.3333333 - - $reachable_count - [1] 2 2 2 - - $all_reachable - [1] TRUE - - ---- - - Code - closeness_cutoff_impl(graph = g, mode = "in", normalized = TRUE, cutoff = 1) - Output - $res - [1] 1 1 1 - - $reachable_count - [1] 1 2 1 - - $all_reachable - [1] FALSE - - -# closeness_cutoff_impl errors - - Code - closeness_cutoff_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# get_shortest_path_impl basic - - Code - get_shortest_path_impl(graph = g, from = 1, to = 3) - Output - $vertices - + 3/3 vertices: - [1] 1 2 3 - - $edges - + 2/2 edges: - [1] 1--2 2--3 - - -# get_shortest_path_impl errors - - Code - get_shortest_path_impl(graph = NULL, from = 1, to = 3) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# get_shortest_path_bellman_ford_impl basic - - Code - get_shortest_path_bellman_ford_impl(graph = g, from = 1, to = 3) - Output - $vertices - + 3/3 vertices: - [1] 1 2 3 - - $edges - + 2/2 edges: - [1] 1--2 2--3 - - -# get_shortest_path_bellman_ford_impl errors - - Code - get_shortest_path_bellman_ford_impl(graph = NULL, from = 1, to = 3) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# get_shortest_path_dijkstra_impl basic - - Code - get_shortest_path_dijkstra_impl(graph = g, from = 1, to = 3) - Output - $vertices - + 3/3 vertices: - [1] 1 2 3 - - $edges - + 2/2 edges: - [1] 1--2 2--3 - - -# get_shortest_path_dijkstra_impl errors - - Code - get_shortest_path_dijkstra_impl(graph = NULL, from = 1, to = 3) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# get_all_shortest_paths_impl basic - - Code - get_all_shortest_paths_impl(graph = g, from = 1, to = 3) - Output - $vpaths - $vpaths[[1]] - + 3/3 vertices: - [1] 1 2 3 - - - $epaths - $epaths[[1]] - + 2/2 edges: - [1] 1--2 2--3 - - - $nrgeo - [1] 1 1 1 - - -# get_all_shortest_paths_impl errors - - Code - get_all_shortest_paths_impl(graph = NULL, from = 1, to = 3) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# get_all_shortest_paths_dijkstra_impl basic - - Code - get_all_shortest_paths_dijkstra_impl(graph = g, from = 1, to = 3) - Output - $vpaths - $vpaths[[1]] - + 3/3 vertices: - [1] 1 2 3 - - - $epaths - $epaths[[1]] - + 2/2 edges: - [1] 1--2 2--3 - - - $nrgeo - [1] 1 1 1 - - -# get_all_shortest_paths_dijkstra_impl errors - - Code - get_all_shortest_paths_dijkstra_impl(graph = NULL, from = 1, to = 3) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# voronoi_impl basic - - Code - voronoi_impl(graph = g, generators = 1) - Output - $membership - [1] 0 0 0 - - $distances - [1] 0 1 2 - - ---- - - Code - voronoi_impl(graph = g, generators = 1, mode = "in", tiebreaker = "first") - Output - $membership - [1] 0 0 0 - - $distances - [1] 0 1 2 - - ---- - - Code - voronoi_impl(graph = g, generators = c(1, 5), mode = c("out", "in", "all")) - Output - $membership - [1] 0 0 0 1 1 1 1 1 0 0 - - $distances - [1] 0 1 2 1 0 1 2 3 2 1 - - -# voronoi_impl errors - - Code - voronoi_impl(graph = NULL, generators = 1) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# get_all_simple_paths_impl basic - - Code - get_all_simple_paths_impl(graph = g, from = 1, to = 3) - Output - + 3/3 vertices: - [1] 1 2 3 - -# get_all_simple_paths_impl errors - - Code - get_all_simple_paths_impl(graph = NULL, from = 1, to = 3) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# get_k_shortest_paths_impl basic - - Code - get_k_shortest_paths_impl(graph = g, from = 1, to = 3, k = 2) - Output - $vpaths - $vpaths[[1]] - + 3/3 vertices: - [1] 1 2 3 - - - $epaths - $epaths[[1]] - + 2/2 edges: - [1] 1--2 2--3 - - - -# get_k_shortest_paths_impl errors - - Code - get_k_shortest_paths_impl(graph = NULL, from = 1, to = 3, k = 2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# get_widest_path_impl basic - - Code - get_widest_path_impl(graph = g, from = 1, to = 3, weights = c(1, 2)) - Output - $vertices - + 3/3 vertices: - [1] 1 2 3 - - $edges - + 2/2 edges: - [1] 1--2 2--3 - - -# get_widest_path_impl errors - - Code - get_widest_path_impl(graph = NULL, from = 1, to = 3) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# get_widest_paths_impl basic - - Code - get_widest_paths_impl(graph = g, from = 1, to = 3, weights = c(1, 2)) - Output - $vertices - $vertices[[1]] - + 3/3 vertices: - [1] 1 2 3 - - - $edges - $edges[[1]] - + 2/2 edges: - [1] 1--2 2--3 - - - $parents - [1] -1 0 1 - - $inbound_edges - [1] -1 0 1 - - -# get_widest_paths_impl errors - - Code - get_widest_paths_impl(graph = NULL, from = 1, to = 3) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# spanner_impl basic - - Code - spanner_impl(graph = g, stretch = 2) - Output - + 2/2 edges: - [1] 1--2 2--3 - ---- - - Code - spanner_impl(graph = g, stretch = 2) - Output - + 5/5 edges: - [1] 1--2 2--3 3--4 4--5 1--5 - -# spanner_impl errors - - Code - spanner_impl(graph = NULL, stretch = 2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# betweenness_cutoff_impl basic - - Code - betweenness_cutoff_impl(graph = g, cutoff = 2) - Output - [1] 0 1 0 - -# betweenness_cutoff_impl errors - - Code - betweenness_cutoff_impl(graph = NULL, cutoff = 2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# betweenness_subset_impl basic - - Code - betweenness_subset_impl(graph = g) - Output - [1] 0 1 0 - -# betweenness_subset_impl errors - - Code - betweenness_subset_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# edge_betweenness_impl basic - - Code - edge_betweenness_impl(graph = g) - Output - [1] 2 2 - ---- - - Code - edge_betweenness_impl(graph = g, directed = FALSE) - Output - [1] 4 4 4 4 - -# edge_betweenness_impl errors - - Code - edge_betweenness_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# edge_betweenness_cutoff_impl basic - - Code - edge_betweenness_cutoff_impl(graph = g, cutoff = 2) - Output - [1] 2 2 - -# edge_betweenness_cutoff_impl errors - - Code - edge_betweenness_cutoff_impl(graph = NULL, cutoff = 2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# edge_betweenness_subset_impl basic - - Code - edge_betweenness_subset_impl(graph = g) - Output - [1] 2 2 - -# edge_betweenness_subset_impl errors - - Code - edge_betweenness_subset_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# harmonic_centrality_cutoff_impl basic - - Code - harmonic_centrality_cutoff_impl(graph = g, cutoff = 2) - Output - [1] 1.5 2.0 1.5 - -# harmonic_centrality_cutoff_impl errors - - Code - harmonic_centrality_cutoff_impl(graph = NULL, cutoff = 2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# personalized_pagerank_impl basic - - Code - personalized_pagerank_impl(graph = g) - Output - $vector - [1] 0.2567568 0.4864865 0.2567568 - - $value - [1] 1 - - $options - NULL - - ---- - - Code - personalized_pagerank_impl(graph = g, algo = "arpack", damping = 0.9) - Output - $vector - [1] 0.2543860 0.4912281 0.2543860 - - $value - [1] 1 - - $options - $options$bmat - [1] "I" - - $options$n - [1] 3 - - $options$which - [1] "LR" - - $options$nev - [1] 1 - - $options$tol - [1] 0 - - $options$ncv - [1] 0 - - $options$ldv - [1] 0 - - $options$ishift - [1] 1 - - $options$maxiter - [1] 3000 - - $options$nb - [1] 1 - - $options$mode - [1] 1 - - $options$start - [1] 1 - - $options$sigma - [1] 0 - - $options$sigmai - [1] 0 - - $options$info - [1] 0 - - $options$iter - [1] 1 - - $options$nconv - [1] 1 - - $options$numop - [1] 3 - - $options$numopb - [1] 0 - - $options$numreo - [1] 3 - - - -# personalized_pagerank_impl errors - - Code - personalized_pagerank_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# personalized_pagerank_vs_impl basic - - Code - personalized_pagerank_vs_impl(graph = g, reset_vids = 1) - Output - [1] 0.3452703 0.4594595 0.1952703 - ---- - - Code - personalized_pagerank_vs_impl(graph = g, algo = "arpack", reset_vids = 1, - details = TRUE) - Output - $vector - [1] 0.3452703 0.4594595 0.1952703 - - $value - [1] 1 - - $options - $options$bmat - [1] "I" - - $options$n - [1] 3 - - $options$which - [1] "LR" - - $options$nev - [1] 1 - - $options$tol - [1] 0 - - $options$ncv - [1] 0 - - $options$ldv - [1] 0 - - $options$ishift - [1] 1 - - $options$maxiter - [1] 3000 - - $options$nb - [1] 1 - - $options$mode - [1] 1 - - $options$start - [1] 1 - - $options$sigma - [1] 0 - - $options$sigmai - [1] 0 - - $options$info - [1] 0 - - $options$iter - [1] 1 - - $options$nconv - [1] 1 - - $options$numop - [1] 3 - - $options$numopb - [1] 0 - - $options$numreo - [1] 3 - - - -# personalized_pagerank_vs_impl errors - - Code - personalized_pagerank_vs_impl(graph = NULL, reset_vids = 1) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# induced_subgraph_impl basic - - Code - induced_subgraph_impl(graph = g, vids = 1:2) - Output - IGRAPH U--- 2 1 -- - + edge: - [1] 1--2 - -# induced_subgraph_impl errors - - Code - induced_subgraph_impl(graph = NULL, vids = 1:2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# subgraph_from_edges_impl basic - - Code - subgraph_from_edges_impl(graph = g, eids = 1) - Output - IGRAPH U--- 2 1 -- - + edge: - [1] 1--2 - -# subgraph_from_edges_impl errors - - Code - subgraph_from_edges_impl(graph = NULL, eids = 1) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# reverse_edges_impl basic - - Code - reverse_edges_impl(graph = g) - Output - IGRAPH U--- 3 2 -- - + edges: - [1] 1--2 2--3 - -# reverse_edges_impl errors - - Code - reverse_edges_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# path_length_hist_impl basic - - Code - path_length_hist_impl(graph = g) - Output - $res - [1] 2 1 - - $unconnected - [1] 0 - - ---- - - Code - path_length_hist_impl(graph = g, directed = FALSE) - Output - $res - [1] 2 1 - - $unconnected - [1] 0 - - -# path_length_hist_impl errors - - Code - path_length_hist_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# simplify_impl basic - - Code - simplify_impl(graph = g) - Output - IGRAPH U--- 3 2 -- - + edges: - [1] 1--2 2--3 - ---- - - Code - simplify_impl(graph = g, remove_multiple = FALSE, remove_loops = FALSE) - Output - IGRAPH U--- 3 2 -- - + edges: - [1] 1--2 2--3 - -# simplify_impl errors - - Code - simplify_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# transitivity_undirected_impl basic - - Code - transitivity_undirected_impl(graph = g) - Output - [1] 0 - ---- - - Code - transitivity_undirected_impl(graph = g, mode = "zero") - Output - [1] 0 - -# transitivity_undirected_impl errors - - Code - transitivity_undirected_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# transitivity_local_undirected_impl basic - - Code - transitivity_local_undirected_impl(graph = g) - Output - [1] NaN 0 NaN - ---- - - Code - transitivity_local_undirected_impl(graph = g, mode = "zero") - Output - [1] 0 0 0 - -# transitivity_local_undirected_impl errors - - Code - transitivity_local_undirected_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# transitivity_avglocal_undirected_impl basic - - Code - transitivity_avglocal_undirected_impl(graph = g) - Output - [1] 0 - ---- - - Code - transitivity_avglocal_undirected_impl(graph = g, mode = "zero") - Output - [1] 0 - -# transitivity_avglocal_undirected_impl errors - - Code - transitivity_avglocal_undirected_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# transitivity_barrat_impl basic - - Code - transitivity_barrat_impl(graph = g) - Condition - Warning in `transitivity_barrat_impl()`: - At vendor/cigraph/src/properties/triangles.c:913 : No weights given for Barrat's transitivity, unweighted version is used. - Output - [1] NaN 0 NaN - ---- - - Code - transitivity_barrat_impl(graph = g, mode = "zero") - Condition - Warning in `transitivity_barrat_impl()`: - At vendor/cigraph/src/properties/triangles.c:913 : No weights given for Barrat's transitivity, unweighted version is used. - Output - [1] 0 0 0 - -# transitivity_barrat_impl errors - - Code - transitivity_barrat_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# ecc_impl basic - - Code - ecc_impl(graph = g) - Output - [1] NaN 0 NaN - ---- - - Code - ecc_impl(graph = g, k = 3, offset = TRUE, normalize = FALSE) - Output - [1] 1 1 1 - -# ecc_impl errors - - Code - ecc_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# reciprocity_impl basic - - Code - reciprocity_impl(graph = g) - Output - [1] 1 - ---- - - Code - reciprocity_impl(graph = g, ignore_loops = FALSE, mode = "ratio") - Output - [1] 1 - -# reciprocity_impl errors - - Code - reciprocity_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# maxdegree_impl basic - - Code - maxdegree_impl(graph = g) - Output - [1] 2 - ---- - - Code - maxdegree_impl(graph = g, mode = "in", loops = FALSE) - Output - [1] 2 - -# maxdegree_impl errors - - Code - maxdegree_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# density_impl basic - - Code - density_impl(graph = g) - Output - [1] 0.6666667 - ---- - - Code - density_impl(graph = g, loops = TRUE) - Output - [1] 0.3333333 - -# density_impl errors - - Code - density_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# mean_degree_impl basic - - Code - mean_degree_impl(graph = g) - Output - [1] 1.333333 - ---- - - Code - mean_degree_impl(graph = g, loops = FALSE) - Output - [1] 1.333333 - -# mean_degree_impl errors - - Code - mean_degree_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# feedback_arc_set_impl basic - - Code - feedback_arc_set_impl(graph = g) - Output - + 0/2 edges: - ---- - - Code - feedback_arc_set_impl(graph = g, algo = "exact_ip") - Output - + 0/2 edges: - -# feedback_arc_set_impl errors - - Code - feedback_arc_set_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# feedback_vertex_set_impl basic - - Code - feedback_vertex_set_impl(graph = g) - Output - + 0/3 vertices: - -# feedback_vertex_set_impl errors - - Code - feedback_vertex_set_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# is_loop_impl basic - - Code - is_loop_impl(graph = g) - Output - [1] FALSE FALSE - -# is_loop_impl errors - - Code - is_loop_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# is_dag_impl basic - - Code - is_dag_impl(graph = g) - Output - [1] FALSE - -# is_dag_impl errors - - Code - is_dag_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# is_acyclic_impl basic - - Code - is_acyclic_impl(graph = g) - Output - [1] TRUE - -# is_acyclic_impl errors - - Code - is_acyclic_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# is_simple_impl basic - - Code - is_simple_impl(graph = g) - Output - [1] TRUE - -# is_simple_impl errors - - Code - is_simple_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# is_multiple_impl basic - - Code - is_multiple_impl(graph = g) - Output - [1] FALSE FALSE - -# is_multiple_impl errors - - Code - is_multiple_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# has_loop_impl basic - - Code - has_loop_impl(graph = g) - Output - [1] FALSE - -# has_loop_impl errors - - Code - has_loop_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# has_multiple_impl basic - - Code - has_multiple_impl(graph = g) - Output - [1] FALSE - -# has_multiple_impl errors - - Code - has_multiple_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# count_loops_impl basic - - Code - count_loops_impl(graph = g) - Output - [1] 0 - -# count_loops_impl errors - - Code - count_loops_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# count_multiple_impl basic - - Code - count_multiple_impl(graph = g) - Output - [1] 1 1 - -# count_multiple_impl errors - - Code - count_multiple_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# is_perfect_impl basic - - Code - is_perfect_impl(graph = g) - Output - [1] TRUE - -# is_perfect_impl errors - - Code - is_perfect_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# eigenvector_centrality_impl basic - - Code - eigenvector_centrality_impl(graph = g) - Output - $vector - [1] 0.7071068 1.0000000 0.7071068 - - $value - [1] 1.414214 - - $options - $options$bmat - [1] "I" - - $options$n - [1] 3 - - $options$which - [1] "LA" - - $options$nev - [1] 1 - - $options$tol - [1] 0 - - $options$ncv - [1] 0 - - $options$ldv - [1] 0 - - $options$ishift - [1] 1 - - $options$maxiter - [1] 3000 - - $options$nb - [1] 1 - - $options$mode - [1] 1 - - $options$start - [1] 1 - - $options$sigma - [1] 0 - - $options$sigmai - [1] 0 - - $options$info - [1] 0 - - $options$iter - [1] 1 - - $options$nconv - [1] 1 - - $options$numop - [1] 3 - - $options$numopb - [1] 0 - - $options$numreo - [1] 3 - - - ---- - - Code - eigenvector_centrality_impl(graph = g, directed = TRUE, scale = FALSE) - Output - $vector - [1] 0.5000000 0.7071068 0.5000000 - - $value - [1] 1.414214 - - $options - $options$bmat - [1] "I" - - $options$n - [1] 3 - - $options$which - [1] "LA" - - $options$nev - [1] 1 - - $options$tol - [1] 0 - - $options$ncv - [1] 0 - - $options$ldv - [1] 0 - - $options$ishift - [1] 1 - - $options$maxiter - [1] 3000 - - $options$nb - [1] 1 - - $options$mode - [1] 1 - - $options$start - [1] 1 - - $options$sigma - [1] 0 - - $options$sigmai - [1] 0 - - $options$info - [1] 0 - - $options$iter - [1] 1 - - $options$nconv - [1] 1 - - $options$numop - [1] 3 - - $options$numopb - [1] 0 - - $options$numreo - [1] 3 - - - -# eigenvector_centrality_impl errors - - Code - eigenvector_centrality_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# hub_and_authority_scores_impl basic - - Code - hub_and_authority_scores_impl(graph = g) - Output - $hub - [1] 1 1 1 1 1 - - $authority - [1] 1 1 1 1 1 - - $value - [1] 16 - - $options - $options$bmat - [1] "I" - - $options$n - [1] 5 - - $options$which - [1] "LA" - - $options$nev - [1] 1 - - $options$tol - [1] 0 - - $options$ncv - [1] 0 - - $options$ldv - [1] 0 - - $options$ishift - [1] 1 - - $options$maxiter - [1] 3000 - - $options$nb - [1] 1 - - $options$mode - [1] 1 - - $options$start - [1] 1 - - $options$sigma - [1] 0 - - $options$sigmai - [1] 0 - - $options$info - [1] 0 - - $options$iter - [1] 1 - - $options$nconv - [1] 1 - - $options$numop - [1] 4 - - $options$numopb - [1] 0 - - $options$numreo - [1] 4 - - - ---- - - Code - hub_and_authority_scores_impl(graph = g, scale = FALSE) - Output - $hub - [1] 0.4472136 0.4472136 0.4472136 0.4472136 0.4472136 - - $authority - [1] 0.4472136 0.4472136 0.4472136 0.4472136 0.4472136 - - $value - [1] 16 - - $options - $options$bmat - [1] "I" - - $options$n - [1] 5 - - $options$which - [1] "LA" - - $options$nev - [1] 1 - - $options$tol - [1] 0 - - $options$ncv - [1] 0 - - $options$ldv - [1] 0 - - $options$ishift - [1] 1 - - $options$maxiter - [1] 3000 - - $options$nb - [1] 1 - - $options$mode - [1] 1 - - $options$start - [1] 1 - - $options$sigma - [1] 0 - - $options$sigmai - [1] 0 - - $options$info - [1] 0 - - $options$iter - [1] 1 - - $options$nconv - [1] 1 - - $options$numop - [1] 4 - - $options$numopb - [1] 0 - - $options$numreo - [1] 4 - - - -# hub_and_authority_scores_impl errors - - Code - hub_and_authority_scores_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# unfold_tree_impl basic - - Code - unfold_tree_impl(graph = g, roots = 1) - Output - $tree - IGRAPH U--- 3 2 -- - + edges: - [1] 1--2 2--3 - - $vertex_index - [1] 1 2 3 - - ---- - - Code - unfold_tree_impl(graph = g, mode = "in", roots = 1) - Output - $tree - IGRAPH U--- 3 2 -- - + edges: - [1] 1--2 2--3 - - $vertex_index - [1] 1 2 3 - - -# unfold_tree_impl errors - - Code - unfold_tree_impl(graph = NULL, roots = 1) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# is_mutual_impl basic - - Code - is_mutual_impl(graph = g) - Output - [1] TRUE TRUE - ---- - - Code - is_mutual_impl(graph = g, loops = FALSE) - Output - [1] TRUE TRUE - -# is_mutual_impl errors - - Code - is_mutual_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# has_mutual_impl basic - - Code - has_mutual_impl(graph = g) - Output - [1] TRUE - ---- - - Code - has_mutual_impl(graph = g, loops = FALSE) - Output - [1] TRUE - -# has_mutual_impl errors - - Code - has_mutual_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# maximum_cardinality_search_impl basic - - Code - maximum_cardinality_search_impl(graph = g) - Output - $alpha - [1] 3 2 1 - - $alpham1 - + 3/3 vertices: - [1] 3 2 1 - - -# maximum_cardinality_search_impl errors - - Code - maximum_cardinality_search_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# avg_nearest_neighbor_degree_impl basic - - Code - avg_nearest_neighbor_degree_impl(graph = g) - Output - $knn - [1] 2 1 2 - - $knnk - [1] 2 1 - - ---- - - Code - avg_nearest_neighbor_degree_impl(graph = g, mode = "in", neighbor_degree_mode = "out") - Output - $knn - [1] 2 1 2 - - $knnk - [1] 2 1 - - -# avg_nearest_neighbor_degree_impl errors - - Code - avg_nearest_neighbor_degree_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# degree_correlation_vector_impl basic - - Code - degree_correlation_vector_impl(graph = g) - Output - [1] NaN 2 1 - ---- - - Code - degree_correlation_vector_impl(graph = g, from_mode = "in", to_mode = "out", - directed_neighbors = FALSE) - Output - [1] NaN 2 1 - -# degree_correlation_vector_impl errors - - Code - degree_correlation_vector_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# rich_club_sequence_impl basic - - Code - rich_club_sequence_impl(graph = g, vertex_order = 1:3) - Output - [1] 0.6666667 1.0000000 NaN - ---- - - Code - rich_club_sequence_impl(graph = g, vertex_order = 1:3, normalized = FALSE, - loops = TRUE, directed = FALSE) - Output - [1] 2 1 0 - -# rich_club_sequence_impl errors - - Code - rich_club_sequence_impl(graph = NULL, vertex_order = 1:3) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# strength_impl basic - - Code - strength_impl(graph = g) - Output - [1] 1 2 1 - ---- - - Code - strength_impl(graph = g, mode = "in", loops = FALSE) - Output - [1] 1 2 1 - -# strength_impl errors - - Code - strength_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# centralization_impl basic - - Code - centralization_impl(scores = c(1, 2, 3)) - Output - [1] Inf - ---- - - Code - centralization_impl(scores = c(1, 2, 3), theoretical_max = 2, normalized = FALSE) - Output - [1] 3 - -# centralization_impl errors - - Code - centralization_impl(scores = package_version("1.2.3")) - Condition - Error in `centralization_impl()`: - ! 'list' object cannot be coerced to type 'double' - -# centralization_degree_impl basic - - Code - centralization_degree_impl(graph = g) - Output - $res - [1] 1 2 1 - - $centralization - [1] 0.3333333 - - $theoretical_max - [1] 6 - - ---- - - Code - centralization_degree_impl(graph = g, mode = "in", loops = FALSE, normalized = FALSE) - Output - $res - [1] 1 2 1 - - $centralization - [1] 2 - - $theoretical_max - [1] 2 - - -# centralization_degree_impl errors - - Code - centralization_degree_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# centralization_degree_tmax_impl basic - - Code - centralization_degree_tmax_impl(nodes = 3, loops = TRUE) - Output - [1] 6 - ---- - - Code - centralization_degree_tmax_impl(nodes = 3, mode = "in", loops = FALSE) - Output - [1] 4 - -# centralization_degree_tmax_impl errors - - Code - centralization_degree_tmax_impl(nodes = -1, loops = TRUE) - Condition - Error in `centralization_degree_tmax_impl()`: - ! At vendor/cigraph/src/centrality/centralization.c:xx : Number of vertices must not be negative. Invalid value - -# centralization_betweenness_impl basic - - Code - centralization_betweenness_impl(graph = g) - Output - $res - [1] 0 1 0 - - $centralization - [1] 1 - - $theoretical_max - [1] 2 - - ---- - - Code - centralization_betweenness_impl(graph = g, directed = FALSE, normalized = FALSE) - Output - $res - [1] 0 1 0 - - $centralization - [1] 2 - - $theoretical_max - [1] 2 - - -# centralization_betweenness_impl errors - - Code - centralization_betweenness_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# centralization_betweenness_tmax_impl basic - - Code - centralization_betweenness_tmax_impl(nodes = 3, directed = TRUE) - Output - [1] 4 - ---- - - Code - centralization_betweenness_tmax_impl(nodes = 3, directed = FALSE) - Output - [1] 2 - -# centralization_betweenness_tmax_impl errors - - Code - centralization_betweenness_tmax_impl(nodes = -1, directed = TRUE) - Condition - Error in `centralization_betweenness_tmax_impl()`: - ! At vendor/cigraph/src/centrality/centralization.c:xx : Number of vertices must not be negative. Invalid value - -# centralization_closeness_impl basic - - Code - centralization_closeness_impl(graph = g) - Output - $res - [1] 0.6666667 1.0000000 0.6666667 - - $centralization - [1] 1 - - $theoretical_max - [1] 0.6666667 - - ---- - - Code - centralization_closeness_impl(graph = g, mode = "in", normalized = FALSE) - Output - $res - [1] 0.6666667 1.0000000 0.6666667 - - $centralization - [1] 0.6666667 - - $theoretical_max - [1] 0.6666667 - - -# centralization_closeness_impl errors - - Code - centralization_closeness_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# centralization_closeness_tmax_impl basic - - Code - centralization_closeness_tmax_impl(nodes = 3) - Output - [1] 1.333333 - ---- - - Code - centralization_closeness_tmax_impl(nodes = 3, mode = "in") - Output - [1] 1.333333 - -# centralization_closeness_tmax_impl errors - - Code - centralization_closeness_tmax_impl(nodes = -1) - Condition - Error in `centralization_closeness_tmax_impl()`: - ! At vendor/cigraph/src/centrality/centralization.c:xx : Number of vertices must not be negative. Invalid value - -# centralization_eigenvector_centrality_impl basic - - Code - centralization_eigenvector_centrality_impl(graph = g) - Output - $vector - [1] 0.7071068 1.0000000 0.7071068 - - $value - [1] 1.414214 - - $options - $options$bmat - [1] "I" - - $options$n - [1] 3 - - $options$which - [1] "LA" - - $options$nev - [1] 1 - - $options$tol - [1] 0 - - $options$ncv - [1] 0 - - $options$ldv - [1] 0 - - $options$ishift - [1] 1 - - $options$maxiter - [1] 3000 - - $options$nb - [1] 1 - - $options$mode - [1] 1 - - $options$start - [1] 1 - - $options$sigma - [1] 0 - - $options$sigmai - [1] 0 - - $options$info - [1] 0 - - $options$iter - [1] 1 - - $options$nconv - [1] 1 - - $options$numop - [1] 3 - - $options$numopb - [1] 0 - - $options$numreo - [1] 3 - - - $centralization - [1] 0.5857864 - - $theoretical_max - [1] 1 - - ---- - - Code - centralization_eigenvector_centrality_impl(graph = g, directed = TRUE, - normalized = FALSE) - Output - $vector - [1] 0.7071068 1.0000000 0.7071068 - - $value - [1] 1.414214 - - $options - $options$bmat - [1] "I" - - $options$n - [1] 3 - - $options$which - [1] "LA" - - $options$nev - [1] 1 - - $options$tol - [1] 0 - - $options$ncv - [1] 0 - - $options$ldv - [1] 0 - - $options$ishift - [1] 1 - - $options$maxiter - [1] 3000 - - $options$nb - [1] 1 - - $options$mode - [1] 1 - - $options$start - [1] 1 - - $options$sigma - [1] 0 - - $options$sigmai - [1] 0 - - $options$info - [1] 0 - - $options$iter - [1] 1 - - $options$nconv - [1] 1 - - $options$numop - [1] 3 - - $options$numopb - [1] 0 - - $options$numreo - [1] 3 - - - $centralization - [1] 0.5857864 - - $theoretical_max - [1] 1 - - -# centralization_eigenvector_centrality_impl errors - - Code - centralization_eigenvector_centrality_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# centralization_eigenvector_centrality_tmax_impl basic - - Code - centralization_eigenvector_centrality_tmax_impl(nodes = 3) - Output - [1] 1 - ---- - - Code - centralization_eigenvector_centrality_tmax_impl(nodes = 3, directed = TRUE) - Output - [1] 2 - -# centralization_eigenvector_centrality_tmax_impl errors - - Code - centralization_eigenvector_centrality_tmax_impl(nodes = -1) - Condition - Error in `centralization_eigenvector_centrality_tmax_impl()`: - ! At vendor/cigraph/src/centrality/centralization.c:xx : Number of vertices must not be negative. Invalid value - -# assortativity_nominal_impl basic - - Code - assortativity_nominal_impl(graph = g, types = c(1, 2, 1)) - Output - [1] -1 - ---- - - Code - assortativity_nominal_impl(graph = g, types = c(1, 2, 1), directed = FALSE, - normalized = FALSE) - Output - [1] -0.5 - -# assortativity_nominal_impl errors - - Code - assortativity_nominal_impl(graph = NULL, types = c(1, 2, 1)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# assortativity_impl basic - - Code - assortativity_impl(graph = g, values = c(1, 2, 1)) - Output - [1] -1 - ---- - - Code - assortativity_impl(graph = g, values = c(1, 2, 1), directed = FALSE, - normalized = FALSE) - Output - [1] -0.25 - -# assortativity_impl errors - - Code - assortativity_impl(graph = NULL, values = c(1, 2, 1)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# assortativity_degree_impl basic - - Code - assortativity_degree_impl(graph = g) - Output - [1] -1 - ---- - - Code - assortativity_degree_impl(graph = g, directed = FALSE) - Output - [1] -1 - -# assortativity_degree_impl errors - - Code - assortativity_degree_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# joint_degree_matrix_impl basic - - Code - joint_degree_matrix_impl(graph = g) - Output - [,1] [,2] - [1,] 0 2 - [2,] 2 0 - ---- - - Code - joint_degree_matrix_impl(graph = g, max_out_degree = 2, max_in_degree = 2) - Output - [,1] [,2] - [1,] 0 2 - [2,] 2 0 - -# joint_degree_matrix_impl errors - - Code - joint_degree_matrix_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# joint_degree_distribution_impl basic - - Code - joint_degree_distribution_impl(graph = g) - Output - [,1] [,2] [,3] - [1,] 0 0.0 0.0 - [2,] 0 0.0 0.5 - [3,] 0 0.5 0.0 - ---- - - Code - joint_degree_distribution_impl(graph = g, from_mode = "in", to_mode = "out", - directed_neighbors = FALSE, normalized = FALSE, max_from_degree = 2, - max_to_degree = 2) - Output - [,1] [,2] [,3] - [1,] 0 0 0 - [2,] 0 0 2 - [3,] 0 2 0 - -# joint_degree_distribution_impl errors - - Code - joint_degree_distribution_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# joint_type_distribution_impl basic - - Code - joint_type_distribution_impl(graph = g, from_types = c(1, 2, 1)) - Output - [,1] [,2] - [1,] 0.0 0.5 - [2,] 0.5 0.0 - ---- - - Code - joint_type_distribution_impl(graph = g, from_types = c(1, 2, 1), to_types = c(1, - 2, 1), directed = FALSE, normalized = FALSE) - Output - [,1] [,2] - [1,] 0 2 - [2,] 2 0 - -# joint_type_distribution_impl errors - - Code - joint_type_distribution_impl(graph = NULL, from_types = c(1, 2, 1)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# contract_vertices_impl basic - - Code - contract_vertices_impl(graph = g, mapping = c(1, 1, 2)) - Output - IGRAPH U--- 2 2 -- - + edges: - [1] 1--1 1--2 - -# contract_vertices_impl errors - - Code - contract_vertices_impl(graph = NULL, mapping = c(1, 1, 2)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# eccentricity_dijkstra_impl basic - - Code - eccentricity_dijkstra_impl(graph = g) - Output - [1] 2 1 2 - ---- - - Code - eccentricity_dijkstra_impl(graph = g, mode = "in") - Output - [1] 2 1 2 - -# eccentricity_dijkstra_impl errors - - Code - eccentricity_dijkstra_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# graph_center_dijkstra_impl basic - - Code - graph_center_dijkstra_impl(graph = g) - Output - + 1/3 vertex: - [1] 2 - ---- - - Code - graph_center_dijkstra_impl(graph = g, mode = "in") - Output - + 1/3 vertex: - [1] 2 - -# graph_center_dijkstra_impl errors - - Code - graph_center_dijkstra_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# radius_dijkstra_impl basic - - Code - radius_dijkstra_impl(graph = g) - Output - [1] 1 - ---- - - Code - radius_dijkstra_impl(graph = g, mode = "in") - Output - [1] 1 - -# radius_dijkstra_impl errors - - Code - radius_dijkstra_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# pseudo_diameter_impl basic - - Code - pseudo_diameter_impl(graph = g, start_vid = 1) - Output - $diameter - [1] 2 - - $from - [1] 0 - - $to - [1] 2 - - ---- - - Code - pseudo_diameter_impl(graph = g, start_vid = 1, directed = FALSE, unconnected = FALSE) - Output - $diameter - [1] 2 - - $from - [1] 0 - - $to - [1] 2 - - -# pseudo_diameter_impl errors - - Code - pseudo_diameter_impl(graph = NULL, start_vid = 1) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# pseudo_diameter_dijkstra_impl basic - - Code - pseudo_diameter_dijkstra_impl(graph = g, start_vid = 1) - Output - $diameter - [1] 2 - - $from - [1] 0 - - $to - [1] 2 - - ---- - - Code - pseudo_diameter_dijkstra_impl(graph = g, start_vid = 1, directed = FALSE, - unconnected = FALSE) - Output - $diameter - [1] 2 - - $from - [1] 0 - - $to - [1] 2 - - -# pseudo_diameter_dijkstra_impl errors - - Code - pseudo_diameter_dijkstra_impl(graph = NULL, start_vid = 1) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# diversity_impl basic - - Code - diversity_impl(graph = g) - Output - [1] 0.0000000 0.9182958 0.0000000 - -# diversity_impl errors - - Code - diversity_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# random_walk_impl basic - - Code - random_walk_impl(graph = g, start = 1, steps = 2) - Output - $vertices - + 3/3 vertices: - [1] 1 2 3 - - $edges - + 2/2 edges: - [1] 1--2 2--3 - - ---- - - Code - random_walk_impl(graph = g, start = 1, steps = 2, mode = "in", stuck = "error") - Output - $vertices - + 3/3 vertices: - [1] 1 2 1 - - $edges - + 2/2 edges: - [1] 1--2 1--2 - - -# random_walk_impl errors - - Code - random_walk_impl(graph = NULL, start = 1, steps = 2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# global_efficiency_impl basic - - Code - global_efficiency_impl(graph = g) - Output - [1] 0.8333333 - ---- - - Code - global_efficiency_impl(graph = g, directed = FALSE) - Output - [1] 0.8333333 - -# global_efficiency_impl errors - - Code - global_efficiency_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# local_efficiency_impl basic - - Code - local_efficiency_impl(graph = g) - Output - [1] 0 0 0 - ---- - - Code - local_efficiency_impl(graph = g, directed = FALSE, mode = "in") - Output - [1] 0 0 0 - -# local_efficiency_impl errors - - Code - local_efficiency_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# average_local_efficiency_impl basic - - Code - average_local_efficiency_impl(graph = g) - Output - [1] 0 - ---- - - Code - average_local_efficiency_impl(graph = g, directed = FALSE, mode = "in") - Output - [1] 0 - -# average_local_efficiency_impl errors - - Code - average_local_efficiency_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# transitive_closure_dag_impl basic - - Code - transitive_closure_dag_impl(graph = g) - Output - IGRAPH D--- 3 3 -- - + edges: - [1] 1->3 1->2 2->3 - -# transitive_closure_dag_impl errors - - Code - transitive_closure_dag_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# transitive_closure_impl basic - - Code - transitive_closure_impl(graph = g) - Output - IGRAPH U--- 3 3 -- - + edges: - [1] 1--2 1--3 2--3 - -# transitive_closure_impl errors - - Code - transitive_closure_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# trussness_impl basic - - Code - trussness_impl(graph = g) - Output - [1] 2 2 - -# trussness_impl errors - - Code - trussness_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# is_graphical_impl basic - - Code - is_graphical_impl(out_deg = c(2, 2, 2)) - Output - [1] TRUE - ---- - - Code - is_graphical_impl(out_deg = c(2, 2, 2), in_deg = c(1, 1, 1), - allowed_edge_types = "all") - Output - [1] FALSE - -# is_graphical_impl errors - - Code - is_graphical_impl(out_deg = "a") - Condition - Warning in `is_graphical_impl()`: - NAs introduced by coercion - Error in `is_graphical_impl()`: - ! At rinterface_extra.c:xx : The value nan is not representable as an integer. Invalid value - -# bfs_simple_impl basic - - Code - bfs_simple_impl(graph = g, root = 1) - Output - $order - + 3/3 vertices: - [1] 1 2 3 - - $layers - [1] 0 1 2 3 - - $parents - [1] -1 0 1 - - ---- - - Code - bfs_simple_impl(graph = g, root = 1, mode = "in") - Output - $order - + 3/3 vertices: - [1] 1 2 3 - - $layers - [1] 0 1 2 3 - - $parents - [1] -1 0 1 - - -# bfs_simple_impl errors - - Code - bfs_simple_impl(graph = NULL, root = 1) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# bipartite_projection_size_impl basic - - Code - bipartite_projection_size_impl(graph = g) - Output - $vcount1 - [1] 2 - - $ecount1 - [1] 1 - - $vcount2 - [1] 2 - - $ecount2 - [1] 1 - - -# bipartite_projection_size_impl errors - - Code - bipartite_projection_size_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# biadjacency_impl basic - - Code - biadjacency_impl(incidence = m) - Output - $graph - IGRAPH U--- 5 4 -- - + edges: - [1] 1--3 1--4 1--5 2--5 - - $types - [1] FALSE FALSE TRUE TRUE TRUE - - ---- - - Code - biadjacency_impl(incidence = m, directed = TRUE, mode = "in", multiple = TRUE) - Output - $graph - IGRAPH D--- 5 4 -- - + edges: - [1] 3->1 4->1 5->1 5->2 - - $types - [1] FALSE FALSE TRUE TRUE TRUE - - -# biadjacency_impl errors - - Code - biadjacency_impl(incidence = "a") - Condition - Warning in `biadjacency_impl()`: - NAs introduced by coercion - Error in `biadjacency_impl()`: - ! REAL() can only be applied to a 'numeric', not a 'character' - -# get_biadjacency_impl basic - - Code - get_biadjacency_impl(graph = g, types = c(TRUE, FALSE, TRUE)) - Output - $res - [,1] [,2] - [1,] 1 1 - - $row_ids - [1] 2 - - $col_ids - [1] 1 3 - - -# get_biadjacency_impl errors - - Code - get_biadjacency_impl(graph = NULL, types = c(TRUE, FALSE, TRUE)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# is_bipartite_impl basic - - Code - is_bipartite_impl(graph = g) - Output - $res - [1] TRUE - - $type - [1] FALSE TRUE FALSE - - -# is_bipartite_impl errors - - Code - is_bipartite_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# bipartite_game_gnp_impl basic - - Code - bipartite_game_gnp_impl(n1 = 2, n2 = 2, p = 0.5) - Output - $graph - IGRAPH U--- 4 4 -- - + edges: - [1] 1--3 2--3 1--4 2--4 - - $types - [1] FALSE FALSE TRUE TRUE - - ---- - - Code - bipartite_game_gnp_impl(n1 = 2, n2 = 2, p = 0.5, directed = TRUE, mode = "in") - Output - $graph - IGRAPH D--- 4 1 -- - + edge: - [1] 3->2 - - $types - [1] FALSE FALSE TRUE TRUE - - -# bipartite_game_gnp_impl errors - - Code - bipartite_game_gnp_impl(n1 = -1, n2 = 2, p = 0.5) - Condition - Error in `bipartite_game_gnp_impl()`: - ! At vendor/cigraph/src/misc/bipartite.c:xx : Invalid number of vertices for bipartite graph. Invalid value - -# bipartite_game_gnm_impl basic - - Code - bipartite_game_gnm_impl(n1 = 2, n2 = 2, m = 1) - Output - $graph - IGRAPH U--- 4 1 -- - + edge: - [1] 2--4 - - $types - [1] FALSE FALSE TRUE TRUE - - ---- - - Code - bipartite_game_gnm_impl(n1 = 2, n2 = 2, m = 1, directed = TRUE, mode = "in") - Output - $graph - IGRAPH D--- 4 1 -- - + edge: - [1] 3->1 - - $types - [1] FALSE FALSE TRUE TRUE - - -# bipartite_game_gnm_impl errors - - Code - bipartite_game_gnm_impl(n1 = -1, n2 = 2, m = 1) - Condition - Error in `bipartite_game_gnm_impl()`: - ! At vendor/cigraph/src/misc/bipartite.c:xx : Invalid number of vertices for bipartite graph. Invalid value - -# get_laplacian_impl basic - - Code - get_laplacian_impl(graph = g) - Output - [,1] [,2] [,3] - [1,] 1 -1 0 - [2,] -1 2 -1 - [3,] 0 -1 1 - ---- - - Code - get_laplacian_impl(graph = g, mode = "in", normalization = "symmetric", - weights = c(1, 2)) - Output - [,1] [,2] [,3] - [1,] 1.0000000 -0.5773503 0.0000000 - [2,] -0.5773503 1.0000000 -0.8164966 - [3,] 0.0000000 -0.8164966 1.0000000 - -# get_laplacian_impl errors - - Code - get_laplacian_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# get_laplacian_sparse_impl basic - - Code - get_laplacian_sparse_impl(graph = g) - Output - $type - [1] "triplet" - - $dim - [1] 3 3 - - $p - [1] 0 1 2 0 1 1 2 - - $i - [1] 0 1 2 1 0 2 1 - - $x - [1] 1 2 1 -1 -1 -1 -1 - - attr(,"class") - [1] "igraph.tmp.sparse" - ---- - - Code - get_laplacian_sparse_impl(graph = g, mode = "in", normalization = "symmetric", - weights = c(1, 2)) - Output - $type - [1] "triplet" - - $dim - [1] 3 3 - - $p - [1] 0 1 2 0 1 1 2 - - $i - [1] 0 1 2 1 0 2 1 - - $x - [1] 1.0000000 1.0000000 1.0000000 -0.5773503 -0.5773503 -0.8164966 -0.8164966 - - attr(,"class") - [1] "igraph.tmp.sparse" - -# get_laplacian_sparse_impl errors - - Code - get_laplacian_sparse_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# connected_components_impl basic - - Code - connected_components_impl(graph = g) - Output - [1] 0 0 0 - ---- - - Code - connected_components_impl(graph = g, mode = "strong", details = TRUE) - Output - $membership - [1] 0 0 0 - - $csize - [1] 3 - - $no - [1] 1 - - -# connected_components_impl errors - - Code - connected_components_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# is_connected_impl basic - - Code - is_connected_impl(graph = g) - Output - [1] TRUE - ---- - - Code - is_connected_impl(graph = g, mode = "strong") - Output - [1] TRUE - -# is_connected_impl errors - - Code - is_connected_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# articulation_points_impl basic - - Code - articulation_points_impl(graph = g) - Output - + 1/3 vertex: - [1] 2 - -# articulation_points_impl errors - - Code - articulation_points_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# biconnected_components_impl basic - - Code - biconnected_components_impl(graph = g) - Output - $no - [1] 2 - - $tree_edges - $tree_edges[[1]] - + 1/2 edge: - [1] 2--3 - - $tree_edges[[2]] - + 1/2 edge: - [1] 1--2 - - - $component_edges - $component_edges[[1]] - + 1/2 edge: - [1] 2--3 - - $component_edges[[2]] - + 1/2 edge: - [1] 1--2 - - - $components - $components[[1]] - + 2/3 vertices: - [1] 3 2 - - $components[[2]] - + 2/3 vertices: - [1] 2 1 - - - $articulation_points - + 1/3 vertex: - [1] 2 - - -# biconnected_components_impl errors - - Code - biconnected_components_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# bridges_impl basic - - Code - bridges_impl(graph = g) - Output - + 2/2 edges: - [1] 2--3 1--2 - -# bridges_impl errors - - Code - bridges_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# is_biconnected_impl basic - - Code - is_biconnected_impl(graph = g) - Output - [1] FALSE - -# is_biconnected_impl errors - - Code - is_biconnected_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# count_reachable_impl basic - - Code - count_reachable_impl(graph = g, mode = "out") - Output - [1] 5 5 5 5 5 - ---- - - Code - count_reachable_impl(graph = g, mode = "in") - Output - [1] 5 5 5 5 5 - -# count_reachable_impl errors - - Code - count_reachable_impl(graph = NULL, mode = "out") - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# bond_percolation_impl basic - - Code - bond_percolation_impl(graph = g) - Output - $giant_size - numeric(0) - - $vetex_count - numeric(0) - - -# bond_percolation_impl errors - - Code - bond_percolation_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# site_percolation_impl basic - - Code - site_percolation_impl(graph = g) - Output - $giant_size - numeric(0) - - $edge_count - numeric(0) - - -# site_percolation_impl errors - - Code - site_percolation_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# edgelist_percolation_impl basic - - Code - edgelist_percolation_impl(edges = matrix(c(1, 2, 2, 3), ncol = 2)) - Output - $giant_size - [1] 2 3 - - $vertex_count - [1] 2 3 - - -# edgelist_percolation_impl errors - - Code - edgelist_percolation_impl(edges = "a") - Condition - Error in `edgelist_percolation_impl()`: - ! REAL() can only be applied to a 'numeric', not a 'character' - -# is_clique_impl basic - - Code - is_clique_impl(graph = g, candidate = 1:2) - Output - [1] TRUE - ---- - - Code - is_clique_impl(graph = g, candidate = 1:2, directed = TRUE) - Output - [1] TRUE - -# is_clique_impl errors - - Code - is_clique_impl(graph = NULL, candidate = 1:2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# cliques_impl basic - - Code - cliques_impl(graph = g) - Output - [[1]] - + 1/3 vertex: - [1] 2 - - [[2]] - + 1/3 vertex: - [1] 3 - - [[3]] - + 2/3 vertices: - [1] 2 3 - - [[4]] - + 1/3 vertex: - [1] 1 - - [[5]] - + 2/3 vertices: - [1] 1 2 - - ---- - - Code - cliques_impl(graph = g, min = 2, max = 2) - Output - [[1]] - + 2/3 vertices: - [1] 2 3 - - [[2]] - + 2/3 vertices: - [1] 1 2 - - -# cliques_impl errors - - Code - cliques_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# clique_size_hist_impl basic - - Code - clique_size_hist_impl(graph = g) - Output - [1] 3 2 - ---- - - Code - clique_size_hist_impl(graph = g, min_size = 2, max_size = 2) - Output - [1] 0 2 - -# clique_size_hist_impl errors - - Code - clique_size_hist_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# largest_cliques_impl basic - - Code - largest_cliques_impl(graph = g) - Output - [[1]] - + 2/3 vertices: - [1] 1 2 - - [[2]] - + 2/3 vertices: - [1] 2 3 - - -# largest_cliques_impl errors - - Code - largest_cliques_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# maximal_cliques_hist_impl basic - - Code - maximal_cliques_hist_impl(graph = g) - Output - [1] 0 2 - ---- - - Code - maximal_cliques_hist_impl(graph = g, min_size = 2, max_size = 2) - Output - [1] 0 2 - -# maximal_cliques_hist_impl errors - - Code - maximal_cliques_hist_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# clique_number_impl basic - - Code - clique_number_impl(graph = g) - Output - [1] 2 - -# clique_number_impl errors - - Code - clique_number_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# weighted_cliques_impl basic - - Code - weighted_cliques_impl(graph = g) - Output - [[1]] - + 1/3 vertex: - [1] 2 - - [[2]] - + 1/3 vertex: - [1] 3 - - [[3]] - + 2/3 vertices: - [1] 2 3 - - [[4]] - + 1/3 vertex: - [1] 1 - - [[5]] - + 2/3 vertices: - [1] 1 2 - - ---- - - Code - weighted_cliques_impl(graph = g, vertex_weights = c(1, 2, 3), min_weight = 1, - max_weight = 3, maximal = TRUE) - Output - [[1]] - + 2/3 vertices: - [1] 1 2 - - -# weighted_cliques_impl errors - - Code - weighted_cliques_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# largest_weighted_cliques_impl basic - - Code - largest_weighted_cliques_impl(graph = g) - Output - [[1]] - + 2/3 vertices: - [1] 1 2 - - [[2]] - + 2/3 vertices: - [1] 2 3 - - ---- - - Code - largest_weighted_cliques_impl(graph = g, vertex_weights = c(1, 2, 3)) - Output - [[1]] - + 2/3 vertices: - [1] 2 3 - - -# largest_weighted_cliques_impl errors - - Code - largest_weighted_cliques_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# weighted_clique_number_impl basic - - Code - weighted_clique_number_impl(graph = g) - Output - [1] 2 - ---- - - Code - weighted_clique_number_impl(graph = g, vertex_weights = c(1, 2, 3)) - Output - [1] 5 - -# weighted_clique_number_impl errors - - Code - weighted_clique_number_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# is_independent_vertex_set_impl basic - - Code - is_independent_vertex_set_impl(graph = g, candidate = 1:2) - Output - [1] FALSE - -# is_independent_vertex_set_impl errors - - Code - is_independent_vertex_set_impl(graph = NULL, candidate = 1:2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# layout_random_impl basic - - Code - layout_random_impl(graph = g) - Output - [,1] [,2] - [1,] 0.91714717 0.7003783 - [2,] -0.84358557 0.6509057 - [3,] -0.08120892 -0.8259847 - -# layout_random_impl errors - - Code - layout_random_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# layout_circle_impl basic - - Code - layout_circle_impl(graph = g) - Output - [,1] [,2] - [1,] 1.0 0.0000000 - [2,] -0.5 0.8660254 - [3,] -0.5 -0.8660254 - ---- - - Code - layout_circle_impl(graph = g, order = 1:3) - Output - [,1] [,2] - [1,] 1.0 0.0000000 - [2,] -0.5 0.8660254 - [3,] -0.5 -0.8660254 - -# layout_circle_impl errors - - Code - layout_circle_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# layout_star_impl basic - - Code - round(layout_star_impl(graph = g), 4) - Output - [,1] [,2] - [1,] 0 0 - [2,] 1 0 - [3,] -1 0 - ---- - - Code - round(layout_star_impl(graph = g, center = 1, order = 3:1), 4) - Output - [,1] [,2] - [1,] 0 0 - [2,] -1 0 - [3,] 1 0 - -# layout_star_impl errors - - Code - layout_star_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# layout_grid_impl basic - - Code - layout_grid_impl(graph = g) - Output - [,1] [,2] - [1,] 0 0 - [2,] 1 0 - [3,] 0 1 - ---- - - Code - layout_grid_impl(graph = g, width = 2) - Output - [,1] [,2] - [1,] 0 0 - [2,] 1 0 - [3,] 0 1 - -# layout_grid_impl errors - - Code - layout_grid_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# layout_grid_3d_impl basic - - Code - layout_grid_3d_impl(graph = g) - Output - [,1] [,2] [,3] - [1,] 0 0 0 - [2,] 1 0 0 - [3,] 0 1 0 - ---- - - Code - layout_grid_3d_impl(graph = g, width = 2, height = 2) - Output - [,1] [,2] [,3] - [1,] 0 0 0 - [2,] 1 0 0 - [3,] 0 1 0 - -# layout_grid_3d_impl errors - - Code - layout_grid_3d_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# roots_for_tree_layout_impl basic - - Code - roots_for_tree_layout_impl(graph = g, mode = "out", heuristic = 1) - Output - + 1/3 vertex: - [1] 2 - -# roots_for_tree_layout_impl errors - - Code - roots_for_tree_layout_impl(graph = NULL, mode = "out", heuristic = 1) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# layout_random_3d_impl basic - - Code - layout_random_3d_impl(graph = g) - Output - [,1] [,2] [,3] - [1,] 0.91714717 0.7003783 0.7338074 - [2,] -0.84358557 0.6509057 0.4644714 - [3,] -0.08120892 -0.8259847 0.5240391 - -# layout_random_3d_impl errors - - Code - layout_random_3d_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# layout_sphere_impl basic - - Code - layout_sphere_impl(graph = g) - Output - [,1] [,2] [,3] - [1,] 0.0000000 0.0000000 -1 - [2,] -0.4861377 0.8738822 0 - [3,] 0.0000000 0.0000000 1 - ---- - - Code - layout_sphere_impl(graph = g) - Output - [,1] [,2] [,3] - [1,] 0.0000000 0.0000000 -1.0 - [2,] -0.2461774 0.8302992 -0.5 - [3,] -0.9468790 -0.3215901 0.0 - [4,] 0.5001161 -0.7070246 0.5 - [5,] 0.0000000 0.0000000 1.0 - -# layout_sphere_impl errors - - Code - layout_sphere_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# layout_sugiyama_impl basic - - Code - layout_sugiyama_impl(graph = g) - Output - $res - [,1] [,2] - [1,] 0.0 1 - [2,] 0.5 0 - [3,] 1.0 1 - - $extd_graph - IGRAPH U--- 3 2 -- - + edges: - [1] 1--2 2--3 - - $extd_to_orig_eids - [1] 1 2 - - ---- - - Code - layout_sugiyama_impl(graph = g, layers = 1:3, hgap = 2, vgap = 2, maxiter = 10, - weights = c(1, 2)) - Output - $res - [,1] [,2] - [1,] 0 0 - [2,] 0 2 - [3,] 0 4 - - $extd_graph - IGRAPH U--- 3 2 -- - + edges: - [1] 1--2 2--3 - - $extd_to_orig_eids - [1] 1 2 - - -# layout_sugiyama_impl errors - - Code - layout_sugiyama_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# layout_mds_impl basic - - Code - layout_mds_impl(graph = g) - Output - [,1] [,2] - [1,] 1 2.807594e-08 - [2,] 0 0.000000e+00 - [3,] -1 2.807594e-08 - ---- - - Code - layout_mds_impl(graph = g, dist = matrix(1:9, nrow = 3), dim = 3) - Output - [,1] [,2] [,3] - [1,] -2.907521 2.32638426 1.444979 - [2,] -3.900013 -1.63291106 2.258035 - [3,] 3.975674 0.09951448 3.271816 - -# layout_mds_impl errors - - Code - layout_mds_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# layout_bipartite_impl basic - - Code - layout_bipartite_impl(graph = g, types = c(TRUE, FALSE, TRUE)) - Output - [,1] [,2] - [1,] 0.0 0 - [2,] 0.5 1 - [3,] 1.0 0 - ---- - - Code - layout_bipartite_impl(graph = g, types = c(TRUE, FALSE, TRUE), hgap = 2, vgap = 2, - maxiter = 10) - Output - [,1] [,2] - [1,] 0 0 - [2,] 1 2 - [3,] 2 0 - -# layout_bipartite_impl errors - - Code - layout_bipartite_impl(graph = NULL, types = c(TRUE, FALSE, TRUE)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# layout_gem_impl basic - - Code - layout_gem_impl(graph = g, res = matrix(0, nrow = 3, ncol = 2)) - Output - [,1] [,2] - [1,] 262.48135 -232.3960 - [2,] -15.77371 195.0729 - [3,] 182.43029 -223.2375 - ---- - - Code - layout_gem_impl(graph = g, res = matrix(0, nrow = 3, ncol = 2), use_seed = TRUE, - maxiter = 10, temp_max = 2, temp_min = 0.1, temp_init = 1) - Output - [,1] [,2] - [1,] -3.512540 -3.4930988 - [2,] 1.774751 0.1310939 - [3,] -1.004480 2.5739849 - -# layout_gem_impl errors - - Code - layout_gem_impl(graph = NULL, res = matrix(0, nrow = 3, ncol = 2)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# layout_davidson_harel_impl basic - - Code - layout_davidson_harel_impl(graph = g, res = matrix(0, nrow = 3, ncol = 2)) - Output - [,1] [,2] - [1,] 1.152116 0.9424808 - [2,] 2.474361 2.5195497 - [3,] 3.849187 4.0402661 - ---- - - Code - layout_davidson_harel_impl(graph = g, res = matrix(0, nrow = 3, ncol = 2), - use_seed = TRUE, maxiter = 10, fineiter = 5, cool_fact = 0.5, weight_node_dist = 2, - weight_border = 1, weight_edge_lengths = 0.1, weight_edge_crossings = 0.2, - weight_node_edge_dist = 0.3) - Output - [,1] [,2] - [1,] -6.609493 -2.155221 - [2,] -8.660255 -3.797365 - [3,] -6.485087 -5.224752 - -# layout_davidson_harel_impl errors - - Code - layout_davidson_harel_impl(graph = NULL, res = matrix(0, nrow = 3, ncol = 2)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# layout_umap_impl basic - - Code - layout_umap_impl(graph = g, res = matrix(0, nrow = 3, ncol = 2), use_seed = TRUE) - Output - [,1] [,2] - [1,] 0 0 - [2,] 0 0 - [3,] 0 0 - ---- - - Code - layout_umap_impl(graph = g, res = matrix(0, nrow = 3, ncol = 2), use_seed = TRUE, - distances = 1:3, min_dist = 0.1, epochs = 10, distances_are_weights = TRUE) - Output - [,1] [,2] - [1,] 0 0 - [2,] 0 0 - [3,] 0 0 - -# layout_umap_impl errors - - Code - layout_umap_impl(graph = NULL, res = matrix(0, nrow = 3, ncol = 2)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# layout_umap_3d_impl basic - - Code - layout_umap_3d_impl(graph = g, res = matrix(0, nrow = 3, ncol = 3), use_seed = TRUE) - Output - [,1] [,2] [,3] - [1,] 0 0 0 - [2,] 0 0 0 - [3,] 0 0 0 - ---- - - Code - layout_umap_3d_impl(graph = g, res = matrix(0, nrow = 3, ncol = 3), use_seed = TRUE, - distances = 1:3, min_dist = 0.1, epochs = 10, distances_are_weights = TRUE) - Output - [,1] [,2] [,3] - [1,] 0 0 0 - [2,] 0 0 0 - [3,] 0 0 0 - -# layout_umap_3d_impl errors - - Code - layout_umap_3d_impl(graph = NULL, res = matrix(0, nrow = 3, ncol = 3)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# layout_umap_compute_weights_impl basic - - Code - layout_umap_compute_weights_impl(graph = g, distances = 1:2, weights = 1:3) - Output - [1] 1 1 - -# layout_umap_compute_weights_impl errors - - Code - layout_umap_compute_weights_impl(graph = NULL, distances = 1:3, weights = 1:3) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# layout_align_impl basic - - Code - layout_align_impl(graph = g, layout = matrix(0, nrow = 3, ncol = 2)) - Output - [,1] [,2] - [1,] 0 0 - [2,] 0 0 - [3,] 0 0 - -# layout_align_impl errors - - Code - layout_align_impl(graph = NULL, layout = matrix(0, nrow = 3, ncol = 2)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# similarity_dice_impl basic - - Code - similarity_dice_impl(graph = g) - Output - [,1] [,2] [,3] - [1,] 1 0 1 - [2,] 0 1 0 - [3,] 1 0 1 - ---- - - Code - similarity_dice_impl(graph = g, vids = 1:2, mode = "in", loops = TRUE) - Output - [,1] [,2] - [1,] 1.0 0.8 - [2,] 0.8 1.0 - -# similarity_dice_impl errors - - Code - similarity_dice_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# similarity_dice_es_impl basic - - Code - similarity_dice_es_impl(graph = g) - Output - [1] 0 0 - ---- - - Code - similarity_dice_es_impl(graph = g, es = 1:2, mode = "in", loops = TRUE) - Output - [1] 0.8 0.8 - -# similarity_dice_es_impl errors - - Code - similarity_dice_es_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# similarity_dice_pairs_impl basic - - Code - similarity_dice_pairs_impl(graph = g, pairs = matrix(c(1, 2, 2, 3), ncol = 2)) - Output - [1] 0 0 - ---- - - Code - similarity_dice_pairs_impl(graph = g, pairs = matrix(c(1, 2, 2, 3), ncol = 2), - mode = "in", loops = TRUE) - Output - [1] 0.6666667 0.8000000 - -# similarity_dice_pairs_impl errors - - Code - similarity_dice_pairs_impl(graph = NULL, pairs = matrix(c(1, 2, 2, 3), ncol = 2)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# similarity_inverse_log_weighted_impl basic - - Code - similarity_inverse_log_weighted_impl(graph = g) - Output - [,1] [,2] [,3] - [1,] 0.000000 0 1.442695 - [2,] 0.000000 0 0.000000 - [3,] 1.442695 0 0.000000 - ---- - - Code - similarity_inverse_log_weighted_impl(graph = g, vids = 1:2, mode = "in") - Output - [,1] [,2] [,3] - [1,] 0 0 1.442695 - [2,] 0 0 0.000000 - -# similarity_inverse_log_weighted_impl errors - - Code - similarity_inverse_log_weighted_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# similarity_jaccard_impl basic - - Code - similarity_jaccard_impl(graph = g) - Output - [,1] [,2] [,3] - [1,] 1 0 1 - [2,] 0 1 0 - [3,] 1 0 1 - ---- - - Code - similarity_jaccard_impl(graph = g, vids = 1:2, mode = "in", loops = TRUE) - Output - [,1] [,2] - [1,] 1.0000000 0.6666667 - [2,] 0.6666667 1.0000000 - -# similarity_jaccard_impl errors - - Code - similarity_jaccard_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# similarity_jaccard_es_impl basic - - Code - similarity_jaccard_es_impl(graph = g) - Output - [1] 0 0 - ---- - - Code - similarity_jaccard_es_impl(graph = g, es = 1:2, mode = "in", loops = TRUE) - Output - [1] 0.6666667 0.6666667 - -# similarity_jaccard_es_impl errors - - Code - similarity_jaccard_es_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# similarity_jaccard_pairs_impl basic - - Code - similarity_jaccard_pairs_impl(graph = g, pairs = matrix(c(1, 2, 2, 3), ncol = 2)) - Output - [1] 0 0 - ---- - - Code - similarity_jaccard_pairs_impl(graph = g, pairs = matrix(c(1, 2, 2, 3), ncol = 2), - mode = "in", loops = TRUE) - Output - [1] 0.5000000 0.6666667 - -# similarity_jaccard_pairs_impl errors - - Code - similarity_jaccard_pairs_impl(graph = NULL, pairs = matrix(c(1, 2, 2, 3), ncol = 2)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# compare_communities_impl basic - - Code - compare_communities_impl(comm1 = c(1, 2, 1), comm2 = c(2, 1, 2)) - Output - [1] 0 - ---- - - Code - compare_communities_impl(comm1 = c(1, 2, 1), comm2 = c(2, 1, 2), method = "nmi") - Output - [1] 1 - ---- - - Code - compare_communities_impl(comm1 = comm1, comm2 = comm2, method = "vi") - Output - [1] 0.5493061 - -# compare_communities_impl errors - - Code - compare_communities_impl(comm1 = "a", comm2 = c(2, 1, 2)) - Condition - Warning in `compare_communities_impl()`: - NAs introduced by coercion - Error in `compare_communities_impl()`: - ! At rinterface_extra.c:xx : The value nan is not representable as an integer. Invalid value - -# modularity_impl basic - - Code - modularity_impl(graph = g, membership = c(1, 2, 1)) - Output - [1] -0.5 - ---- - - Code - modularity_impl(graph = g, membership = c(1, 2, 1), weights = c(1, 2), - resolution = 0.5, directed = FALSE) - Output - [1] -0.25 - -# modularity_impl errors - - Code - modularity_impl(graph = NULL, membership = c(1, 2, 1)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# modularity_matrix_impl basic - - Code - modularity_matrix_impl(graph = g) - Output - [,1] [,2] [,3] - [1,] -0.25 0.5 -0.25 - [2,] 0.50 -1.0 0.50 - [3,] -0.25 0.5 -0.25 - ---- - - Code - modularity_matrix_impl(graph = g, weights = c(1, 2), resolution = 0.5, - directed = FALSE) - Output - [,1] [,2] [,3] - [1,] -0.08333333 0.75 -0.1666667 - [2,] 0.75000000 -0.75 1.5000000 - [3,] -0.16666667 1.50 -0.3333333 - -# modularity_matrix_impl errors - - Code - modularity_matrix_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# community_fluid_communities_impl basic - - Code - community_fluid_communities_impl(graph = g, no_of_communities = 2) - Output - [1] 1 0 0 - -# community_fluid_communities_impl errors - - Code - community_fluid_communities_impl(graph = NULL, no_of_communities = 2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# community_label_propagation_impl basic - - Code - community_label_propagation_impl(graph = g) - Output - [1] 0 0 0 - ---- - - Code - community_label_propagation_impl(graph = g, mode = "in", weights = c(1, 2), - initial = 1:3, fixed = c(TRUE, FALSE, TRUE)) - Output - [1] 0 1 1 - -# community_label_propagation_impl errors - - Code - community_label_propagation_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# community_multilevel_impl basic - - Code - community_multilevel_impl(graph = g) - Output - $membership - [1] 0 0 0 - - $memberships - [,1] [,2] [,3] - [1,] 0 0 0 - - $modularity - [1] 0 - - ---- - - Code - community_multilevel_impl(graph = g, weights = c(1, 2), resolution = 0.5) - Output - $membership - [1] 0 0 0 - - $memberships - [,1] [,2] [,3] - [1,] 0 0 0 - - $modularity - [1] 0.5 - - -# community_multilevel_impl errors - - Code - community_multilevel_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# community_optimal_modularity_impl basic - - Code - community_optimal_modularity_impl(graph = g) - Output - $modularity - [1] 0 - - $membership - [1] 0 0 0 - - ---- - - Code - community_optimal_modularity_impl(graph = g, weights = c(1, 2)) - Output - $modularity - [1] 1.850372e-17 - - $membership - [1] 0 0 0 - - -# community_optimal_modularity_impl errors - - Code - community_optimal_modularity_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# community_leiden_impl basic - - Code - community_leiden_impl(graph = g, weights = c(1, 2), vertex_weights = c(1, 2, 3), - resolution = 0.5, beta = 0.1, start = TRUE, n_iterations = 1, membership = 1:3) - Output - $membership - [1] 0 1 2 - - $nb_clusters - [1] 3 - - $quality - [1] -1.166667 - - -# community_leiden_impl errors - - Code - community_leiden_impl(graph = NULL, resolution = 1) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# split_join_distance_impl basic - - Code - split_join_distance_impl(comm1 = c(1, 2, 1), comm2 = c(2, 1, 2)) - Output - $distance12 - [1] 0 - - $distance21 - [1] 0 - - -# split_join_distance_impl errors - - Code - split_join_distance_impl(comm1 = "a", comm2 = c(2, 1, 2)) - Condition - Warning in `split_join_distance_impl()`: - NAs introduced by coercion - Error in `split_join_distance_impl()`: - ! At rinterface_extra.c:xx : The value nan is not representable as an integer. Invalid value - -# community_infomap_impl basic - - Code - community_infomap_impl(graph = g) - Output - $membership - [1] 0 0 0 - - $codelength - [1] 1.512987 - - ---- - - Code - community_infomap_impl(graph = g, e_weights = c(1, 2), v_weights = c(1, 2, 3), - nb_trials = 2) - Output - $membership - [1] 0 0 0 - - $codelength - [1] 1.462254 - - -# community_infomap_impl errors - - Code - community_infomap_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# graphlets_impl basic - - Code - graphlets_impl(graph = g) - Output - $cliques - $cliques[[1]] - + 2/3 vertices: - [1] 2 3 - - $cliques[[2]] - + 2/3 vertices: - [1] 1 2 - - - $Mu - [1] 0.6665667 0.3332333 - - ---- - - Code - graphlets_impl(graph = g, weights = c(3, 4), niter = 10) - Output - $cliques - $cliques[[1]] - + 2/3 vertices: - [1] 2 3 - - $cliques[[2]] - + 2/3 vertices: - [1] 1 2 - - - $Mu - [1] 1.333233 0.999900 - - -# graphlets_impl errors - - Code - graphlets_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# hrg_fit_impl basic - - Code - hrg_fit_impl(graph = g1) - Output - $left - [1] -2 0 - - $right - [1] 1 2 - - $prob - [1] 1 0 - - $edges - [1] 2 0 - - $vertices - [1] 3 2 - - -# hrg_fit_impl errors - - Code - hrg_fit_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# hrg_sample_impl basic - - Code - hrg_sample_impl(hrg = hrg_model) - Output - IGRAPH U--- 10 45 -- - + edges: - [1] 1-- 2 1-- 3 1-- 4 1-- 5 1-- 6 1-- 7 1-- 8 1-- 9 1--10 2-- 3 2-- 4 2-- 5 - [13] 2-- 6 2-- 7 2-- 8 2-- 9 2--10 3-- 4 3-- 5 3-- 6 3-- 7 3-- 8 3-- 9 3--10 - [25] 4-- 5 4-- 6 4-- 7 4-- 8 4-- 9 4--10 5-- 6 5-- 7 5-- 8 5-- 9 5--10 6-- 7 - [37] 6-- 8 6-- 9 6--10 7-- 8 7-- 9 7--10 8-- 9 8--10 9--10 - -# hrg_sample_impl errors - - Code - hrg_sample_impl(hrg = NULL) - Condition - Error in `hrg_sample_impl()`: - ! At vendor/cigraph/src/hrg/hrg_types.cc:xx : Assertion failed: n >= 0. This is an unexpected igraph error; please report this as a bug, along with the steps to reproduce it. - Please restart your R session to avoid crashes or other surprising behavior. - -# hrg_sample_many_impl basic - - Code - hrg_sample_many_impl(hrg = hrg_model, num_samples = 2) - Output - [[1]] - IGRAPH U--- 10 45 -- - + edges: - [1] 1-- 2 1-- 3 1-- 4 1-- 5 1-- 6 1-- 7 1-- 8 1-- 9 1--10 2-- 3 2-- 4 2-- 5 - [13] 2-- 6 2-- 7 2-- 8 2-- 9 2--10 3-- 4 3-- 5 3-- 6 3-- 7 3-- 8 3-- 9 3--10 - [25] 4-- 5 4-- 6 4-- 7 4-- 8 4-- 9 4--10 5-- 6 5-- 7 5-- 8 5-- 9 5--10 6-- 7 - [37] 6-- 8 6-- 9 6--10 7-- 8 7-- 9 7--10 8-- 9 8--10 9--10 - - [[2]] - IGRAPH U--- 10 45 -- - + edges: - [1] 1-- 2 1-- 3 1-- 4 1-- 5 1-- 6 1-- 7 1-- 8 1-- 9 1--10 2-- 3 2-- 4 2-- 5 - [13] 2-- 6 2-- 7 2-- 8 2-- 9 2--10 3-- 4 3-- 5 3-- 6 3-- 7 3-- 8 3-- 9 3--10 - [25] 4-- 5 4-- 6 4-- 7 4-- 8 4-- 9 4--10 5-- 6 5-- 7 5-- 8 5-- 9 5--10 6-- 7 - [37] 6-- 8 6-- 9 6--10 7-- 8 7-- 9 7--10 8-- 9 8--10 9--10 - - -# hrg_sample_many_impl errors - - Code - hrg_sample_many_impl(hrg = NULL, num_samples = 2) - Condition - Error in `hrg_sample_many_impl()`: - ! At vendor/cigraph/src/hrg/hrg_types.cc:xx : Assertion failed: n >= 0. This is an unexpected igraph error; please report this as a bug, along with the steps to reproduce it. - Please restart your R session to avoid crashes or other surprising behavior. - -# hrg_game_impl basic - - Code - hrg_game_impl(hrg = hrg_model) - Output - IGRAPH U--- 10 45 -- Hierarchical random graph model - + attr: name (g/c) - + edges: - [1] 1-- 2 1-- 3 1-- 4 1-- 5 1-- 6 1-- 7 1-- 8 1-- 9 1--10 2-- 3 2-- 4 2-- 5 - [13] 2-- 6 2-- 7 2-- 8 2-- 9 2--10 3-- 4 3-- 5 3-- 6 3-- 7 3-- 8 3-- 9 3--10 - [25] 4-- 5 4-- 6 4-- 7 4-- 8 4-- 9 4--10 5-- 6 5-- 7 5-- 8 5-- 9 5--10 6-- 7 - [37] 6-- 8 6-- 9 6--10 7-- 8 7-- 9 7--10 8-- 9 8--10 9--10 - -# hrg_game_impl errors - - Code - hrg_game_impl(hrg = NULL) - Condition - Error in `hrg_game_impl()`: - ! At vendor/cigraph/src/hrg/hrg_types.cc:xx : Assertion failed: n >= 0. This is an unexpected igraph error; please report this as a bug, along with the steps to reproduce it. - Please restart your R session to avoid crashes or other surprising behavior. - -# hrg_consensus_impl errors - - Code - hrg_consensus_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# hrg_predict_impl errors - - Code - hrg_predict_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# hrg_create_impl basic - - Code - hrg_create_impl(graph = g, prob = rep(0.5, 2)) - Output - Hierarchical random graph, at level 3: - g1 p=0.5 1 - '- g2 p=0.5 2 3 - -# hrg_create_impl errors - - Code - hrg_create_impl(graph = g, prob = 0.5) - Condition - Error in `hrg_create_impl()`: - ! At vendor/cigraph/src/hrg/hrg.cc:xx : HRG probability vector size (1) should be equal to the number of internal nodes (2). Invalid value - -# hrg_resize_impl basic - - Code - hrg_resize_impl(hrg = hrg_model, newsize = 5) - Output - $left - [1] 0 -9 -6 -2 - - $right - [1] -4 4 7 -8 - - $prob - [1] 1 1 1 1 - - $edges - [1] 9 6 3 14 - - $vertices - [1] 10 7 4 9 - - -# hrg_resize_impl errors - - Code - hrg_resize_impl(hrg = -1, newsize = 2) - Condition - Error in `hrg_resize_impl()`: - ! At rinterface_extra.c:xx : The value nan is not representable as an integer. Invalid value - -# hrg_size_impl basic - - Code - hrg_size_impl(hrg = hrg_model) - Output - [1] 10 - -# hrg_size_impl errors - - Code - hrg_size_impl(hrg = -1) - Condition - Error in `hrg_size_impl()`: - ! At rinterface_extra.c:xx : The value nan is not representable as an integer. Invalid value - -# from_hrg_dendrogram_impl basic - - Code - from_hrg_dendrogram_impl(hrg = hrg_model) - Output - $graph - IGRAPH D--- 19 18 -- - + edges: - [1] 11-> 1 11->14 12->19 12-> 5 13->16 13-> 8 14->12 14->18 15-> 3 15-> 6 - [11] 16->15 16->10 17->13 17-> 4 18-> 7 18-> 9 19-> 2 19->17 - - $prob - [1] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 1 1 1 1 1 1 1 1 1 - - -# from_hrg_dendrogram_impl errors - - Code - from_hrg_dendrogram_impl(hrg = -1) - Condition - Error in `from_hrg_dendrogram_impl()`: - ! At rinterface_extra.c:xx : The value nan is not representable as an integer. Invalid value - -# get_adjacency_sparse_impl basic - - Code - get_adjacency_sparse_impl(graph = g) - Output - $type - [1] "triplet" - - $dim - [1] 3 3 - - $p - [1] 0 1 1 2 - - $i - [1] 1 0 2 1 - - $x - [1] 1 1 1 1 - - attr(,"class") - [1] "igraph.tmp.sparse" - ---- - - Code - get_adjacency_sparse_impl(graph = g, type = "upper", weights = c(1, 2), loops = "none") - Output - $type - [1] "triplet" - - $dim - [1] 3 3 - - $p - [1] 1 2 - - $i - [1] 0 1 - - $x - [1] 1 2 - - attr(,"class") - [1] "igraph.tmp.sparse" - -# get_adjacency_sparse_impl errors - - Code - get_adjacency_sparse_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# get_stochastic_impl basic - - Code - get_stochastic_impl(graph = g) - Output - [,1] [,2] [,3] - [1,] 0.0 1 0.0 - [2,] 0.5 0 0.5 - [3,] 0.0 1 0.0 - ---- - - Code - get_stochastic_impl(graph = g, column_wise = TRUE, weights = c(1, 2)) - Output - [,1] [,2] [,3] - [1,] 0 0.3333333 0 - [2,] 1 0.0000000 1 - [3,] 0 0.6666667 0 - -# get_stochastic_impl errors - - Code - get_stochastic_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# get_stochastic_sparse_impl basic - - Code - get_stochastic_sparse_impl(graph = g) - Output - $type - [1] "triplet" - - $dim - [1] 3 3 - - $p - [1] 0 1 1 2 - - $i - [1] 1 0 2 1 - - $x - [1] 0.5 1.0 1.0 0.5 - - attr(,"class") - [1] "igraph.tmp.sparse" - ---- - - Code - get_stochastic_sparse_impl(graph = g, column_wise = TRUE, weights = c(1, 2)) - Output - $type - [1] "triplet" - - $dim - [1] 3 3 - - $p - [1] 0 1 1 2 - - $i - [1] 1 0 2 1 - - $x - [1] 1.0000000 0.3333333 0.6666667 1.0000000 - - attr(,"class") - [1] "igraph.tmp.sparse" - -# get_stochastic_sparse_impl errors - - Code - get_stochastic_sparse_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# to_directed_impl basic - - Code - to_directed_impl(graph = g) - Output - IGRAPH D--- 3 4 -- - + edges: - [1] 1->2 2->3 2->1 3->2 - ---- - - Code - to_directed_impl(graph = g, mode = "acyclic") - Output - IGRAPH D--- 3 2 -- - + edges: - [1] 1->2 2->3 - -# to_directed_impl errors - - Code - to_directed_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# to_undirected_impl basic - - Code - to_undirected_impl(graph = g) - Output - IGRAPH U--- 3 2 -- - + edges: - [1] 1--2 2--3 - ---- - - Code - to_undirected_impl(graph = g, mode = "mutual", edge_attr_comb = "sum") - Output - IGRAPH U--- 3 2 -- - + edges: - [1] 1--2 2--3 - -# to_undirected_impl errors - - Code - to_undirected_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# motifs_randesu_impl basic - - Code - motifs_randesu_impl(graph = g) - Output - [1] NaN NaN 1 0 - ---- - - Code - motifs_randesu_impl(graph = g, size = 4, cut_prob = rep(0.1, 4)) - Output - [1] NaN NaN NaN NaN 0 NaN 0 0 0 0 0 - -# motifs_randesu_impl errors - - Code - motifs_randesu_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# motifs_randesu_estimate_impl basic - - Code - motifs_randesu_estimate_impl(graph = g, size = 3, sample_size = 2) - Output - [1] 3 - ---- - - Code - motifs_randesu_estimate_impl(graph = g, size = 4, cut_prob = rep(0.1, 4), - sample_size = 2, sample = 1:2) - Output - [1] 3 - -# motifs_randesu_estimate_impl errors - - Code - motifs_randesu_estimate_impl(graph = NULL, size = 3, sample_size = 2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# motifs_randesu_no_impl basic - - Code - motifs_randesu_no_impl(graph = g) - Output - [1] 1 - ---- - - Code - motifs_randesu_no_impl(graph = g, size = 4, cut_prob = c(0.1, 0.1, 0.1, 0.1)) - Output - [1] 0 - -# motifs_randesu_no_impl errors - - Code - motifs_randesu_no_impl(graph = g, size = 3, cut_prob = c(0.1)) - Condition - Error in `motifs_randesu_no_impl()`: - ! At vendor/cigraph/src/misc/motifs.c:xx : Cut probability vector size (1) must agree with motif size (3). Invalid value - -# dyad_census_impl basic - - Code - dyad_census_impl(graph = g) - Output - $mut - [1] 2 - - $asym - [1] 0 - - $null - [1] 1 - - -# dyad_census_impl errors - - Code - dyad_census_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# triad_census_impl basic - - Code - triad_census_impl(graph = g) - Condition - Warning in `triad_census_impl()`: - At vendor/cigraph/src/misc/motifs.c:1157 : Triad census called on an undirected graph. All connections will be treated as mutual. - Output - [1] 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 - -# triad_census_impl errors - - Code - triad_census_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# count_adjacent_triangles_impl basic - - Code - count_adjacent_triangles_impl(graph = g) - Output - [1] 0 0 0 - ---- - - Code - count_adjacent_triangles_impl(graph = g, vids = 1:2) - Output - [1] 0 0 - -# count_adjacent_triangles_impl errors - - Code - count_adjacent_triangles_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# count_triangles_impl basic - - Code - count_triangles_impl(graph = g) - Output - [1] 0 - -# count_triangles_impl errors - - Code - count_triangles_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# local_scan_0_impl basic - - Code - local_scan_0_impl(graph = g) - Output - [1] 1 2 1 - ---- - - Code - local_scan_0_impl(graph = g, weights = c(1, 2), mode = "in") - Output - [1] 1 3 2 - -# local_scan_0_impl errors - - Code - local_scan_0_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# local_scan_0_them_impl basic - - Code - local_scan_0_them_impl(us = g1, them = g2) - Output - [1] 1 2 1 - ---- - - Code - local_scan_0_them_impl(us = g1, them = g2, weights_them = c(1, 2), mode = "in") - Output - [1] 1 3 2 - -# local_scan_0_them_impl errors - - Code - local_scan_0_them_impl(us = NULL, them = them) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# local_scan_1_ecount_impl basic - - Code - local_scan_1_ecount_impl(graph = g) - Output - [1] 1 2 1 - ---- - - Code - local_scan_1_ecount_impl(graph = g, weights = c(1, 2), mode = "in") - Output - [1] 1 3 2 - -# local_scan_1_ecount_impl errors - - Code - local_scan_1_ecount_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# local_scan_1_ecount_them_impl basic - - Code - local_scan_1_ecount_them_impl(us = g1, them = g2) - Output - [1] 1 2 1 - ---- - - Code - local_scan_1_ecount_them_impl(us = g1, them = g2, weights_them = c(1, 2), mode = "in") - Output - [1] 1 3 2 - -# local_scan_1_ecount_them_impl errors - - Code - local_scan_1_ecount_them_impl(us = NULL, them = them) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# local_scan_k_ecount_impl basic - - Code - local_scan_k_ecount_impl(graph = g, k = 1) - Output - [1] 1 2 1 - ---- - - Code - local_scan_k_ecount_impl(graph = g, k = 1, weights = c(1, 2), mode = "in") - Output - [1] 1 3 2 - -# local_scan_k_ecount_impl errors - - Code - local_scan_k_ecount_impl(graph = NULL, k = 1) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# local_scan_k_ecount_them_impl basic - - Code - local_scan_k_ecount_them_impl(us = g1, them = g2, k = 1) - Output - [1] 1 2 1 - ---- - - Code - local_scan_k_ecount_them_impl(us = g1, them = g2, k = 1, weights_them = c(1, 2), - mode = "in") - Output - [1] 1 3 2 - -# local_scan_k_ecount_them_impl errors - - Code - local_scan_k_ecount_them_impl(us = NULL, them = them, k = 1) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# local_scan_neighborhood_ecount_impl basic - - Code - local_scan_neighborhood_ecount_impl(graph = g, neighborhoods = list(1:2, 2:3, 2: - 4, 2)) - Output - [1] 1 1 2 0 - ---- - - Code - local_scan_neighborhood_ecount_impl(graph = g, weights = c(1, 2, 3), - neighborhoods = list(1:2, 1:3, 2:4, 1)) - Output - [1] 1 3 5 0 - -# local_scan_neighborhood_ecount_impl errors - - Code - local_scan_neighborhood_ecount_impl(graph = NULL, neighborhoods = list(1:2, 2:3)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# local_scan_subset_ecount_impl basic - - Code - local_scan_subset_ecount_impl(graph = g, subsets = list(c(1, 2), c(2, 3))) - Output - [1] 1 1 - ---- - - Code - local_scan_subset_ecount_impl(graph = g, weights = c(1, 2, 3), subsets = list(c( - 1, 2), c(2, 3))) - Output - [1] 1 2 - -# local_scan_subset_ecount_impl errors - - Code - local_scan_subset_ecount_impl(graph = g, subsets = list(1:2, letters[2:3])) - Condition - Error in `.x - 1`: - ! non-numeric argument to binary operator - -# list_triangles_impl basic - - Code - list_triangles_impl(graph = g) - Output - + 0/3 vertices: - -# list_triangles_impl errors - - Code - list_triangles_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# join_impl basic - - Code - join_impl(left = g1, right = g2) - Output - IGRAPH U--- 6 13 -- - + edges: - [1] 1--2 2--3 4--5 5--6 1--4 1--5 1--6 2--4 2--5 2--6 3--4 3--5 3--6 - -# join_impl errors - - Code - join_impl(left = NULL, right = right) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# induced_subgraph_map_impl basic - - Code - induced_subgraph_map_impl(graph = g, vids = 1:2, impl = "auto") - Output - $res - IGRAPH U--- 2 1 -- - + edge: - [1] 1--2 - - $map - [1] 2 3 1 - - $invmap - [1] 1 2 - - ---- - - Code - induced_subgraph_map_impl(graph = g, vids = 1:2, impl = "copy_and_delete") - Output - $res - IGRAPH U--- 2 1 -- - + edge: - [1] 1--2 - - $map - [1] 2 3 1 - - $invmap - [1] 1 2 - - -# induced_subgraph_map_impl errors - - Code - induced_subgraph_map_impl(graph = NULL, vids = 1:2, impl = "auto") - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# mycielskian_impl basic - - Code - mycielskian_impl(graph = g) - Output - IGRAPH U--- 7 9 -- - + edges: - [1] 1--2 2--3 1--5 2--4 2--6 3--5 4--7 5--7 6--7 - ---- - - Code - mycielskian_impl(graph = g, k = 2) - Output - IGRAPH U--- 15 34 -- - + edges: - [1] 1-- 2 2-- 3 1-- 5 2-- 4 2-- 6 3-- 5 4-- 7 5-- 7 6-- 7 1-- 9 - [11] 2-- 8 2--10 3-- 9 1--12 5-- 8 2--11 4-- 9 2--13 6-- 9 3--12 - [21] 5--10 4--14 7--11 5--14 7--12 6--14 7--13 8--15 9--15 10--15 - [31] 11--15 12--15 13--15 14--15 - -# mycielskian_impl errors - - Code - mycielskian_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# product_impl basic - - Code - product_impl(g1 = g1, g2 = g2) - Output - IGRAPH U--- 9 12 -- - + edges: - [1] 1--4 2--5 3--6 4--7 5--8 6--9 1--2 4--5 7--8 2--3 5--6 8--9 - ---- - - Code - product_impl(g1 = g1, g2 = g2, type = "tensor") - Output - IGRAPH U--- 9 8 -- - + edges: - [1] 1--5 2--4 2--6 3--5 4--8 5--7 5--9 6--8 - -# product_impl errors - - Code - product_impl(g1 = NULL, g2 = g2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# rooted_product_impl basic - - Code - rooted_product_impl(g1 = g1, g2 = g2, root = 1) - Output - IGRAPH U--- 9 8 -- - + edges: - [1] 1--4 4--7 1--2 4--5 7--8 2--3 5--6 8--9 - -# rooted_product_impl errors - - Code - rooted_product_impl(g1 = NULL, g2 = g2, root = 1) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# gomory_hu_tree_impl basic - - Code - gomory_hu_tree_impl(graph = g) - Output - $tree - IGRAPH U--- 3 2 -- - + edges: - [1] 1--2 2--3 - - $flows - [1] 1 1 - - ---- - - Code - gomory_hu_tree_impl(graph = g, capacity = c(1, 2)) - Output - $tree - IGRAPH U--- 3 2 -- - + edges: - [1] 1--2 2--3 - - $flows - [1] 1 2 - - -# gomory_hu_tree_impl errors - - Code - gomory_hu_tree_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# maxflow_impl basic - - Code - maxflow_impl(graph = g, source = 1, target = 3) - Output - $value - [1] 1 - - $flow - [1] 1 1 - - $cut - + 1/2 edge: - [1] 2--3 - - $partition1 - + 2/3 vertices: - [1] 1 2 - - $partition2 - + 1/3 vertex: - [1] 3 - - $stats - $stats$nopush - [1] 1 - - $stats$norelabel - [1] 0 - - $stats$nogap - [1] 0 - - $stats$nogapnodes - [1] 0 - - $stats$nobfs - [1] 1 - - - ---- - - Code - maxflow_impl(graph = g, source = 1, target = 3, capacity = c(1, 2)) - Output - $value - [1] 1 - - $flow - [1] 1 1 - - $cut - + 1/2 edge: - [1] 1--2 - - $partition1 - + 1/3 vertex: - [1] 1 - - $partition2 - + 2/3 vertices: - [1] 2 3 - - $stats - $stats$nopush - [1] 1 - - $stats$norelabel - [1] 0 - - $stats$nogap - [1] 0 - - $stats$nogapnodes - [1] 0 - - $stats$nobfs - [1] 1 - - - -# maxflow_impl errors - - Code - maxflow_impl(graph = NULL, source = 1, target = 3) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# residual_graph_impl basic - - Code - residual_graph_impl(graph = g, capacity = c(1, 2), flow = c(1, 2)) - Output - $residual - IGRAPH D--- 3 0 -- - + edges: - - $residual_capacity - numeric(0) - - -# residual_graph_impl errors - - Code - residual_graph_impl(graph = NULL, capacity = c(1, 2), flow = c(1, 2)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# reverse_residual_graph_impl basic - - Code - reverse_residual_graph_impl(graph = g, capacity = c(1, 2), flow = c(1, 2)) - Output - IGRAPH D--- 3 2 -- - + edges: - [1] 2->1 3->2 - -# reverse_residual_graph_impl errors - - Code - reverse_residual_graph_impl(graph = NULL, capacity = c(1, 2), flow = c(1, 2)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# st_mincut_impl basic - - Code - st_mincut_impl(graph = g, source = 1, target = 3) - Output - $value - [1] 1 - - $cut - + 1/2 edge: - [1] 2--3 - - $partition1 - + 2/3 vertices: - [1] 1 2 - - $partition2 - + 1/3 vertex: - [1] 3 - - ---- - - Code - st_mincut_impl(graph = g, source = 1, target = 3, capacity = c(1, 2)) - Output - $value - [1] 1 - - $cut - + 1/2 edge: - [1] 1--2 - - $partition1 - + 1/3 vertex: - [1] 1 - - $partition2 - + 2/3 vertices: - [1] 2 3 - - -# st_mincut_impl errors - - Code - st_mincut_impl(graph = NULL, source = 1, target = 3) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# dominator_tree_impl basic - - Code - dominator_tree_impl(graph = g, root = 1) - Output - $dom - [1] 0 1 2 - - $domtree - IGRAPH D--- 3 2 -- - + edges: - [1] 1->2 2->3 - - $leftout - + 0/3 vertices: - - ---- - - Code - dominator_tree_impl(graph = g, root = 1, mode = "in") - Output - $dom - [1] 0 -1 -1 - - $domtree - IGRAPH D--- 3 0 -- - + edges: - - $leftout - + 2/3 vertices: - [1] 2 3 - - -# dominator_tree_impl errors - - Code - dominator_tree_impl(graph = NULL, root = 1) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# all_st_cuts_impl basic - - Code - all_st_cuts_impl(graph = g, source = 1, target = 3) - Output - $cuts - $cuts[[1]] - + 1/2 edge: - [1] 1->2 - - $cuts[[2]] - + 1/2 edge: - [1] 2->3 - - - $partition1s - $partition1s[[1]] - + 1/3 vertex: - [1] 1 - - $partition1s[[2]] - + 2/3 vertices: - [1] 1 2 - - - -# all_st_cuts_impl errors - - Code - all_st_cuts_impl(graph = NULL, source = 1, target = 3) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# all_st_mincuts_impl basic - - Code - all_st_mincuts_impl(graph = g, source = 1, target = 3) - Output - $value - [1] 1 - - $cuts - $cuts[[1]] - + 1/2 edge: - [1] 1->2 - - $cuts[[2]] - + 1/2 edge: - [1] 2->3 - - - $partition1s - $partition1s[[1]] - + 1/3 vertex: - [1] 1 - - $partition1s[[2]] - + 2/3 vertices: - [1] 1 2 - - - ---- - - Code - all_st_mincuts_impl(graph = g, source = 1, target = 3, capacity = c(1, 2)) - Output - $value - [1] 1 - - $cuts - $cuts[[1]] - + 1/2 edge: - [1] 1->2 - - - $partition1s - $partition1s[[1]] - + 1/3 vertex: - [1] 1 - - - -# all_st_mincuts_impl errors - - Code - all_st_mincuts_impl(graph = NULL, source = 1, target = 3) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# even_tarjan_reduction_impl basic - - Code - even_tarjan_reduction_impl(graph = g) - Output - $graphbar - IGRAPH D--- 6 7 -- - + edges: - [1] 1->4 2->5 3->6 5->1 4->2 6->2 5->3 - - $capacity - [1] 1 1 1 3 3 3 3 - - -# even_tarjan_reduction_impl errors - - Code - even_tarjan_reduction_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# is_separator_impl basic - - Code - is_separator_impl(graph = g, candidate = 1:2) - Output - [1] FALSE - -# is_separator_impl errors - - Code - is_separator_impl(graph = NULL, candidate = 1:2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# is_minimal_separator_impl basic - - Code - is_minimal_separator_impl(graph = g, candidate = 1:2) - Output - [1] FALSE - -# is_minimal_separator_impl errors - - Code - is_minimal_separator_impl(graph = NULL, candidate = 1:2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# all_minimal_st_separators_impl basic - - Code - all_minimal_st_separators_impl(graph = g) - Output - [[1]] - + 1/3 vertex: - [1] 2 - - -# all_minimal_st_separators_impl errors - - Code - all_minimal_st_separators_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# minimum_size_separators_impl basic - - Code - minimum_size_separators_impl(graph = g) - Output - [[1]] - + 1/3 vertex: - [1] 2 - - -# minimum_size_separators_impl errors - - Code - minimum_size_separators_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# isoclass_impl basic - - Code - isoclass_impl(graph = g) - Output - [1] 2 - -# isoclass_impl errors - - Code - isoclass_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# isomorphic_impl basic - - Code - isomorphic_impl(graph1 = g1, graph2 = g2) - Output - [1] TRUE - -# isomorphic_impl errors - - Code - isomorphic_impl(graph1 = NULL, graph2 = graph2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# isoclass_subgraph_impl basic - - Code - isoclass_subgraph_impl(graph = g, vids = c(1, 2, 3)) - Output - [1] 2 - -# isoclass_subgraph_impl errors - - Code - isoclass_subgraph_impl(graph = NULL, vids = 1:2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# isoclass_create_impl basic - - Code - isoclass_create_impl(size = 3, number = 1) - Output - IGRAPH D--- 3 1 -- - + edge: - [1] 2->1 - ---- - - Code - isoclass_create_impl(size = 3, number = 1, directed = FALSE) - Output - IGRAPH U--- 3 1 -- - + edge: - [1] 1--2 - -# isoclass_create_impl errors - - Code - isoclass_create_impl(size = "a", number = 1) - Condition - Warning in `isoclass_create_impl()`: - NAs introduced by coercion - Error in `isoclass_create_impl()`: - ! At rinterface_extra.c:xx : The value nan is not representable as an integer. Invalid value - -# isomorphic_vf2_impl basic - - Code - isomorphic_vf2_impl(graph1 = g1, graph2 = g2) - Output - $iso - [1] TRUE - - $map12 - [1] 1 2 3 - - $map21 - [1] 1 2 3 - - ---- - - Code - isomorphic_vf2_impl(graph1 = g1, graph2 = g2, vertex_color1 = c(1, 2, 3), - vertex_color2 = c(1, 2, 3), edge_color1 = c(1, 2), edge_color2 = c(1, 2)) - Output - $iso - [1] TRUE - - $map12 - [1] 1 2 3 - - $map21 - [1] 1 2 3 - - -# isomorphic_vf2_impl errors - - Code - isomorphic_vf2_impl(graph1 = NULL, graph2 = graph2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# count_isomorphisms_vf2_impl basic - - Code - count_isomorphisms_vf2_impl(graph1 = g1, graph2 = g2) - Output - [1] 2 - ---- - - Code - count_isomorphisms_vf2_impl(graph1 = g1, graph2 = g2, vertex_color1 = c(1, 2, 3), - vertex_color2 = c(1, 2, 3), edge_color1 = c(1, 2), edge_color2 = c(1, 2)) - Output - [1] 1 - -# count_isomorphisms_vf2_impl errors - - Code - count_isomorphisms_vf2_impl(graph1 = NULL, graph2 = graph2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# get_isomorphisms_vf2_impl basic - - Code - get_isomorphisms_vf2_impl(graph1 = g1, graph2 = g2) - Output - [[1]] - [1] 0 1 2 - - [[2]] - [1] 2 1 0 - - ---- - - Code - get_isomorphisms_vf2_impl(graph1 = g1, graph2 = g2, vertex_color1 = c(1, 2, 3), - vertex_color2 = c(1, 2, 3), edge_color1 = c(1, 2), edge_color2 = c(1, 2)) - Output - [[1]] - [1] 0 1 2 - - -# get_isomorphisms_vf2_impl errors - - Code - get_isomorphisms_vf2_impl(graph1 = NULL, graph2 = graph2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# subisomorphic_impl basic - - Code - subisomorphic_impl(graph1 = g1, graph2 = g2) - Output - [1] TRUE - -# subisomorphic_impl errors - - Code - subisomorphic_impl(graph1 = NULL, graph2 = graph2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# subisomorphic_vf2_impl basic - - Code - subisomorphic_vf2_impl(graph1 = g1, graph2 = g2) - Output - $iso - [1] TRUE - - $map12 - [1] 1 2 3 - - $map21 - [1] 1 2 3 - - ---- - - Code - subisomorphic_vf2_impl(graph1 = g1, graph2 = g2, vertex_color1 = c(1, 2, 3), - vertex_color2 = c(1, 2, 3), edge_color1 = c(1, 2), edge_color2 = c(1, 2)) - Output - $iso - [1] TRUE - - $map12 - [1] 1 2 3 - - $map21 - [1] 1 2 3 - - -# subisomorphic_vf2_impl errors - - Code - subisomorphic_vf2_impl(graph1 = NULL, graph2 = graph2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# count_subisomorphisms_vf2_impl basic - - Code - count_subisomorphisms_vf2_impl(graph1 = g1, graph2 = g2) - Output - [1] 2 - ---- - - Code - count_subisomorphisms_vf2_impl(graph1 = g1, graph2 = g2, vertex_color1 = c(1, 2, - 3), vertex_color2 = c(1, 2, 3), edge_color1 = c(1, 2), edge_color2 = c(1, 2)) - Output - [1] 1 - -# count_subisomorphisms_vf2_impl errors - - Code - count_subisomorphisms_vf2_impl(graph1 = NULL, graph2 = graph2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# get_subisomorphisms_vf2_impl basic - - Code - get_subisomorphisms_vf2_impl(graph1 = g1, graph2 = g2) - Output - [[1]] - [1] 0 1 2 - - [[2]] - [1] 2 1 0 - - ---- - - Code - get_subisomorphisms_vf2_impl(graph1 = g1, graph2 = g2, vertex_color1 = c(1, 2, - 3), vertex_color2 = c(1, 2, 3), edge_color1 = c(1, 2), edge_color2 = c(1, 2)) - Output - [[1]] - [1] 0 1 2 - - -# get_subisomorphisms_vf2_impl errors - - Code - get_subisomorphisms_vf2_impl(graph1 = NULL, graph2 = graph2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# canonical_permutation_impl basic - - Code - canonical_permutation_impl(graph = g) - Output - $labeling - [1] 2 3 1 - - $info - $info$nof_nodes - [1] 3 - - $info$nof_leaf_nodes - [1] 3 - - $info$nof_bad_nodes - [1] 0 - - $info$nof_canupdates - [1] 1 - - $info$max_level - [1] 1 - - $info$group_size - [1] "2" - - - ---- - - Code - canonical_permutation_impl(graph = g, colors = c(1, 2, 3), sh = "fl") - Output - $labeling - [1] 1 2 3 - - $info - $info$nof_nodes - [1] 1 - - $info$nof_leaf_nodes - [1] 1 - - $info$nof_bad_nodes - [1] 0 - - $info$nof_canupdates - [1] 0 - - $info$max_level - [1] 0 - - $info$group_size - [1] "1" - - - -# canonical_permutation_impl errors - - Code - canonical_permutation_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# permute_vertices_impl basic - - Code - permute_vertices_impl(graph = g, permutation = 3:1) - Output - IGRAPH U--- 3 2 -- - + edges: - [1] 2--3 1--2 - -# permute_vertices_impl errors - - Code - permute_vertices_impl(graph = NULL, permutation = 3:1) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# isomorphic_bliss_impl basic - - Code - isomorphic_bliss_impl(graph1 = g1, graph2 = g2) - Output - $iso - [1] TRUE - - $map12 - [1] 1 2 3 - - $map21 - [1] 1 2 3 - - $info1 - $info1$nof_nodes - [1] 3 - - $info1$nof_leaf_nodes - [1] 3 - - $info1$nof_bad_nodes - [1] 0 - - $info1$nof_canupdates - [1] 1 - - $info1$max_level - [1] 1 - - $info1$group_size - [1] "2" - - - $info2 - $info2$nof_nodes - [1] 3 - - $info2$nof_leaf_nodes - [1] 3 - - $info2$nof_bad_nodes - [1] 0 - - $info2$nof_canupdates - [1] 1 - - $info2$max_level - [1] 1 - - $info2$group_size - [1] "2" - - - ---- - - Code - isomorphic_bliss_impl(graph1 = g1, graph2 = g2, colors1 = c(1, 2, 3), colors2 = c( - 1, 2, 3), sh = "fl") - Output - $iso - [1] TRUE - - $map12 - [1] 1 2 3 - - $map21 - [1] 1 2 3 - - $info1 - $info1$nof_nodes - [1] 1 - - $info1$nof_leaf_nodes - [1] 1 - - $info1$nof_bad_nodes - [1] 0 - - $info1$nof_canupdates - [1] 0 - - $info1$max_level - [1] 0 - - $info1$group_size - [1] "1" - - - $info2 - $info2$nof_nodes - [1] 1 - - $info2$nof_leaf_nodes - [1] 1 - - $info2$nof_bad_nodes - [1] 0 - - $info2$nof_canupdates - [1] 0 - - $info2$max_level - [1] 0 - - $info2$group_size - [1] "1" - - - -# isomorphic_bliss_impl errors - - Code - isomorphic_bliss_impl(graph1 = NULL, graph2 = graph2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# count_automorphisms_impl basic - - Code - count_automorphisms_impl(graph = g) - Output - $nof_nodes - [1] 3 - - $nof_leaf_nodes - [1] 3 - - $nof_bad_nodes - [1] 0 - - $nof_canupdates - [1] 1 - - $max_level - [1] 1 - - $group_size - [1] "2" - - ---- - - Code - count_automorphisms_impl(graph = g, colors = c(1, 2, 3), sh = "fl") - Output - $nof_nodes - [1] 1 - - $nof_leaf_nodes - [1] 1 - - $nof_bad_nodes - [1] 0 - - $nof_canupdates - [1] 0 - - $max_level - [1] 0 - - $group_size - [1] "1" - - -# count_automorphisms_impl errors - - Code - count_automorphisms_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# automorphism_group_impl basic - - Code - automorphism_group_impl(graph = g) - Output - [[1]] - + 3/3 vertices: - [1] 3 2 1 - - ---- - - Code - automorphism_group_impl(graph = g, colors = c(1, 2, 3), sh = "fl", details = TRUE) - Output - $generators - list() - - $info - $info$nof_nodes - [1] 1 - - $info$nof_leaf_nodes - [1] 1 - - $info$nof_bad_nodes - [1] 0 - - $info$nof_canupdates - [1] 0 - - $info$max_level - [1] 0 - - $info$group_size - [1] "1" - - - -# automorphism_group_impl errors - - Code - automorphism_group_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# simplify_and_colorize_impl basic - - Code - simplify_and_colorize_impl(graph = g) - Output - $res - IGRAPH U--- 3 2 -- - + edges: - [1] 1--2 2--3 - - $vertex_color - [1] 0 0 0 - - $edge_color - [1] 1 1 - - -# simplify_and_colorize_impl errors - - Code - simplify_and_colorize_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# graph_count_impl basic - - Code - graph_count_impl(n = 3) - Output - [1] 4 - ---- - - Code - graph_count_impl(n = 3, directed = TRUE) - Output - [1] 16 - -# graph_count_impl errors - - Code - graph_count_impl(n = "a") - Condition - Warning in `graph_count_impl()`: - NAs introduced by coercion - Error in `graph_count_impl()`: - ! At rinterface_extra.c:xx : The value nan is not representable as an integer. Invalid value - -# is_matching_impl basic - - Code - is_matching_impl(graph = g, matching = 1:2) - Output - [1] FALSE - ---- - - Code - is_matching_impl(graph = g, types = c(TRUE, FALSE, TRUE), matching = 1:2) - Output - [1] FALSE - -# is_matching_impl errors - - Code - is_matching_impl(graph = NULL, matching = 1:2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# is_maximal_matching_impl basic - - Code - is_maximal_matching_impl(graph = g, matching = 1:2) - Output - [1] FALSE - ---- - - Code - is_maximal_matching_impl(graph = g, types = c(TRUE, FALSE, TRUE), matching = 1: - 2) - Output - [1] FALSE - -# is_maximal_matching_impl errors - - Code - is_maximal_matching_impl(graph = NULL, matching = 1:2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# maximum_bipartite_matching_impl basic - - Code - maximum_bipartite_matching_impl(graph = g, types = c(TRUE, FALSE, TRUE)) - Output - $matching_size - [1] 1 - - $matching_weight - [1] 1 - - $matching - [1] 2 1 0 - - ---- - - Code - maximum_bipartite_matching_impl(graph = g, types = c(TRUE, FALSE, TRUE), - weights = c(1, 2), eps = 1e-05) - Output - $matching_size - [1] 1 - - $matching_weight - [1] 2 - - $matching - [1] 0 3 2 - - -# maximum_bipartite_matching_impl errors - - Code - maximum_bipartite_matching_impl(graph = NULL, types = c(TRUE, FALSE, TRUE)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# adjacency_spectral_embedding_impl basic - - Code - adjacency_spectral_embedding_impl(graph = g, no = 2) - Output - $X - [,1] [,2] - [1,] 0.6718598 -0.4487712 - [2,] 1.1328501 0.5323058 - [3,] 0.6718598 -0.4487712 - - $Y - [,1] [,2] - [1,] 0.6718598 -0.4487712 - [2,] 1.1328501 0.5323058 - [3,] 0.6718598 -0.4487712 - - $D - [1] 2.1861407 -0.6861407 - - $options - $options$bmat - [1] "I" - - $options$n - [1] 3 - - $options$which - [1] "LM" - - $options$nev - [1] 2 - - $options$tol - [1] 0 - - $options$ncv - [1] 3 - - $options$ldv - [1] 0 - - $options$ishift - [1] 1 - - $options$maxiter - [1] 3000 - - $options$nb - [1] 1 - - $options$mode - [1] 1 - - $options$start - [1] 1 - - $options$sigma - [1] 0 - - $options$sigmai - [1] 0 - - $options$info - [1] 0 - - $options$iter - [1] 1 - - $options$nconv - [1] 2 - - $options$numop - [1] 3 - - $options$numopb - [1] 0 - - $options$numreo - [1] 2 - - - ---- - - Code - adjacency_spectral_embedding_impl(graph = g, no = 2, weights = c(1, 2), which = "la", - scaled = FALSE, cvec = c(1, 2, 3), options = list(maxiter = 10)) - Output - $X - [,1] [,2] - [1,] 0.1720265 -0.7864357 - [2,] 0.6311790 -0.3743620 - [3,] 0.7563200 0.4912963 - - $Y - [,1] [,2] - [1,] 0.1720265 -0.7864357 - [2,] 0.6311790 -0.3743620 - [3,] 0.7563200 0.4912963 - - $D - [1] 4.669079 1.476024 - - $options - $options$bmat - [1] "I" - - $options$n - [1] 3 - - $options$which - [1] "LA" - - $options$nev - [1] 2 - - $options$tol - [1] 0 - - $options$ncv - [1] 3 - - $options$ldv - [1] 0 - - $options$ishift - [1] 1 - - $options$maxiter - [1] 10 - - $options$nb - [1] 1 - - $options$mode - [1] 1 - - $options$start - [1] 1 - - $options$sigma - [1] 0 - - $options$sigmai - [1] 0 - - $options$info - [1] 0 - - $options$iter - [1] 1 - - $options$nconv - [1] 2 - - $options$numop - [1] 3 - - $options$numopb - [1] 0 - - $options$numreo - [1] 2 - - - -# adjacency_spectral_embedding_impl errors - - Code - adjacency_spectral_embedding_impl(graph = NULL, no = 2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# laplacian_spectral_embedding_impl basic - - Code - laplacian_spectral_embedding_impl(graph = g, no = 2) - Output - $X - [,1] [,2] - [1,] -0.7071068 -0.7071068 - [2,] 1.4142136 0.0000000 - [3,] -0.7071068 0.7071068 - - $Y - [,1] [,2] - [1,] -0.7071068 -0.7071068 - [2,] 1.4142136 0.0000000 - [3,] -0.7071068 0.7071068 - - $D - [1] 3 1 - - $options - $options$bmat - [1] "I" - - $options$n - [1] 3 - - $options$which - [1] "LM" - - $options$nev - [1] 2 - - $options$tol - [1] 0 - - $options$ncv - [1] 3 - - $options$ldv - [1] 0 - - $options$ishift - [1] 1 - - $options$maxiter - [1] 3000 - - $options$nb - [1] 1 - - $options$mode - [1] 1 - - $options$start - [1] 1 - - $options$sigma - [1] 0 - - $options$sigmai - [1] 0 - - $options$info - [1] 0 - - $options$iter - [1] 1 - - $options$nconv - [1] 2 - - $options$numop - [1] 3 - - $options$numopb - [1] 0 - - $options$numreo - [1] 3 - - - -# laplacian_spectral_embedding_impl errors - - Code - laplacian_spectral_embedding_impl(graph = NULL, no = 2) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# eigen_adjacency_impl basic - - Code - eigen_adjacency_impl(graph = g) - Output - $options - $options$bmat - [1] "I" - - $options$n - [1] 3 - - $options$which - [1] "LM" - - $options$nev - [1] 1 - - $options$tol - [1] 0 - - $options$ncv - [1] 2 - - $options$ldv - [1] 0 - - $options$ishift - [1] 1 - - $options$maxiter - [1] 3000 - - $options$nb - [1] 1 - - $options$mode - [1] 1 - - $options$start - [1] 0 - - $options$sigma - [1] 0 - - $options$sigmai - [1] 0 - - $options$info - [1] 0 - - $options$iter - [1] 29 - - $options$nconv - [1] 1 - - $options$numop - [1] 30 - - $options$numopb - [1] 0 - - $options$numreo - [1] 16 - - - $values - [1] -1.414214 - - $vectors - [,1] - [1,] -0.5000000 - [2,] 0.7071068 - [3,] -0.5000000 - - $cmplxvalues - complex(0) - - $cmplxvectors - <0 x 0 matrix> - - ---- - - Code - eigen_adjacency_impl(graph = g, algorithm = "lapack", which = list(which = "LA"), - options = list(maxiter = 10)) - Condition - Error in `eigen_adjacency_impl()`: - ! At vendor/cigraph/src/linalg/eigen.c:xx : 'LAPACK' algorithm not implemented yet, Unimplemented function call - -# eigen_adjacency_impl errors - - Code - eigen_adjacency_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# power_law_fit_impl basic - - Code - power_law_fit_impl(data = c(1, 2, 3)) - Output - $continuous - [1] FALSE - - $alpha - [1] 1.646771 - - $xmin - [1] 1 - - $logLik - [1] -5.272517 - - $KS.stat - [1] 0.2640998 - - ---- - - Code - power_law_fit_impl(data = c(1, 2, 3), xmin = 1, force_continuous = TRUE) - Output - $continuous - [1] TRUE - - $alpha - [1] 2.116221 - - $xmin - [1] 1 - - $logLik - [1] -3.461912 - - $KS.stat - [1] 0.3533555 - - -# power_law_fit_impl errors - - Code - power_law_fit_impl(data = "a") - Condition - Warning in `power_law_fit_impl()`: - NAs introduced by coercion - Error in `power_law_fit_impl()`: - ! At vendor/cigraph/src/misc/power_law_fit.c:xx : xmin must be greater than zero, Invalid value - -# sir_impl basic - - Code - sir_impl(graph = g, beta = 0.1, gamma = 0.1) - Output - [[1]] - [[1]]$times - [1] 0.000000 6.326537 8.018361 8.809852 9.405480 17.386752 - - [[1]]$NS - [1] 2 1 0 0 0 0 - - [[1]]$NI - [1] 1 2 3 2 1 0 - - [[1]]$NR - [1] 0 0 0 1 2 3 - - - [[2]] - [[2]]$times - [1] 0.000000 3.674354 13.783038 13.921168 - - [[2]]$NS - [1] 2 1 1 1 - - [[2]]$NI - [1] 1 2 1 0 - - [[2]]$NR - [1] 0 0 1 2 - - - [[3]] - [[3]]$times - [1] 0.000000 3.277542 7.521770 16.781182 18.515742 29.375613 - - [[3]]$NS - [1] 2 1 0 0 0 0 - - [[3]]$NI - [1] 1 2 3 2 1 0 - - [[3]]$NR - [1] 0 0 0 1 2 3 - - - [[4]] - [[4]]$times - [1] 0.0000000 0.3027921 - - [[4]]$NS - [1] 2 2 - - [[4]]$NI - [1] 1 0 - - [[4]]$NR - [1] 0 1 - - - [[5]] - [[5]]$times - [1] 0.000000 3.559451 5.615586 20.582742 - - [[5]]$NS - [1] 2 1 1 1 - - [[5]]$NI - [1] 1 2 1 0 - - [[5]]$NR - [1] 0 0 1 2 - - - [[6]] - [[6]]$times - [1] 0.0000000 0.7300885 0.7328203 1.2536518 1.9258569 5.1406208 - - [[6]]$NS - [1] 2 1 0 0 0 0 - - [[6]]$NI - [1] 1 2 3 2 1 0 - - [[6]]$NR - [1] 0 0 0 1 2 3 - - - [[7]] - [[7]]$times - [1] 0.000000 0.865533 - - [[7]]$NS - [1] 2 2 - - [[7]]$NI - [1] 1 0 - - [[7]]$NR - [1] 0 1 - - - [[8]] - [[8]]$times - [1] 0.00000 10.68605 - - [[8]]$NS - [1] 2 2 - - [[8]]$NI - [1] 1 0 - - [[8]]$NR - [1] 0 1 - - - [[9]] - [[9]]$times - [1] 0.000000 2.185910 7.669126 16.635095 21.440723 23.497554 - - [[9]]$NS - [1] 2 1 0 0 0 0 - - [[9]]$NI - [1] 1 2 3 2 1 0 - - [[9]]$NR - [1] 0 0 0 1 2 3 - - - [[10]] - [[10]]$times - [1] 0.000000 4.105424 4.424244 22.891743 24.099505 32.514828 - - [[10]]$NS - [1] 2 1 1 0 0 0 - - [[10]]$NI - [1] 1 2 1 2 1 0 - - [[10]]$NR - [1] 0 0 1 1 2 3 - - - [[11]] - [[11]]$times - [1] 0.00000 4.93042 21.00935 21.07441 23.37619 41.26694 - - [[11]]$NS - [1] 2 1 0 0 0 0 - - [[11]]$NI - [1] 1 2 3 2 1 0 - - [[11]]$NR - [1] 0 0 0 1 2 3 - - - [[12]] - [[12]]$times - [1] 0.00000 15.47343 26.09187 38.01744 43.76847 50.41068 - - [[12]]$NS - [1] 2 1 0 0 0 0 - - [[12]]$NI - [1] 1 2 3 2 1 0 - - [[12]]$NR - [1] 0 0 0 1 2 3 - - - [[13]] - [[13]]$times - [1] 0.000000 3.540437 - - [[13]]$NS - [1] 2 2 - - [[13]]$NI - [1] 1 0 - - [[13]]$NR - [1] 0 1 - - - [[14]] - [[14]]$times - [1] 0.000000 7.081426 7.638086 11.569527 - - [[14]]$NS - [1] 2 1 1 1 - - [[14]]$NI - [1] 1 2 1 0 - - [[14]]$NR - [1] 0 0 1 2 - - - [[15]] - [[15]]$times - [1] 0.00000 15.60443 15.66654 20.19745 22.11224 42.62196 - - [[15]]$NS - [1] 2 1 0 0 0 0 - - [[15]]$NI - [1] 1 2 3 2 1 0 - - [[15]]$NR - [1] 0 0 0 1 2 3 - - - [[16]] - [[16]]$times - [1] 0.000000 3.239708 17.193626 18.833130 19.040959 35.199892 - - [[16]]$NS - [1] 2 1 1 0 0 0 - - [[16]]$NI - [1] 1 2 1 2 1 0 - - [[16]]$NR - [1] 0 0 1 1 2 3 - - - [[17]] - [[17]]$times - [1] 0.0000000 0.2300489 1.8970602 6.9851496 16.0587095 28.8528567 - - [[17]]$NS - [1] 2 1 0 0 0 0 - - [[17]]$NI - [1] 1 2 3 2 1 0 - - [[17]]$NR - [1] 0 0 0 1 2 3 - - - [[18]] - [[18]]$times - [1] 0.000000 4.674879 5.319832 17.366640 63.357258 86.262883 - - [[18]]$NS - [1] 2 1 1 0 0 0 - - [[18]]$NI - [1] 1 2 1 2 1 0 - - [[18]]$NR - [1] 0 0 1 1 2 3 - - - [[19]] - [[19]]$times - [1] 0.000000 1.972293 - - [[19]]$NS - [1] 2 2 - - [[19]]$NI - [1] 1 0 - - [[19]]$NR - [1] 0 1 - - - [[20]] - [[20]]$times - [1] 0.000000 3.177922 - - [[20]]$NS - [1] 2 2 - - [[20]]$NI - [1] 1 0 - - [[20]]$NR - [1] 0 1 - - - [[21]] - [[21]]$times - [1] 0.000000 1.994279 2.508129 8.208209 28.478526 36.256169 - - [[21]]$NS - [1] 2 1 0 0 0 0 - - [[21]]$NI - [1] 1 2 3 2 1 0 - - [[21]]$NR - [1] 0 0 0 1 2 3 - - - [[22]] - [[22]]$times - [1] 0.000000 5.226609 14.744785 16.304309 - - [[22]]$NS - [1] 2 1 1 1 - - [[22]]$NI - [1] 1 2 1 0 - - [[22]]$NR - [1] 0 0 1 2 - - - [[23]] - [[23]]$times - [1] 0.000000 3.254634 13.673154 21.069828 - - [[23]]$NS - [1] 2 1 1 1 - - [[23]]$NI - [1] 1 2 1 0 - - [[23]]$NR - [1] 0 0 1 2 - - - [[24]] - [[24]]$times - [1] 0.00000 18.01982 18.36106 44.55144 - - [[24]]$NS - [1] 2 1 1 1 - - [[24]]$NI - [1] 1 2 1 0 - - [[24]]$NR - [1] 0 0 1 2 - - - [[25]] - [[25]]$times - [1] 0.00000 18.09036 30.47469 36.51570 - - [[25]]$NS - [1] 2 1 1 1 - - [[25]]$NI - [1] 1 2 1 0 - - [[25]]$NR - [1] 0 0 1 2 - - - [[26]] - [[26]]$times - [1] 0.00000 11.21296 - - [[26]]$NS - [1] 2 2 - - [[26]]$NI - [1] 1 0 - - [[26]]$NR - [1] 0 1 - - - [[27]] - [[27]]$times - [1] 0.000000 1.605373 - - [[27]]$NS - [1] 2 2 - - [[27]]$NI - [1] 1 0 - - [[27]]$NR - [1] 0 1 - - - [[28]] - [[28]]$times - [1] 0.000000 3.448751 12.086502 17.941228 - - [[28]]$NS - [1] 2 1 1 1 - - [[28]]$NI - [1] 1 2 1 0 - - [[28]]$NR - [1] 0 0 1 2 - - - [[29]] - [[29]]$times - [1] 0.000000 8.277924 - - [[29]]$NS - [1] 2 2 - - [[29]]$NI - [1] 1 0 - - [[29]]$NR - [1] 0 1 - - - [[30]] - [[30]]$times - [1] 0.000000 9.146159 - - [[30]]$NS - [1] 2 2 - - [[30]]$NI - [1] 1 0 - - [[30]]$NR - [1] 0 1 - - - [[31]] - [[31]]$times - [1] 0.00000000 0.07833588 - - [[31]]$NS - [1] 2 2 - - [[31]]$NI - [1] 1 0 - - [[31]]$NR - [1] 0 1 - - - [[32]] - [[32]]$times - [1] 0.000000 7.825191 - - [[32]]$NS - [1] 2 2 - - [[32]]$NI - [1] 1 0 - - [[32]]$NR - [1] 0 1 - - - [[33]] - [[33]]$times - [1] 0.0000000 0.4018017 - - [[33]]$NS - [1] 2 2 - - [[33]]$NI - [1] 1 0 - - [[33]]$NR - [1] 0 1 - - - [[34]] - [[34]]$times - [1] 0.000000 1.433794 - - [[34]]$NS - [1] 2 2 - - [[34]]$NI - [1] 1 0 - - [[34]]$NR - [1] 0 1 - - - [[35]] - [[35]]$times - [1] 0.00000000 0.06959151 2.61176819 2.76819228 - - [[35]]$NS - [1] 2 1 1 1 - - [[35]]$NI - [1] 1 2 1 0 - - [[35]]$NR - [1] 0 0 1 2 - - - [[36]] - [[36]]$times - [1] 0.000000 1.539839 17.502742 21.550799 31.779748 59.056912 - - [[36]]$NS - [1] 2 1 0 0 0 0 - - [[36]]$NI - [1] 1 2 3 2 1 0 - - [[36]]$NR - [1] 0 0 0 1 2 3 - - - [[37]] - [[37]]$times - [1] 0.000000 8.878624 - - [[37]]$NS - [1] 2 2 - - [[37]]$NI - [1] 1 0 - - [[37]]$NR - [1] 0 1 - - - [[38]] - [[38]]$times - [1] 0.000000 6.855525 - - [[38]]$NS - [1] 2 2 - - [[38]]$NI - [1] 1 0 - - [[38]]$NR - [1] 0 1 - - - [[39]] - [[39]]$times - [1] 0.000000 2.628739 3.809460 7.051204 - - [[39]]$NS - [1] 2 1 1 1 - - [[39]]$NI - [1] 1 2 1 0 - - [[39]]$NR - [1] 0 0 1 2 - - - [[40]] - [[40]]$times - [1] 0.000000 2.484282 - - [[40]]$NS - [1] 2 2 - - [[40]]$NI - [1] 1 0 - - [[40]]$NR - [1] 0 1 - - - [[41]] - [[41]]$times - [1] 0.0000000 0.8248393 - - [[41]]$NS - [1] 2 2 - - [[41]]$NI - [1] 1 0 - - [[41]]$NR - [1] 0 1 - - - [[42]] - [[42]]$times - [1] 0.000000 2.300359 3.886947 6.810196 7.223496 28.297207 - - [[42]]$NS - [1] 2 1 0 0 0 0 - - [[42]]$NI - [1] 1 2 3 2 1 0 - - [[42]]$NR - [1] 0 0 0 1 2 3 - - - [[43]] - [[43]]$times - [1] 0.00000 5.52241 10.93993 29.15486 - - [[43]]$NS - [1] 2 1 1 1 - - [[43]]$NI - [1] 1 2 1 0 - - [[43]]$NR - [1] 0 0 1 2 - - - [[44]] - [[44]]$times - [1] 0.000000 9.526317 12.154710 21.171748 - - [[44]]$NS - [1] 2 1 1 1 - - [[44]]$NI - [1] 1 2 1 0 - - [[44]]$NR - [1] 0 0 1 2 - - - [[45]] - [[45]]$times - [1] 0.000000 4.448428 - - [[45]]$NS - [1] 2 2 - - [[45]]$NI - [1] 1 0 - - [[45]]$NR - [1] 0 1 - - - [[46]] - [[46]]$times - [1] 0.0000000 0.0560511 - - [[46]]$NS - [1] 2 2 - - [[46]]$NI - [1] 1 0 - - [[46]]$NR - [1] 0 1 - - - [[47]] - [[47]]$times - [1] 0.00000 11.57560 12.20970 12.58732 26.47299 36.19628 - - [[47]]$NS - [1] 2 1 0 0 0 0 - - [[47]]$NI - [1] 1 2 3 2 1 0 - - [[47]]$NR - [1] 0 0 0 1 2 3 - - - [[48]] - [[48]]$times - [1] 0.000000 3.687231 - - [[48]]$NS - [1] 2 2 - - [[48]]$NI - [1] 1 0 - - [[48]]$NR - [1] 0 1 - - - [[49]] - [[49]]$times - [1] 0.0000000 0.3436458 1.0908931 1.4640857 - - [[49]]$NS - [1] 2 1 1 1 - - [[49]]$NI - [1] 1 2 1 0 - - [[49]]$NR - [1] 0 0 1 2 - - - [[50]] - [[50]]$times - [1] 0.000000 1.536136 - - [[50]]$NS - [1] 2 2 - - [[50]]$NI - [1] 1 0 - - [[50]]$NR - [1] 0 1 - - - [[51]] - [[51]]$times - [1] 0.000000 2.021208 - - [[51]]$NS - [1] 2 2 - - [[51]]$NI - [1] 1 0 - - [[51]]$NR - [1] 0 1 - - - [[52]] - [[52]]$times - [1] 0.00000 4.29424 - - [[52]]$NS - [1] 2 2 - - [[52]]$NI - [1] 1 0 - - [[52]]$NR - [1] 0 1 - - - [[53]] - [[53]]$times - [1] 0.000000 1.884908 5.139700 8.417338 12.272436 15.154107 - - [[53]]$NS - [1] 2 1 0 0 0 0 - - [[53]]$NI - [1] 1 2 3 2 1 0 - - [[53]]$NR - [1] 0 0 0 1 2 3 - - - [[54]] - [[54]]$times - [1] 0.0000000 0.1997796 - - [[54]]$NS - [1] 2 2 - - [[54]]$NI - [1] 1 0 - - [[54]]$NR - [1] 0 1 - - - [[55]] - [[55]]$times - [1] 0.0000000 0.1825065 - - [[55]]$NS - [1] 2 2 - - [[55]]$NI - [1] 1 0 - - [[55]]$NR - [1] 0 1 - - - [[56]] - [[56]]$times - [1] 0.000000 1.913698 2.656593 7.598135 - - [[56]]$NS - [1] 2 1 1 1 - - [[56]]$NI - [1] 1 2 1 0 - - [[56]]$NR - [1] 0 0 1 2 - - - [[57]] - [[57]]$times - [1] 0.000000 3.435708 - - [[57]]$NS - [1] 2 2 - - [[57]]$NI - [1] 1 0 - - [[57]]$NR - [1] 0 1 - - - [[58]] - [[58]]$times - [1] 0.000000 0.583133 5.284710 10.065112 18.657681 21.137430 - - [[58]]$NS - [1] 2 1 1 0 0 0 - - [[58]]$NI - [1] 1 2 1 2 1 0 - - [[58]]$NR - [1] 0 0 1 1 2 3 - - - [[59]] - [[59]]$times - [1] 0.000000 8.526031 - - [[59]]$NS - [1] 2 2 - - [[59]]$NI - [1] 1 0 - - [[59]]$NR - [1] 0 1 - - - [[60]] - [[60]]$times - [1] 0.000000 3.470768 - - [[60]]$NS - [1] 2 2 - - [[60]]$NI - [1] 1 0 - - [[60]]$NR - [1] 0 1 - - - [[61]] - [[61]]$times - [1] 0.000000 2.311806 - - [[61]]$NS - [1] 2 2 - - [[61]]$NI - [1] 1 0 - - [[61]]$NR - [1] 0 1 - - - [[62]] - [[62]]$times - [1] 0.000000 5.603495 - - [[62]]$NS - [1] 2 2 - - [[62]]$NI - [1] 1 0 - - [[62]]$NR - [1] 0 1 - - - [[63]] - [[63]]$times - [1] 0.0000000 0.2376974 - - [[63]]$NS - [1] 2 2 - - [[63]]$NI - [1] 1 0 - - [[63]]$NR - [1] 0 1 - - - [[64]] - [[64]]$times - [1] 0.000000 1.164209 4.169140 7.017509 - - [[64]]$NS - [1] 2 1 1 1 - - [[64]]$NI - [1] 1 2 1 0 - - [[64]]$NR - [1] 0 0 1 2 - - - [[65]] - [[65]]$times - [1] 0.000000 6.415227 6.561435 14.007083 - - [[65]]$NS - [1] 2 1 1 1 - - [[65]]$NI - [1] 1 2 1 0 - - [[65]]$NR - [1] 0 0 1 2 - - - [[66]] - [[66]]$times - [1] 0.00000 14.28491 31.69273 39.51170 - - [[66]]$NS - [1] 2 1 1 1 - - [[66]]$NI - [1] 1 2 1 0 - - [[66]]$NR - [1] 0 0 1 2 - - - [[67]] - [[67]]$times - [1] 0.000000 3.592755 4.363836 11.200455 - - [[67]]$NS - [1] 2 1 1 1 - - [[67]]$NI - [1] 1 2 1 0 - - [[67]]$NR - [1] 0 0 1 2 - - - [[68]] - [[68]]$times - [1] 0.000000 8.044133 10.227368 12.702160 16.225120 23.696870 - - [[68]]$NS - [1] 2 1 1 0 0 0 - - [[68]]$NI - [1] 1 2 1 2 1 0 - - [[68]]$NR - [1] 0 0 1 1 2 3 - - - [[69]] - [[69]]$times - [1] 0.000000 3.324148 - - [[69]]$NS - [1] 2 2 - - [[69]]$NI - [1] 1 0 - - [[69]]$NR - [1] 0 1 - - - [[70]] - [[70]]$times - [1] 0.000000 6.316816 - - [[70]]$NS - [1] 2 2 - - [[70]]$NI - [1] 1 0 - - [[70]]$NR - [1] 0 1 - - - [[71]] - [[71]]$times - [1] 0.000000 7.473339 7.757794 15.139281 - - [[71]]$NS - [1] 2 1 1 1 - - [[71]]$NI - [1] 1 2 1 0 - - [[71]]$NR - [1] 0 0 1 2 - - - [[72]] - [[72]]$times - [1] 0.000000 4.073649 6.034897 8.135670 - - [[72]]$NS - [1] 2 1 1 1 - - [[72]]$NI - [1] 1 2 1 0 - - [[72]]$NR - [1] 0 0 1 2 - - - [[73]] - [[73]]$times - [1] 0.00000 1.60059 - - [[73]]$NS - [1] 2 2 - - [[73]]$NI - [1] 1 0 - - [[73]]$NR - [1] 0 1 - - - [[74]] - [[74]]$times - [1] 0.000000 1.497596 - - [[74]]$NS - [1] 2 2 - - [[74]]$NI - [1] 1 0 - - [[74]]$NR - [1] 0 1 - - - [[75]] - [[75]]$times - [1] 0.000000 1.916758 - - [[75]]$NS - [1] 2 2 - - [[75]]$NI - [1] 1 0 - - [[75]]$NR - [1] 0 1 - - - [[76]] - [[76]]$times - [1] 0.0000000 0.8368377 4.1462512 14.4447646 - - [[76]]$NS - [1] 2 1 1 1 - - [[76]]$NI - [1] 1 2 1 0 - - [[76]]$NR - [1] 0 0 1 2 - - - [[77]] - [[77]]$times - [1] 0.000000 8.546053 9.275575 11.920068 14.117820 14.371987 - - [[77]]$NS - [1] 2 1 0 0 0 0 - - [[77]]$NI - [1] 1 2 3 2 1 0 - - [[77]]$NR - [1] 0 0 0 1 2 3 - - - [[78]] - [[78]]$times - [1] 0.000000 2.730273 6.669293 7.301694 14.402306 22.580301 - - [[78]]$NS - [1] 2 1 0 0 0 0 - - [[78]]$NI - [1] 1 2 3 2 1 0 - - [[78]]$NR - [1] 0 0 0 1 2 3 - - - [[79]] - [[79]]$times - [1] 0.00000 13.02458 - - [[79]]$NS - [1] 2 2 - - [[79]]$NI - [1] 1 0 - - [[79]]$NR - [1] 0 1 - - - [[80]] - [[80]]$times - [1] 0.000000 4.655717 10.847343 15.188912 38.570735 51.548959 - - [[80]]$NS - [1] 2 1 0 0 0 0 - - [[80]]$NI - [1] 1 2 3 2 1 0 - - [[80]]$NR - [1] 0 0 0 1 2 3 - - - [[81]] - [[81]]$times - [1] 0.000000 7.919139 12.774389 13.210280 20.037088 27.652380 - - [[81]]$NS - [1] 2 1 0 0 0 0 - - [[81]]$NI - [1] 1 2 3 2 1 0 - - [[81]]$NR - [1] 0 0 0 1 2 3 - - - [[82]] - [[82]]$times - [1] 0.000000 4.565727 4.640174 5.827227 8.181199 13.514984 - - [[82]]$NS - [1] 2 1 0 0 0 0 - - [[82]]$NI - [1] 1 2 3 2 1 0 - - [[82]]$NR - [1] 0 0 0 1 2 3 - - - [[83]] - [[83]]$times - [1] 0.0000000 0.4331829 - - [[83]]$NS - [1] 2 2 - - [[83]]$NI - [1] 1 0 - - [[83]]$NR - [1] 0 1 - - - [[84]] - [[84]]$times - [1] 0.0000000 0.5663187 - - [[84]]$NS - [1] 2 2 - - [[84]]$NI - [1] 1 0 - - [[84]]$NR - [1] 0 1 - - - [[85]] - [[85]]$times - [1] 0.000000 4.717821 7.368033 15.405952 20.251957 28.844191 - - [[85]]$NS - [1] 2 1 0 0 0 0 - - [[85]]$NI - [1] 1 2 3 2 1 0 - - [[85]]$NR - [1] 0 0 0 1 2 3 - - - [[86]] - [[86]]$times - [1] 0.00000 10.41346 13.17259 31.58865 35.49247 39.20284 - - [[86]]$NS - [1] 2 1 1 0 0 0 - - [[86]]$NI - [1] 1 2 1 2 1 0 - - [[86]]$NR - [1] 0 0 1 1 2 3 - - - [[87]] - [[87]]$times - [1] 0.000000 7.800903 - - [[87]]$NS - [1] 2 2 - - [[87]]$NI - [1] 1 0 - - [[87]]$NR - [1] 0 1 - - - [[88]] - [[88]]$times - [1] 0.000000 1.164975 2.214760 3.395779 4.269503 6.277390 - - [[88]]$NS - [1] 2 1 0 0 0 0 - - [[88]]$NI - [1] 1 2 3 2 1 0 - - [[88]]$NR - [1] 0 0 0 1 2 3 - - - [[89]] - [[89]]$times - [1] 0.000000 1.419246 5.241578 10.249121 - - [[89]]$NS - [1] 2 1 1 1 - - [[89]]$NI - [1] 1 2 1 0 - - [[89]]$NR - [1] 0 0 1 2 - - - [[90]] - [[90]]$times - [1] 0.000000 4.015171 - - [[90]]$NS - [1] 2 2 - - [[90]]$NI - [1] 1 0 - - [[90]]$NR - [1] 0 1 - - - [[91]] - [[91]]$times - [1] 0.00000 10.95119 10.95895 13.37237 15.94527 20.47069 - - [[91]]$NS - [1] 2 1 0 0 0 0 - - [[91]]$NI - [1] 1 2 3 2 1 0 - - [[91]]$NR - [1] 0 0 0 1 2 3 - - - [[92]] - [[92]]$times - [1] 0.000000 1.719506 - - [[92]]$NS - [1] 2 2 - - [[92]]$NI - [1] 1 0 - - [[92]]$NR - [1] 0 1 - - - [[93]] - [[93]]$times - [1] 0.00000 20.34997 23.10320 33.53507 37.61908 42.59392 - - [[93]]$NS - [1] 2 1 0 0 0 0 - - [[93]]$NI - [1] 1 2 3 2 1 0 - - [[93]]$NR - [1] 0 0 0 1 2 3 - - - [[94]] - [[94]]$times - [1] 0.000000 2.981562 4.220980 4.501876 5.930935 17.597979 - - [[94]]$NS - [1] 2 1 0 0 0 0 - - [[94]]$NI - [1] 1 2 3 2 1 0 - - [[94]]$NR - [1] 0 0 0 1 2 3 - - - [[95]] - [[95]]$times - [1] 0.0000000 0.8570038 6.2225289 7.4542303 - - [[95]]$NS - [1] 2 1 1 1 - - [[95]]$NI - [1] 1 2 1 0 - - [[95]]$NR - [1] 0 0 1 2 - - - [[96]] - [[96]]$times - [1] 0.00000 10.99346 - - [[96]]$NS - [1] 2 2 - - [[96]]$NI - [1] 1 0 - - [[96]]$NR - [1] 0 1 - - - [[97]] - [[97]]$times - [1] 0.000000 6.324172 10.943694 11.370294 - - [[97]]$NS - [1] 2 1 1 1 - - [[97]]$NI - [1] 1 2 1 0 - - [[97]]$NR - [1] 0 0 1 2 - - - [[98]] - [[98]]$times - [1] 0.00000000 0.07582625 1.04605163 3.19140611 3.57055288 9.94371399 - - [[98]]$NS - [1] 2 1 1 0 0 0 - - [[98]]$NI - [1] 1 2 1 2 1 0 - - [[98]]$NR - [1] 0 0 1 1 2 3 - - - [[99]] - [[99]]$times - [1] 0.000000 1.910419 - - [[99]]$NS - [1] 2 2 - - [[99]]$NI - [1] 1 0 - - [[99]]$NR - [1] 0 1 - - - [[100]] - [[100]]$times - [1] 0.000000 2.446835 - - [[100]]$NS - [1] 2 2 - - [[100]]$NI - [1] 1 0 - - [[100]]$NR - [1] 0 1 - - - attr(,"class") - [1] "sir" - ---- - - Code - sir_impl(graph = g, beta = 0.1, gamma = 0.1, no_sim = 2) - Output - [[1]] - [[1]]$times - [1] 0.0000000 0.5059133 5.9903814 8.4444363 - - [[1]]$NS - [1] 2 1 1 1 - - [[1]]$NI - [1] 1 2 1 0 - - [[1]]$NR - [1] 0 0 1 2 - - - [[2]] - [[2]]$times - [1] 0.000000 4.481524 - - [[2]]$NS - [1] 2 2 - - [[2]]$NI - [1] 1 0 - - [[2]]$NR - [1] 0 1 - - - attr(,"class") - [1] "sir" - -# sir_impl errors - - Code - sir_impl(graph = NULL, beta = 0.1, gamma = 0.1) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# convex_hull_2d_impl basic - - Code - convex_hull_2d_impl(data = matrix(1:6, ncol = 2)) - Output - $resverts - [1] 1 3 - - $rescoords - [,1] [,2] - [1,] 1 4 - [2,] 3 6 - - -# convex_hull_2d_impl errors - - Code - convex_hull_2d_impl(data = "a") - Condition - Warning in `convex_hull_2d_impl()`: - NAs introduced by coercion - Error in `convex_hull_2d_impl()`: - ! REAL() can only be applied to a 'numeric', not a 'character' - -# dim_select_impl basic - - Code - dim_select_impl(sv = c(1, 2, 3)) - Output - [1] 1 - -# dim_select_impl errors - - Code - dim_select_impl(sv = NULL) - Condition - Error in `dim_select_impl()`: - ! At vendor/cigraph/src/misc/embedding.c:xx : Need at least one singular value for dimensionality selection, Invalid value - -# solve_lsap_impl basic - - Code - solve_lsap_impl(c = matrix(1:4, ncol = 2), n = 2) - Output - [1] 0 1 - -# solve_lsap_impl errors - - Code - solve_lsap_impl(c = "a", n = 2) - Condition - Warning in `solve_lsap_impl()`: - NAs introduced by coercion - Error in `solve_lsap_impl()`: - ! REAL() can only be applied to a 'numeric', not a 'character' - -# find_cycle_impl basic - - Code - find_cycle_impl(graph = g) - Output - $vertices - + 0/3 vertices: - - $edges - + 0/2 edges: - - ---- - - Code - find_cycle_impl(graph = g, mode = "in") - Output - $vertices - + 0/3 vertices: - - $edges - + 0/2 edges: - - -# find_cycle_impl errors - - Code - find_cycle_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# simple_cycles_impl basic - - Code - simple_cycles_impl(graph = g) - Output - $vertices - list() - - $edges - list() - - ---- - - Code - simple_cycles_impl(graph = g, mode = "in", min_cycle_length = 2, - max_cycle_length = 3) - Output - $vertices - list() - - $edges - list() - - -# simple_cycles_impl errors - - Code - simple_cycles_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# is_eulerian_impl basic - - Code - is_eulerian_impl(graph = g) - Output - $has_path - [1] TRUE - - $has_cycle - [1] FALSE - - -# is_eulerian_impl errors - - Code - is_eulerian_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# eulerian_path_impl basic - - Code - eulerian_path_impl(graph = g) - Output - $epath - + 2/2 edges: - [1] 1--2 2--3 - - $vpath - + 3/3 vertices: - [1] 1 2 3 - - -# eulerian_path_impl errors - - Code - eulerian_path_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# eulerian_cycle_impl basic - - Code - eulerian_cycle_impl(graph = g1) - Condition - Error in `eulerian_cycle_impl()`: - ! At vendor/cigraph/src/paths/eulerian.c:xx : The graph does not have an Eulerian cycle. Input problem has no solution - ---- - - Code - eulerian_cycle_impl(graph = g2) - Output - $epath - + 4/4 edges: - [1] 1--2 2--3 3--4 1--4 - - $vpath - + 5/4 vertices: - [1] 1 2 3 4 1 - - -# eulerian_cycle_impl errors - - Code - eulerian_cycle_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# fundamental_cycles_impl basic - - Code - fundamental_cycles_impl(graph = g, start = 1) - Output - list() - ---- - - Code - fundamental_cycles_impl(graph = g, start = 1, bfs_cutoff = 2, weights = c(1, 2)) - Output - list() - -# fundamental_cycles_impl errors - - Code - fundamental_cycles_impl(graph = NULL, start = 1) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# minimum_cycle_basis_impl basic - - Code - minimum_cycle_basis_impl(graph = g) - Output - list() - ---- - - Code - minimum_cycle_basis_impl(graph = g, bfs_cutoff = 2, complete = FALSE, - use_cycle_order = FALSE, weights = c(1, 2)) - Output - list() - -# minimum_cycle_basis_impl errors - - Code - minimum_cycle_basis_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# is_tree_impl basic - - Code - is_tree_impl(graph = g) - Output - [1] TRUE - ---- - - Code - is_tree_impl(graph = g, mode = "in", details = TRUE) - Output - $res - [1] TRUE - - $root - + 1/3 vertex: - [1] 1 - - -# is_tree_impl errors - - Code - is_tree_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# is_forest_impl basic - - Code - is_forest_impl(graph = g) - Output - [1] TRUE - ---- - - Code - is_forest_impl(graph = g, mode = "in", details = TRUE) - Output - $res - [1] TRUE - - $roots - + 1/3 vertex: - [1] 1 - - -# is_forest_impl errors - - Code - is_forest_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# from_prufer_impl basic - - Code - from_prufer_impl(prufer = 1:2) - Output - IGRAPH U--- 4 3 -- Tree from Prufer sequence - + attr: name (g/c), prufer (g/n) - + edges: - [1] 1--3 1--2 2--4 - -# from_prufer_impl errors - - Code - from_prufer_impl(prufer = "a") - Condition - Warning in `from_prufer_impl()`: - NAs introduced by coercion - Error in `from_prufer_impl()`: - ! At rinterface_extra.c:xx : The value nan is not representable as an integer. Invalid value - -# to_prufer_impl basic - - Code - to_prufer_impl(graph = g) - Output - [1] 2 - -# to_prufer_impl errors - - Code - to_prufer_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# tree_from_parent_vector_impl basic - - Code - tree_from_parent_vector_impl(parents = c(-1, 1, 2, 3)) - Output - IGRAPH D--- 4 3 -- - + edges: - [1] 1->2 2->3 3->4 - ---- - - Code - tree_from_parent_vector_impl(parents = c(-1, 1, 2, 3), type = "in") - Output - IGRAPH D--- 4 3 -- - + edges: - [1] 2->1 3->2 4->3 - -# tree_from_parent_vector_impl errors - - Code - tree_from_parent_vector_impl(parents = "a") - Condition - Warning in `tree_from_parent_vector_impl()`: - NAs introduced by coercion - Error in `tree_from_parent_vector_impl()`: - ! At rinterface_extra.c:xx : The value nan is not representable as an integer. Invalid value - -# is_complete_impl basic - - Code - is_complete_impl(graph = g) - Output - [1] FALSE - -# is_complete_impl errors - - Code - is_complete_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# random_spanning_tree_impl basic - - Code - random_spanning_tree_impl(graph = g, vid = 1) - Output - + 2/2 edges: - [1] 1--2 2--3 - -# random_spanning_tree_impl errors - - Code - random_spanning_tree_impl(graph = NULL, vid = 1) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# tree_game_impl basic - - Code - tree_game_impl(n = 3) - Output - IGRAPH U--- 3 2 -- - + edges: - [1] 2--3 1--2 - ---- - - Code - tree_game_impl(n = 3, directed = TRUE, method = "lerw") - Output - IGRAPH D--- 3 2 -- - + edges: - [1] 3->1 1->2 - -# tree_game_impl errors - - Code - tree_game_impl(n = "a") - Condition - Warning in `tree_game_impl()`: - NAs introduced by coercion - Error in `tree_game_impl()`: - ! At rinterface_extra.c:xx : The value nan is not representable as an integer. Invalid value - -# vertex_coloring_greedy_impl basic - - Code - vertex_coloring_greedy_impl(graph = g) - Output - [1] 2 1 2 - ---- - - Code - vertex_coloring_greedy_impl(graph = g, heuristic = "dsatur") - Output - [1] 2 1 2 - -# vertex_coloring_greedy_impl errors - - Code - vertex_coloring_greedy_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# is_vertex_coloring_impl basic - - Code - is_vertex_coloring_impl(graph = g, types = c(1, 2, 3)) - Output - [1] TRUE - -# is_vertex_coloring_impl errors - - Code - is_vertex_coloring_impl(graph = NULL, types = c(1, 2, 3)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# is_bipartite_coloring_impl basic - - Code - is_bipartite_coloring_impl(graph = g, types = c(TRUE, FALSE, TRUE)) - Output - [1] TRUE - -# is_bipartite_coloring_impl errors - - Code - is_bipartite_coloring_impl(graph = NULL, types = c(TRUE, FALSE, TRUE)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# is_edge_coloring_impl basic - - Code - is_edge_coloring_impl(graph = g, types = c(1, 2)) - Output - [1] TRUE - ---- - - Code - is_edge_coloring_impl(graph = g) - Output - [1] TRUE - -# is_edge_coloring_impl errors - - Code - is_edge_coloring_impl(graph = NULL, types = c(1, 2)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# deterministic_optimal_imitation_impl basic - - Code - deterministic_optimal_imitation_impl(graph = g, vid = 1, quantities = c(1, 2, 3), - strategies = c(1, 2, 3)) - Output - [1] 2 2 3 - ---- - - Code - deterministic_optimal_imitation_impl(graph = g, vid = 1, optimality = "minimum", - quantities = c(1, 2, 3), strategies = c(1, 2, 3), mode = "in") - Output - [1] 1 2 3 - -# deterministic_optimal_imitation_impl errors - - Code - deterministic_optimal_imitation_impl(graph = NULL, vid = 1, quantities = c(1, 2, - 3), strategies = c(1, 2, 3)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# moran_process_impl basic - - Code - moran_process_impl(graph = g, weights = c(1, 1), quantities = c(1, 2, 3), - strategies = c(1, 2, 3), mode = "in") - Output - $quantities - [1] 1 3 3 - - $strategies - [1] 1 3 3 - - -# moran_process_impl errors - - Code - moran_process_impl(graph = NULL, quantities = c(1, 2, 3), strategies = c(1, 2, - 3)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# roulette_wheel_imitation_impl basic - - Code - roulette_wheel_imitation_impl(graph = g, vid = 1, is_local = TRUE, quantities = c( - 1, 2, 3), strategies = c(1, 2, 3)) - Output - [1] 1 2 3 - ---- - - Code - roulette_wheel_imitation_impl(graph = g, vid = 1, is_local = FALSE, quantities = c( - 1, 2, 3), strategies = c(1, 2, 3), mode = "in") - Output - [1] 3 2 3 - -# roulette_wheel_imitation_impl errors - - Code - roulette_wheel_imitation_impl(graph = NULL, vid = 1, is_local = TRUE, - quantities = c(1, 2, 3), strategies = c(1, 2, 3)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# stochastic_imitation_impl basic - - Code - stochastic_imitation_impl(graph = g, vid = 1, algo = 1, quantities = c(1, 2, 3), - strategies = c(1, 2, 3)) - Output - [1] 1 2 3 - ---- - - Code - stochastic_imitation_impl(graph = g, vid = 1, algo = 2, quantities = c(1, 2, 3), - strategies = c(1, 2, 3), mode = "in") - Output - [1] 1 2 3 - -# stochastic_imitation_impl errors - - Code - stochastic_imitation_impl(graph = NULL, vid = 1, algo = 1, quantities = c(1, 2, - 3), strategies = c(1, 2, 3)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# invalidate_cache_impl basic - - Code - invalidate_cache_impl(graph = g) - Output - IGRAPH U--- 3 2 -- - + edges: - [1] 1--2 2--3 - -# invalidate_cache_impl errors - - Code - invalidate_cache_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# vertex_path_from_edge_path_impl basic - - Code - vertex_path_from_edge_path_impl(graph = g, start = 1, edge_path = c(1, 2)) - Output - + 3/3 vertices: - [1] 1 2 3 - ---- - - Code - vertex_path_from_edge_path_impl(graph = g, start = 1, edge_path = c(1), mode = "in") - Output - + 2/3 vertices: - [1] 1 2 - -# vertex_path_from_edge_path_impl errors - - Code - vertex_path_from_edge_path_impl(graph = NULL, start = 1, edge_path = c(1, 2)) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# version_impl basic - - Code - version_impl_clean() - Output - [1] "0.10.17" - -# version_impl errors - - Code - version_impl("invalid") - Condition - Error in `version_impl()`: - ! unused argument ("invalid") - -# ecount_impl basic - - Code - ecount_impl(graph = g) - Output - [1] 0 - ---- - - Code - ecount_impl(graph = g) - Output - [1] 3 - -# ecount_impl errors - - Code - ecount_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# is_directed_impl basic - - Code - is_directed_impl(graph = g) - Output - [1] TRUE - ---- - - Code - is_directed_impl(graph = g) - Output - [1] FALSE - -# is_directed_impl errors - - Code - is_directed_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# edges_impl basic - - Code - edges_impl(graph = g, eids = E(g)) - Output - + 6/4 vertices: - [1] 1 2 2 3 3 4 - ---- - - Code - edges_impl(graph = g, eids = c(1, 3)) - Output - + 4/4 vertices: - [1] 1 2 3 4 - -# edges_impl errors - - Code - edges_impl(graph = NULL, eids = 1) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# add_vertices_impl basic - - Code - vcount(g_new) - Output - [1] 5 - -# add_vertices_impl errors - - Code - add_vertices_impl(graph = NULL, nv = 1) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# delete_edges_impl basic - - Code - ecount(g_new) - Output - [1] 1 - -# delete_edges_impl errors - - Code - delete_edges_impl(graph = NULL, edges = 1) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# delete_vertices_impl basic - - Code - vcount(g_new) - Output - [1] 2 - -# delete_vertices_impl errors - - Code - delete_vertices_impl(graph = NULL, vertices = 1) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# incident_impl basic - - Code - incident_impl(graph = g, vid = 2, mode = "out") - Output - + 1/3 edge: - [1] 2->3 - ---- - - Code - incident_impl(graph = g, vid = 2, mode = "in") - Output - + 1/3 edge: - [1] 1->2 - ---- - - Code - incident_impl(graph = g, vid = 2, mode = "all") - Output - + 2/3 edges: - [1] 1->2 2->3 - -# incident_impl errors - - Code - incident_impl(graph = NULL, vid = 1) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# famous_impl basic - - Code - famous_impl(name = "Zachary") - Output - IGRAPH U--- 34 78 -- - + edges: - [1] 1-- 2 1-- 3 1-- 4 1-- 5 1-- 6 1-- 7 1-- 8 1-- 9 1--11 1--12 - [11] 1--13 1--14 1--18 1--20 1--22 1--32 2-- 3 2-- 4 2-- 8 2--14 - [21] 2--18 2--20 2--22 2--31 3-- 4 3-- 8 3--28 3--29 3--33 3--10 - [31] 3-- 9 3--14 4-- 8 4--13 4--14 5-- 7 5--11 6-- 7 6--11 6--17 - [41] 7--17 9--31 9--33 9--34 10--34 14--34 15--33 15--34 16--33 16--34 - [51] 19--33 19--34 20--34 21--33 21--34 23--33 23--34 24--26 24--28 24--33 - [61] 24--34 24--30 25--26 25--28 25--32 26--32 27--30 27--34 28--34 29--32 - [71] 29--34 30--33 30--34 31--33 31--34 32--33 32--34 33--34 - -# famous_impl errors - - Code - famous_impl(name = "NonexistentGraph") - Condition - Error in `famous_impl()`: - ! At vendor/cigraph/src/constructors/famous.c:xx : NonexistentGraph is not a known graph. See the documentation for valid graph names. Invalid value - -# constraint_impl errors - - Code - constraint_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# cocitation_impl errors - - Code - cocitation_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# bibcoupling_impl errors - - Code - bibcoupling_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# girth_impl basic - - Code - result$girth - Output - [1] 5 - -# girth_impl errors - - Code - girth_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# coreness_impl basic - - Code - coreness_impl(graph = g) - Output - [1] 2 2 2 1 - -# coreness_impl errors - - Code - coreness_impl(graph = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# union_impl basic - - Code - union_impl(left = g1, right = g2) - Output - $res - IGRAPH D--- 4 4 -- - + edges: - [1] 1->2 1->3 2->3 3->4 - - $edge_map_left - [1] 1 3 - - $edge_map_right - [1] 2 4 - - -# union_impl errors - - Code - union_impl(left = NULL, right = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# intersection_impl basic - - Code - intersection_impl(left = g1, right = g2) - Output - $res - IGRAPH D--- 3 2 -- - + edges: - [1] 1->2 2->3 - - $edge_map_left - [1] 1 2 - - $edge_map_right - [1] 1 2 - - -# intersection_impl errors - - Code - intersection_impl(left = NULL, right = NULL) - Condition - Error in `ensure_igraph()`: - ! Must provide a graph object (provided `NULL`). - -# star_impl basic - - Code - star_impl(n = 5, mode = "out", center = 0) - Output - IGRAPH D--- 5 4 -- - + edges: - [1] 1->2 1->3 1->4 1->5 - ---- - - Code - star_impl(n = 6, mode = "in", center = 1) - Output - IGRAPH D--- 6 5 -- - + edges: - [1] 1->2 3->2 4->2 5->2 6->2 - ---- - - Code - star_impl(n = 4, mode = "undirected", center = 0) - Output - IGRAPH U--- 4 3 -- - + edges: - [1] 1--2 1--3 1--4 - -# ring_impl basic - - Code - ring_impl(n = 5, directed = FALSE, mutual = FALSE, circular = TRUE) - Output - IGRAPH U--- 5 5 -- - + edges: - [1] 1--2 2--3 3--4 4--5 1--5 - ---- - - Code - ring_impl(n = 4, directed = TRUE, mutual = FALSE, circular = FALSE) - Output - IGRAPH D--- 4 3 -- - + edges: - [1] 1->2 2->3 3->4 - -# full_impl basic - - Code - full_impl(n = 4, directed = FALSE, loops = FALSE) - Output - IGRAPH U--- 4 6 -- - + edges: - [1] 1--2 1--3 1--4 2--3 2--4 3--4 - ---- - - Code - full_impl(n = 3, directed = TRUE, loops = FALSE) - Output - IGRAPH D--- 3 6 -- - + edges: - [1] 1->2 1->3 2->1 2->3 3->1 3->2 - -# kary_tree_impl basic - - Code - kary_tree_impl(n = 7, children = 2, type = c("out", "in", "undirected")) - Output - IGRAPH D--- 7 6 -- - + edges: - [1] 1->2 1->3 2->4 2->5 3->6 3->7 - ---- - - Code - kary_tree_impl(n = 10, children = 3, type = c("in", "out", "undirected")) - Output - IGRAPH D--- 10 9 -- - + edges: - [1] 2->1 3->1 4->1 5->2 6->2 7->2 8->3 9->3 10->3 - -# barabasi_game_impl basic - - Code - barabasi_game_impl(n = 10, power = 1, m = 2, directed = FALSE, algo = "bag") - Output - IGRAPH U--- 10 18 -- - + edges: - [1] 1-- 2 1-- 2 2-- 3 1-- 3 2-- 4 2-- 4 2-- 5 2-- 5 4-- 6 2-- 6 2-- 7 1-- 7 - [13] 3-- 8 2-- 8 8-- 9 5-- 9 6--10 5--10 - ---- - - Code - barabasi_game_impl(n = 10, power = 1, m = 2, directed = FALSE, algo = "psumtree") - Output - IGRAPH U--- 10 17 -- - + edges: - [1] 1-- 2 1-- 3 2-- 3 1-- 4 2-- 4 2-- 5 4-- 5 1-- 6 3-- 6 6-- 7 3-- 7 6-- 8 - [13] 2-- 8 3-- 9 5-- 9 2--10 6--10 - -# grg_game_impl basic - - Code - grg_game_impl(nodes = 10, radius = 0.3, torus = FALSE) - Output - $graph - IGRAPH U--- 10 12 -- - + edges: - [1] 3-- 5 3-- 6 5-- 6 5-- 7 5-- 8 6-- 8 7-- 8 7-- 9 7--10 8-- 9 8--10 9--10 - - $x - [1] 0.08565451 0.15145413 0.45222514 0.45939554 0.55956278 0.61872370 - [7] 0.76201957 0.82545284 0.86690370 0.95857358 - - $y - [1] 0.07820721 0.85018913 0.08700766 0.73223568 0.33212277 0.14562638 - [7] 0.53326474 0.32235478 0.49679861 0.31410636 - - -# watts_strogatz_game_impl basic - - Code - watts_strogatz_game_impl(dim = 1, size = 10, nei = 2, p = 0.1) - Output - IGRAPH U--- 10 20 -- - + edges: - [1] 1-- 2 2-- 6 2-- 3 4-- 5 5-- 6 6-- 7 7-- 8 8-- 9 9--10 1--10 1-- 8 1-- 9 - [13] 2--10 2-- 4 3-- 5 4-- 6 5-- 7 6-- 8 7-- 9 8--10 - -# distances_impl basic - - Code - distances_impl(graph = g, from = V(g), to = V(g), mode = c("out", "in", "all", - "total")) - Output - [,1] [,2] [,3] [,4] [,5] - [1,] 0 1 2 2 1 - [2,] 1 0 1 2 2 - [3,] 2 1 0 1 2 - [4,] 2 2 1 0 1 - [5,] 1 2 2 1 0 - -# diameter_impl basic - - Code - diameter_impl(graph = g, directed = FALSE, unconnected = TRUE) - Output - $res - [1] 5 - - $from - [1] 0 - - $to - [1] 5 - - $vertex_path - [1] 0 1 2 3 4 5 - - $edge_path - [1] 0 1 2 3 4 - - -# get_shortest_paths_impl basic - - Code - get_shortest_paths_impl(graph = g, from = 1, to = 3, mode = c("out", "in", - "all", "total")) - Output - $vertices - $vertices[[1]] - + 3/5 vertices: - [1] 1 2 3 - - - $edges - $edges[[1]] - + 2/5 edges: - [1] 1--2 2--3 - - - $parents - [1] -1 0 1 -2 0 - - $inbound_edges - [1] -1 0 1 -1 4 - - -# subcomponent_impl basic - - Code - subcomponent_impl(graph = g, v = 1, mode = c("all", "out", "in")) - Output - + 3/6 vertices, named: - [1] A B C - -# betweenness_impl basic - - Code - betweenness_impl(graph = g, vids = V(g), directed = FALSE) - Output - [1] 6 0 0 0 0 - -# harmonic_centrality_impl basic - - Code - harmonic_centrality_impl(graph = g, vids = V(g), mode = c("out", "in", "all", - "total")) - Output - [1] 4.0 2.5 2.5 2.5 2.5 - -# pagerank_impl basic - - Code - pagerank_impl(graph = g, vids = V(g), directed = TRUE, damping = 0.85) - Output - $vector - [1] 0.2 0.2 0.2 0.2 0.2 - - $value - [1] 1 - - $options - NULL - - -# hub_score_impl basic - - Code - hub_score_impl(graph = g, scale = TRUE, weights = NULL) - Output - $vector - [1] 1.0000000 0.2500078 0.2500078 0.2500078 0.2500078 - - $value - [1] 4 - - $options - $options$bmat - [1] "I" - - $options$n - [1] 5 - - $options$which - [1] "LA" - - $options$nev - [1] 1 - - $options$tol - [1] 0 - - $options$ncv - [1] 0 - - $options$ldv - [1] 0 - - $options$ishift - [1] 1 - - $options$maxiter - [1] 3000 - - $options$nb - [1] 1 - - $options$mode - [1] 1 - - $options$start - [1] 1 - - $options$sigma - [1] 0 - - $options$sigmai - [1] 0 - - $options$info - [1] 0 - - $options$iter - [1] 1 - - $options$nconv - [1] 1 - - $options$numop - [1] 4 - - $options$numopb - [1] 0 - - $options$numreo - [1] 4 - - - -# authority_score_impl basic - - Code - authority_score_impl(graph = g, scale = TRUE, weights = NULL) - Output - $vector - [1] 1.0000000 0.9999686 0.9999686 0.9999686 0.9999686 - - $value - [1] 4 - - $options - $options$bmat - [1] "I" - - $options$n - [1] 5 - - $options$which - [1] "LA" - - $options$nev - [1] 1 - - $options$tol - [1] 0 - - $options$ncv - [1] 0 - - $options$ldv - [1] 0 - - $options$ishift - [1] 1 - - $options$maxiter - [1] 3000 - - $options$nb - [1] 1 - - $options$mode - [1] 1 - - $options$start - [1] 1 - - $options$sigma - [1] 0 - - $options$sigmai - [1] 0 - - $options$info - [1] 0 - - $options$iter - [1] 1 - - $options$nconv - [1] 1 - - $options$numop - [1] 4 - - $options$numopb - [1] 0 - - $options$numreo - [1] 4 - - - -# community_walktrap_impl basic - - Code - community_walktrap_impl(graph = g, steps = 4) - Output - $merges - [,1] [,2] - [1,] 4 5 - [2,] 1 2 - [3,] 3 6 - [4,] 0 7 - [5,] 8 9 - - $modularity - [1] -0.17346939 -0.07142857 0.03061224 0.19387755 0.35714286 0.00000000 - - $membership - [1] 0 0 0 1 1 1 - - -# community_fastgreedy_impl basic - - Code - community_fastgreedy_impl(graph = g) - Output - $merges - [,1] [,2] - [1,] 2 1 - [2,] 0 6 - [3,] 5 4 - [4,] 3 8 - [5,] 9 7 - - $modularity - [1] -1.734694e-01 -7.142857e-02 9.183673e-02 1.938776e-01 3.571429e-01 - [6] 5.551115e-17 - - $membership - [1] 1 1 1 0 0 0 - - -# community_edge_betweenness_impl basic - - Code - community_edge_betweenness_impl(graph = g, directed = FALSE) - Output - $removed_edges - [1] 2 0 1 3 4 5 6 - - $edge_betweenness - [1] 9 1 2 1 1 2 1 - - $merges - [,1] [,2] - [1,] 5 4 - [2,] 6 3 - [3,] 2 1 - [4,] 8 0 - [5,] 7 9 - - $bridges - [1] 7 6 4 3 1 - - $modularity - [1] -0.17346939 -0.07142857 0.09183673 0.19387755 0.35714286 0.00000000 - - $membership - [1] 0 0 0 1 1 1 - - -# edge_connectivity_impl basic - - Code - edge_connectivity_impl(graph = g) - Output - [1] 2 - -# vertex_connectivity_impl basic - - Code - vertex_connectivity_impl(graph = g) - Output - [1] 2 - -# create_bipartite_impl basic - - Code - create_bipartite_impl(types = c(FALSE, FALSE, TRUE, TRUE), edges = c(0, 2, 0, 3, - 1, 2, 1, 3), directed = FALSE) - Output - IGRAPH U--- 4 4 -- - + edges: - [1] 1--3 1--4 2--3 2--4 - -# bipartite_game_impl basic - - Code - bipartite_game_impl(type = "gnp", n1 = 5, n2 = 5, p = 0.3, directed = FALSE) - Output - $graph - IGRAPH U--- 10 10 -- - + edges: - [1] 1-- 6 2-- 6 4-- 6 5-- 6 1-- 7 4-- 7 4-- 8 3-- 9 3--10 4--10 - - $types - [1] FALSE FALSE FALSE FALSE FALSE TRUE TRUE TRUE TRUE TRUE - - ---- - - Code - bipartite_game_impl(type = "gnm", n1 = 5, n2 = 5, m = 10, directed = FALSE) - Output - $graph - IGRAPH U--- 10 10 -- - + edges: - [1] 1-- 6 3-- 7 5-- 7 1-- 8 3-- 8 4-- 8 2-- 9 5-- 9 2--10 3--10 - - $types - [1] FALSE FALSE FALSE FALSE FALSE TRUE TRUE TRUE TRUE TRUE - - -# decompose_impl basic - - Code - decompose_impl(graph = g, mode = c("weak", "strong")) - Output - [[1]] - IGRAPH UN-- 3 2 -- - + attr: name (v/c) - + edges (vertex names): - [1] A--B B--C - - [[2]] - IGRAPH UN-- 2 1 -- - + attr: name (v/c) - + edge (vertex names): - [1] D--E - - -# neighborhood_impl basic - - Code - neighborhood_impl(graph = g, order = 1, vids = V(g), mode = c("all", "out", - "in")) - Output - [[1]] - + 3/5 vertices: - [1] 1 2 5 - - [[2]] - + 3/5 vertices: - [1] 2 1 3 - - [[3]] - + 3/5 vertices: - [1] 3 2 4 - - [[4]] - + 3/5 vertices: - [1] 4 3 5 - - [[5]] - + 3/5 vertices: - [1] 5 1 4 - - -# neighborhood_size_impl basic - - Code - neighborhood_size_impl(graph = g, order = 1, vids = V(g), mode = c("all", "out", - "in")) - Output - [1] 3 3 3 3 3 - -# get_adjacency_impl basic - - Code - get_adjacency_impl(graph = g, type = c("both", "upper", "lower")) - Output - [,1] [,2] [,3] - [1,] 0 1 1 - [2,] 1 0 1 - [3,] 1 1 0 - -# write_graph_edgelist_impl basic - - Code - content - Output - [1] "0 1" "0 2" "1 2" - -# read_graph_edgelist_impl basic - - Code - read_graph_edgelist_impl(instream = tmp, n = 3, directed = FALSE) - Output - IGRAPH U--- 3 3 -- - + edges: - [1] 1--2 2--3 1--3 - -# degree_sequence_game_impl basic - - Code - degree_sequence_game_impl(out_deg = c(2, 2, 2, 2), method = "configuration") - Output - IGRAPH U--- 4 4 -- - + edges: - [1] 2--4 3--3 1--4 1--2 - ---- - - Code - degree_sequence_game_impl(out_deg = c(2, 2, 2, 2), method = "vl") - Output - IGRAPH U--- 4 4 -- - + edges: - [1] 1--2 1--4 2--3 3--4 - -# connect_neighborhood_impl basic - - Code - connect_neighborhood_impl(graph = g, order = 1, mode = c("all", "out", "in")) - Condition - Warning in `connect_neighborhood_impl()`: - At vendor/cigraph/src/operators/connect_neighborhood.c:85 : Order smaller than two, graph will be unchanged. - Output - IGRAPH U--- 5 5 -- Ring graph - + attr: name (g/c), mutual (g/l), circular (g/l) - + edges: - [1] 1--2 2--3 3--4 4--5 1--5 - -# eccentricity_impl basic - - Code - eccentricity_impl(graph = g, vids = V(g), mode = c("out", "in", "all")) - Output - [1] 2 2 2 2 2 - -# radius_impl basic - - Code - radius_impl(graph = g, mode = c("out", "in", "all")) - Output - [1] 2 - -# graph_center_impl basic - - Code - graph_center_impl(graph = g, mode = c("out", "in", "all")) - Output - + 1/5 vertex: - [1] 1 - -# maximal_cliques_impl basic - - Code - maximal_cliques_impl(graph = g, min_size = 1, max_size = 0) - Output - [[1]] - + 4/4 vertices: - [1] 1 2 4 3 - - -# independent_vertex_sets_impl basic - - Code - independent_vertex_sets_impl(graph = g, min_size = 1, max_size = 0) - Output - [[1]] - + 1/5 vertex: - [1] 1 - - [[2]] - + 1/5 vertex: - [1] 2 - - [[3]] - + 1/5 vertex: - [1] 3 - - [[4]] - + 1/5 vertex: - [1] 4 - - [[5]] - + 1/5 vertex: - [1] 5 - - [[6]] - + 2/5 vertices: - [1] 1 3 - - [[7]] - + 2/5 vertices: - [1] 1 4 - - [[8]] - + 2/5 vertices: - [1] 2 4 - - [[9]] - + 2/5 vertices: - [1] 2 5 - - [[10]] - + 2/5 vertices: - [1] 3 5 - -