Closed loreabad6 closed 3 years ago
Describe the bug In case of an empty graph, the print method throws an error when trying to access the spatial data.
Reproducible example
library(sfnetworks) library(sf) library(tidygraph) net = as_sfnetwork(roxel, directed = FALSE) %>% st_transform(3035) net %>% convert(to_spatial_shortest_paths, 117, 190) #> Warning in (function (graph, from, to = V(graph), mode = c("out", "all", : At #> structural_properties.c:745 :Couldn't reach some vertices #> # An sfnetwork with 0 nodes and 0 edges #> # #> # CRS: EPSG:3035 #> # #> # An empty graph with spatially explicit edges #> # #> Error in geom[[1]]: subscript out of bounds
Expected behavior Print should ignore network elements for empty graph.
Fixed on develop!
Describe the bug In case of an empty graph, the print method throws an error when trying to access the spatial data.
Reproducible example
Expected behavior Print should ignore network elements for empty graph.