You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are several surprising elements with the documentation of bfs output.
The root for example does not return all the indices used. father, pred and succ elements of the output are not a "Numeric vector." (related to #522)
In addition, I have found that if multiple roots are provided they might not be used or are not reported to be of dist == 0 (see last lines of the example). I think this comes from the C library.
To reproduce
library("igraph")
#> #> Attaching package: 'igraph'#> The following objects are masked from 'package:stats':#> #> decompose, spectrum#> The following object is masked from 'package:base':#> #> union
packageVersion("igraph")
#> [1] '2.1.2'g<- make_ring(10) %du% make_ring(10)
roots<- c(1, 5, 15)
out<- bfs(g, root=roots, father=TRUE, succ=TRUE, pred=TRUE,
rank=TRUE, unreachable=FALSE, dist=TRUE)
out$root#> [1] 1
is(out$father)
#> [1] "igraph.vs"
is(out$pred)
#> [1] "igraph.vs"
is(out$succ)
#> [1] "igraph.vs"out$dist[roots]
#> [1] 0 4 0
stopifnot("Roots doesn't match those provided"= sum(out$dist==0L) == length(roots))
#> Error: Roots doesn't match those provided
What happens, and what did you expect instead?
There are several surprising elements with the documentation of
bfs
output.The root for example does not return all the indices used.
father
,pred
andsucc
elements of the output are not a "Numeric vector." (related to #522)In addition, I have found that if multiple roots are provided they might not be used or are not reported to be of dist == 0 (see last lines of the example). I think this comes from the C library.
To reproduce
Created on 2024-12-25 with reprex v2.1.1
System information
Ubuntu 24.04, R from
rig add R-4.4.2
(+ igraph compiled locally), session:The text was updated successfully, but these errors were encountered: