Describe the bug
The bfs() and dfs() functions produce a 'father' vector that contains NA for the root. This is in fact not a vector, but an igraph.vs, where it is reasonable to expect that all values are proper vertex IDs and not NA. As a result, there will be problems when trying to use this result.
This is closely related to #186. Perhaps the same fix should be applied as there. While this will be a breaking change, the father results appears to be unusable at the moment, as the NAs are basically guaranteed to trigger an error (unless I'm missing something about how to work with NA).
To reproduce
g <- sample_gnm(10,20)
res <- bfs(g,1,father=T)$father
> str(res)
Error in simple_vs_index(x, ii, na_ok) : Unknown vertex selected
> res[1]
Error in simple_vs_index(x, args[[1]]$expr) : Unknown vertex selected
I am not sure how to even test whether a certain element or NA, which is what originally prevented me from being able to come up with a nice solution for the Strahler number computation here.
Version information
1.3.0, but also earlier.
Describe the bug
The
bfs()anddfs()functions produce a 'father' vector that containsNAfor the root. This is in fact not a vector, but anigraph.vs, where it is reasonable to expect that all values are proper vertex IDs and notNA. As a result, there will be problems when trying to use this result.This is closely related to #186. Perhaps the same fix should be applied as there. While this will be a breaking change, the
fatherresults appears to be unusable at the moment, as theNAs are basically guaranteed to trigger an error (unless I'm missing something about how to work withNA).To reproduce
I am not sure how to even test whether a certain element or
NA, which is what originally prevented me from being able to come up with a nice solution for the Strahler number computation here.Version information
1.3.0, but also earlier.