Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d6ebcd0
feat: Use autogenerated functions for foreign interface
krlmlr Nov 2, 2025
a098d4a
cliques
krlmlr Nov 2, 2025
d32301a
cocitation
krlmlr Nov 2, 2025
277a301
cohesive
krlmlr Nov 2, 2025
2fc95ae
flow
krlmlr Nov 2, 2025
4d1b4e1
flow
krlmlr Nov 2, 2025
63f0858
make
krlmlr Nov 2, 2025
4813e0f
mst
krlmlr Nov 2, 2025
c6d4297
other
krlmlr Nov 2, 2025
4d5e2d1
rewire
krlmlr Nov 2, 2025
78999d3
i1
krlmlr Nov 2, 2025
72cfd3f
i2
krlmlr Nov 2, 2025
c3f9c63
i3
krlmlr Nov 2, 2025
84c1470
i4
krlmlr Nov 2, 2025
1dc2036
i5
krlmlr Nov 2, 2025
1121988
i6
krlmlr Nov 2, 2025
23dd8ce
i7
krlmlr Nov 2, 2025
82387c1
g2
krlmlr Nov 2, 2025
7f1c115
g1, change in behavior
krlmlr Nov 2, 2025
c920c39
s1
krlmlr Nov 2, 2025
6dc5010
s2
krlmlr Nov 2, 2025
18d5772
s3
krlmlr Nov 2, 2025
93d2ca7
Remove unneeded
krlmlr Nov 2, 2025
6a2574d
Remove unneeded
krlmlr Nov 2, 2025
a82cba4
Remove unneeded
krlmlr Nov 2, 2025
65ed655
Remove unneeded
krlmlr Nov 2, 2025
71781de
Remove unneeded
krlmlr Nov 2, 2025
29bfdab
Remove unneeded
krlmlr Nov 2, 2025
7a9a2f8
Remove unneeded
krlmlr Nov 2, 2025
467778e
Remove unneeded
krlmlr Nov 2, 2025
d23a646
Remove unneeded
krlmlr Nov 2, 2025
0b62fcb
Remove unneeded
krlmlr Nov 2, 2025
921a2b4
Remove unneeded
krlmlr Nov 2, 2025
e402908
Remove unneeded
krlmlr Nov 2, 2025
f8e0f25
Remove unneeded
krlmlr Nov 2, 2025
2d4c20a
Remove unneeded
krlmlr Nov 2, 2025
45dc7a2
Remove unneeded
krlmlr Nov 2, 2025
d28b147
Remove unneeded
krlmlr Nov 2, 2025
bef9424
Remove unneeded
krlmlr Nov 2, 2025
4ec8652
Remove unneeded
krlmlr Nov 2, 2025
5487c69
Remove unneeded
krlmlr Nov 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions R/aaa-auto.R
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ edges_impl <- function(
graph,
eids - 1
)

if (igraph_opt("return.vs.es")) {
res <- create_vs(graph, res)
}
res
}

Expand Down Expand Up @@ -2966,7 +2968,9 @@ topological_sorting_impl <- function(
graph,
mode
)

if (igraph_opt("return.vs.es")) {
res <- create_vs(graph, res)
}
res
}

