Skip to content

Commit

Permalink
igraph 2.1.2 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed Dec 3, 2024
1 parent 4573b96 commit 0ecde21
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion R/igraph.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,19 @@ drake_adjacent_vertices <- function(graph, v, mode) {
index <- adjacent_vertices(graph = graph, v = v, mode = mode)
index <- unlist(index, use.names = FALSE)
index <- unique(index)
igraph::V(graph)$name[index + 1]
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 <- new.env(parent = emptyenv())

subset_graph <- function(graph, subset) {
if (!length(subset)) {
return(igraph::make_empty_graph())
Expand Down

0 comments on commit 0ecde21

Please sign in to comment.