Skip to content

Commit 0ecde21

Browse files
committed
igraph 2.1.2 compatibility
1 parent 4573b96 commit 0ecde21

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

R/igraph.R

+11-1
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,19 @@ drake_adjacent_vertices <- function(graph, v, mode) {
6666
index <- adjacent_vertices(graph = graph, v = v, mode = mode)
6767
index <- unlist(index, use.names = FALSE)
6868
index <- unique(index)
69-
igraph::V(graph)$name[index + 1]
69+
if (is.null(igraph_version_offset$offset)) {
70+
igraph_version_offset$offset <- as.integer(
71+
utils::compareVersion(
72+
a = as.character(packageVersion("igraph")),
73+
b = "2.1.2"
74+
) < 0L
75+
)
76+
}
77+
igraph::V(graph)$name[index + igraph_version_offset$offset]
7078
}
7179

80+
igraph_version_offset <- new.env(parent = emptyenv())
81+
7282
subset_graph <- function(graph, subset) {
7383
if (!length(subset)) {
7484
return(igraph::make_empty_graph())

0 commit comments

Comments
 (0)