Skip to content

Commit c1aacf8

Browse files
committed
igraph dfs may signal unreachable nodes with 0
* this still seems to be up in the air but at least some preparatory branches for igraph 2.0 use a 0 rather than NaN to signal unreachable nodes * see #517
1 parent 735628d commit c1aacf8

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

R/neuron.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1419,7 +1419,8 @@ distal_to <- function(x, node.idx=NULL, node.pointno=NULL, root.idx=NULL,
14191419

14201420
dfs_traversal <- function(x, g) {
14211421
gdfs=igraph::dfs(g, root = x, unreachable = FALSE)
1422-
as.integer(gdfs$order)[!is.na(gdfs$order)]
1422+
# nb igraph 2.0 may change signalling for unreached nodes
1423+
as.integer(gdfs$order)[!(is.na(gdfs$order) | gdfs$order<1)]
14231424
}
14241425

14251426

R/ngraph.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,8 @@ prune_vertices<-function(x, verticestoprune, invert=FALSE, ...) {
539539
if(invert) {
540540
nvertices=igraph::vcount(g)
541541
verticestoprune=setdiff(seq_len(nvertices), verticestoprune)
542+
} else {
543+
verticestoprune=setdiff(verticestoprune, 0)
542544
}
543545
dg=igraph::delete_vertices(g, verticestoprune)
544546
# delete_vertices will return an igraph

0 commit comments

Comments
 (0)