Expand Down Expand Up @@ -6628,6 +6632,8 @@ write_graph_edgelist_impl <- function(
) {
# Argument checks
ensure_igraph(graph)
check_string(outstream)


on.exit(.Call(R_igraph_finalizer))
# Function call
Expand All @@ -6648,6 +6654,8 @@ write_graph_leda_impl <- function(
) {
# Argument checks
ensure_igraph(graph)
check_string(outstream)


on.exit(.Call(R_igraph_finalizer))
# Function call
Expand All @@ -6669,6 +6677,8 @@ write_graph_graphml_impl <- function(
) {
# Argument checks
ensure_igraph(graph)
check_string(outstream)

prefixattr <- as.logical(prefixattr)

on.exit(.Call(R_igraph_finalizer))
Expand All @@ -6689,6 +6699,8 @@ write_graph_pajek_impl <- function(
) {
# Argument checks
ensure_igraph(graph)
check_string(outstream)


on.exit(.Call(R_igraph_finalizer))
# Function call
Expand All @@ -6710,6 +6722,8 @@ write_graph_gml_impl <- function(
) {
# Argument checks
ensure_igraph(graph)
check_string(outstream)

options <- switch_igraph_arg(options, "default" = 0L, "encode_only_quot" = 1L)
id <- as.numeric(id)

Expand All @@ -6733,6 +6747,8 @@ write_graph_dot_impl <- function(
) {
# Argument checks
ensure_igraph(graph)
check_string(outstream)


on.exit(.Call(R_igraph_finalizer))
# Function call
Expand Down
35 changes: 9 additions & 26 deletions R/cliques.R
Original file line number Diff line number Diff line change
Expand Up @@ -548,33 +548,17 @@ ivs <- function(graph, min = NULL, max = NULL) {
#' @rdname ivs
#' @export
largest_ivs <- function(graph) {
ensure_igraph(graph)

on.exit(.Call(R_igraph_finalizer))
res <- .Call(Rx_igraph_largest_independent_vertex_sets, graph)
res <- lapply(res, `+`, 1)

if (igraph_opt("return.vs.es")) {
res <- lapply(res, unsafe_create_vs, graph = graph, verts = V(graph))
}

res
largest_independent_vertex_sets_impl(
graph = graph
)
}

#' @rdname ivs
#' @export
max_ivs <- function(graph) {
ensure_igraph(graph)

on.exit(.Call(R_igraph_finalizer))
res <- .Call(Rx_igraph_maximal_independent_vertex_sets, graph)
res <- lapply(res, `+`, 1)

if (igraph_opt("return.vs.es")) {
res <- lapply(res, unsafe_create_vs, graph = graph, verts = V(graph))
}

res
maximal_independent_vertex_sets_impl(
graph = graph
)
}

#' Maximal independent vertex sets in the graph
Expand All @@ -595,10 +579,9 @@ maximal_ivs <- function(graph) {
#' @rdname ivs
#' @export
ivs_size <- function(graph) {
ensure_igraph(graph)

on.exit(.Call(R_igraph_finalizer))
.Call(Rx_igraph_independence_number, graph)
independence_number_impl(
graph = graph
)
}

#' @rdname ivs
Expand Down
20 changes: 10 additions & 10 deletions R/cocitation.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@
#' bibcoupling(g)
#'
cocitation <- function(graph, v = V(graph)) {
ensure_igraph(graph)

v <- as_igraph_vs(graph, v)
on.exit(.Call(R_igraph_finalizer))
res <- .Call(Rx_igraph_cocitation, graph, v - 1)
res <- cocitation_impl(
graph = graph,
vids = v
)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
v <- as_igraph_vs(graph, v)
rownames(res) <- vertex_attr(graph, "name", v)
colnames(res) <- vertex_attr(graph, "name")
}
Expand All @@ -69,12 +69,12 @@ cocitation <- function(graph, v = V(graph)) {
#' @rdname cocitation
#' @export
bibcoupling <- function(graph, v = V(graph)) {
ensure_igraph(graph)

v <- as_igraph_vs(graph, v)
on.exit(.Call(R_igraph_finalizer))
res <- .Call(Rx_igraph_bibcoupling, graph, v - 1)
res <- bibcoupling_impl(
graph = graph,
vids = v
)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
v <- as_igraph_vs(graph, v)
rownames(res) <- vertex_attr(graph, "name", v)
colnames(res) <- vertex_attr(graph, "name")
}
Expand Down
6 changes: 3 additions & 3 deletions R/cohesive.blocks.R
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,9 @@ cohesive_blocks <- function(graph, labels = TRUE) {
# Argument checks
ensure_igraph(graph)

on.exit(.Call(R_igraph_finalizer))
# Function call
res <- .Call(Rx_igraph_cohesive_blocks, graph)
res <- cohesive_blocks_impl(
graph = graph
)
class(res) <- "cohesiveBlocks"
if (labels && "name" %in% vertex_attr_names(graph)) {
res$labels <- V(graph)$name
Expand Down
35 changes: 12 additions & 23 deletions R/flow.R
Original file line number Diff line number Diff line change
Expand Up @@ -411,18 +411,9 @@ min_cut <- function(

if (is.null(target) && is.null(source)) {
if (value.only) {
res <- .Call(Rx_igraph_mincut_value, graph, capacity)
res <- mincut_value_impl(graph = graph, capacity = capacity)
} else {
res <- .Call(Rx_igraph_mincut, graph, capacity)
res$cut <- res$cut + 1
res$partition1 <- res$partition1 + 1
res$partition2 <- res$partition2 + 1

if (igraph_opt("return.vs.es")) {
res$cut <- create_es(graph, res$cut)
res$partition1 <- create_vs(graph, res$partition1)
res$partition2 <- create_vs(graph, res$partition2)
}
res <- mincut_impl(graph = graph, capacity = capacity)
}
} else {
if (value.only) {
Expand Down Expand Up @@ -533,8 +524,7 @@ vertex_connectivity <- function(
ensure_igraph(graph)

if (is.null(source) && is.null(target)) {
on.exit(.Call(R_igraph_finalizer))
.Call(Rx_igraph_vertex_connectivity, graph, as.logical(checks))
vertex_connectivity_impl(graph = graph, checks = checks)
} else if (!is.null(source) && !is.null(target)) {
on.exit(.Call(R_igraph_finalizer))
.Call(
Expand Down Expand Up @@ -639,8 +629,7 @@ edge_connectivity <- function(
ensure_igraph(graph)

if (is.null(source) && is.null(target)) {
on.exit(.Call(R_igraph_finalizer))
.Call(Rx_igraph_edge_connectivity, graph, as.logical(checks))
edge_connectivity_impl(graph = graph, checks = checks)
} else if (!is.null(source) && !is.null(target)) {
on.exit(.Call(R_igraph_finalizer))
.Call(
Expand Down Expand Up @@ -693,20 +682,20 @@ vertex_disjoint_paths <- function(graph, source = NULL, target = NULL) {
#' @rdname edge_connectivity
#' @export
adhesion <- function(graph, checks = TRUE) {
ensure_igraph(graph)

on.exit(.Call(R_igraph_finalizer))
.Call(Rx_igraph_adhesion, graph, as.logical(checks))
adhesion_impl(
graph = graph,
checks = checks
)
}

#' @rdname vertex_connectivity
#' @method cohesion igraph
#' @export
cohesion.igraph <- function(x, checks = TRUE, ...) {
ensure_igraph(x)

on.exit(.Call(R_igraph_finalizer))
.Call(Rx_igraph_cohesion, x, as.logical(checks))
cohesion_impl(
graph = x,
checks = checks
)
}

#' List all (s,t)-cuts of a graph
Expand Down
Loading
Loading