Skip to content

Commit

Permalink
check igraph compat at runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau committed Dec 3, 2024
1 parent 5bcc7e2 commit 6ed7ecb
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions R/utils_igraph.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@ targets_adjacent_vertices <- function(graph, v, mode) {
index <- igraph::adjacent_vertices(graph = graph, v = v, mode = mode)
index <- unlist(index, use.names = FALSE)
index <- unique(index)
igraph::V(graph)$name[index + igraph_version_offset]
if (is.null(igraph_version_offset$offset)) {
igraph_version_offset$offset <- as.integer(
utils::compareVersion(
a = as.character(packageVersion("igraph")),
b = "2.1.2"
) < 0L
)
}
igraph::V(graph)$name[index + igraph_version_offset$offset]
}

igraph_version_offset <- as.integer(
utils::compareVersion(
a = as.character(packageVersion("igraph")),
b = "2.1.2"
) < 0L
)
igraph_version_offset <- new.env(parent = emptyenv())

igraph_leaves <- function(igraph) {
is_leaf <- igraph::degree(igraph, mode = "in") == 0L
Expand Down

0 comments on commit 6ed7ecb

Please sign in to comment.