Open loreabad6 opened 3 years ago
I think it could also be an option to return the nodes and edges arranged in the order they are visited. Since the .tidygraph_node_index
and .tidygraph_edge_index
already map them to their original position, so you don't loose that information when you arrange them in a different order.
Is your feature request related to a problem? Please describe.
The to_spatial_shortest_path morpher is really usefull when obtaining shortest paths in a network format. Internally, what it does is computing the shortest path with
st_network_paths()
and subsets the network according to the resulting node and edge indices.However, the result does not give the actual path to get from A to B. The order of the paths is not implicitely included in the resulting network, contrary to the result of
st_network_paths()
that includes an ordered vector.Describe the solution you’d like It would be nice if there was an extra column
path_order
on the nodes and/or edges that indicates the order in which each node is visited or each path is passed.Then a user could
arrange()
the network based on this column, and view which nodes are visited.