Skip to content

Commit 4cd4e64

Browse files
authored
Add backwards compatibility for igraph subgraph (#59)
1 parent a8448d8 commit 4cd4e64

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: checked
22
Title: Systematically Run R CMD Checks
3-
Version: 0.2.8
3+
Version: 0.2.8.9000
44
Authors@R:
55
c(
66
person(

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# checked (devel)
2+
3+
* Add `igraph_subgraph_from_edges` wrapper to used work around deprecation
4+
messages and alternate between `igraph::subgraph.edges` and
5+
`igraph::subgraph_from_edges` depending on the `igraph` version.
6+
17
# checked 0.2.8
28

39
* Unify notes, warnings and errors are internally stored when generating

R/task_graph.R

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ task_graph_sort <- function(g) {
211211

212212
# use only strong dependencies to prioritize by topology (leafs first)
213213
strong_edges <- igraph::E(g)[igraph::E(g)$type %in% DEP_STRONG]
214-
g_strong <- igraph::subgraph_from_edges(g, strong_edges, delete.vertices = FALSE)
214+
g_strong <- igraph_subgraph_from_edges(g, strong_edges, delete.vertices = FALSE)
215215
topo <- igraph::topo_sort(g_strong, mode = "in")
216216
priority_topo <- integer(length(g))
217217
priority_topo[match(topo$name, igraph::V(g)$name)] <- rev(seq_along(topo))
@@ -418,3 +418,10 @@ is_package_satisfied <- function(v, lib.loc) { # nolint object_name_linter
418418
}
419419
}
420420

421+
igraph_subgraph_from_edges <- function(...) {
422+
if (packageVersion("igraph") < "2.1.0") {
423+
igraph::subgraph.edges(...)
424+
} else {
425+
igraph::subgraph_from_edges(...)
426+
}
427+
}

0 commit comments

Comments
 (0)