Skip to content

Commit 4832488

Browse files
committed
test igraph behavior
1 parent 555e37b commit 4832488

File tree

3 files changed

+24
-19
lines changed

3 files changed

+24
-19
lines changed

R/igraph.R

+20-9
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,29 @@ 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-
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-
)
69+
igraph::V(graph)$name[index + get_igraph_offset()]
70+
}
71+
72+
get_igraph_offset <- function() {
73+
if (!is.null(igraph_offset$offset)) {
74+
return(igraph_offset$offset)
7675
}
77-
igraph::V(graph)$name[index + igraph_version_offset$offset]
76+
opt <- igraph::igraph_opt("return.vs.es")
77+
on.exit(igraph::igraph_options(return.vs.es = opt))
78+
igraph::igraph_options(return.vs.es = FALSE)
79+
test_graph <- igraph::make_graph(edges = c("a", "b"))
80+
adjacent <- igraph::adjacent_vertices(
81+
graph = test_graph,
82+
v = "a",
83+
mode = "out"
84+
)
85+
adjacent <- as.integer(adjacent)
86+
offset <- 2L - adjacent
87+
igraph_offset$offset <- offset
88+
offset
7889
}
7990

80-
igraph_version_offset <- new.env(parent = emptyenv())
91+
igraph_offset <- new.env(parent = emptyenv())
8192

8293
subset_graph <- function(graph, subset) {
8394
if (!length(subset)) {

README.Rmd

+2-5
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ Development
7373
<td align="left">
7474
<a href="https://github.com/ropensci/software-review/issues/156"><img src="https://badges.ropensci.org/156_status.svg" alt="rOpenSci"></a>
7575
</td>
76-
<td align="left">
77-
<a href="https://codecov.io/github/ropensci/drake?branch=main"><img src="https://codecov.io/github/ropensci/drake/coverage.svg?branch=main" alt="Codecov"></a>
78-
</td>
7976
</tr>
8077
<tr class="even">
8178
<td align="left">
@@ -361,7 +358,7 @@ make(plan, parallelism = "clustermq", jobs = 4)
361358
- [`drake-gitlab-docker-example`](https://gitlab.com/ecohealthalliance/drake-gitlab-docker-example): A small pedagogical example workflow that leverages `drake`, Docker, GitLab, and continuous integration in a reproducible analysis pipeline. Created by [Noam Ross](https://www.noamross.net/).
362359
- [`pleurosoriopsis`](https://github.com/joelnitta/pleurosoriopsis): The workflow that supports [Ebihara *et al.* 2019. "Growth Dynamics of the Independent Gametophytes of *Pleurorosiopsis makinoi* (Polypodiaceae)" *Bulletin of the National Science Museum Series B (Botany)* 45:77-86.](https://www.kahaku.go.jp/research/publication/botany.html). Created by [Joel Nitta](https://github.com/joelnitta).
363360

364-
Alternatively, it is possible to run `drake` outside Docker and use the [`future`](https://github.com/HenrikBengtsson/future) package to send targets to a Docker image. `drake`'s [`Docker-psock`](https://github.com/wlandau/drake-examples/tree/main/Docker-psock) example demonstrates how. Download the code with `drake_example("Docker-psock")`.
361+
Alternatively, it is possible to run `drake` outside Docker and use the [`future`](https://github.com/futureverse/future) package to send targets to a Docker image. `drake`'s [`Docker-psock`](https://github.com/wlandau/drake-examples/tree/main/Docker-psock) example demonstrates how. Download the code with `drake_example("Docker-psock")`.
365362

366363
# Installation
367364

@@ -534,7 +531,7 @@ Many thanks to [Julia Lowndes](https://github.com/jules32), [Ben Marwick](https:
534531
- [Eric Nantz](https://github.com/rpodcast)
535532
- [Henrik Bengtsson](https://github.com/HenrikBengtsson)
536533
- [Ian Watson](https://github.com/IanAWatson)
537-
- [Jasper Clarkberg](https://github.com/dapperjapper)
534+
- Jasper Clarkberg
538535
- [Kendon Bell](https://github.com/kendonB)
539536
- [Kirill M&uuml;ller](https://github.com/krlmlr)
540537
- [Michael Schubert](https://github.com/mschubert)

README.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ Development
4848
<td align="left">
4949
<a href="https://github.com/ropensci/software-review/issues/156"><img src="https://badges.ropensci.org/156_status.svg" alt="rOpenSci"></a>
5050
</td>
51-
<td align="left">
52-
<a href="https://codecov.io/github/ropensci/drake?branch=main"><img src="https://codecov.io/github/ropensci/drake/coverage.svg?branch=main" alt="Codecov"></a>
53-
</td>
5451
</tr>
5552
<tr class="even">
5653
<td align="left">
@@ -492,7 +489,7 @@ examples that run `drake` inside a Docker image.
492489
Created by [Joel Nitta](https://github.com/joelnitta).
493490

494491
Alternatively, it is possible to run `drake` outside Docker and use the
495-
[`future`](https://github.com/HenrikBengtsson/future) package to send
492+
[`future`](https://github.com/futureverse/future) package to send
496493
targets to a Docker image. `drake`’s
497494
[`Docker-psock`](https://github.com/wlandau/drake-examples/tree/main/Docker-psock)
498495
example demonstrates how. Download the code with
@@ -864,7 +861,7 @@ early in development.
864861
- [Eric Nantz](https://github.com/rpodcast)
865862
- [Henrik Bengtsson](https://github.com/HenrikBengtsson)
866863
- [Ian Watson](https://github.com/IanAWatson)
867-
- [Jasper Clarkberg](https://github.com/dapperjapper)
864+
- Jasper Clarkberg
868865
- [Kendon Bell](https://github.com/kendonB)
869866
- [Kirill Müller](https://github.com/krlmlr)
870867
- [Michael Schubert](https://github.com/mschubert)

0 commit comments

Comments
 (0)