How is all_shortest_paths defined?

When I however run all_shortest_paths(g,source,target) this path is
not part of the results set. Why is that?

The function finds all _shortest_ paths, not all paths. Are you sure the
known path belong to the shortest set?

Finally, is it possible to also obtain an edge descriptor as a result?
Currently I think the documentation states that the result is an
iterator over the sequence of vertices from source to target.

You can get the edge between any two vertices u and v by calling the
Graph.edge(u, v) function.

Best,
Tiago

The known path is three steps long (i.e. contains four vertices) while the paths returned by all_shortest_paths are only two steps long. Is there any way of extending the cut off criterion for all_shortest_paths so that it would return the known path too?

My problem with the graph.edge(u,v) function for me in this case is the fact that in many cases I have multiple edges connecting two given vertices. Each edge has a unique ID allowing me to link it back to an entry in an external database. Though it is of interest to me which vertices lie along the path when I run all_shortest_paths what I really am after are the IDs associated to the edges along the path. It seems to me as if graph.edge(u,v) only returns one edge when called. So when I have twenty edges that each link u and v I am not sure yet how I can access the other edges to obtain their IDs. I could presumably note down the edge and then delete it and then rerun graph.edge but that probably is not the most ideal way.

Best,

Philipp

1 Like