Stack Overflow!
I have a directed graph and need to find all paths between a source and target vertex. Between several vertices, there are multiple edges. Using graph-tool, one may suggest using graph_tool.topology.all_paths(g, source, target)
, however, the lists contained in this vertex iterator are for vertices only; see some of the output below. Due to there being multiple edges between vertices, there are multiple occurrences of paths such as [ 0 4 8 13]
and [0 4 13]
and I am not able to distinguish between these paths.
iterator, paths: [ 0 4 8 13]
iterator, paths: [ 0 4 13]
iterator, paths: [ 0 4 8 13]
iterator, paths: [ 0 4 13]
iterator, paths: [ 0 4 8 13]
iterator, paths: [ 0 4 13]
I need the paths in the form of edges, to be able to iterate over edge properties along each path. To solve this issue, I can only think of one method (apart from rewriting large amounts of code): creation of intermediary vertices to avoid occurrences of multiple edges between any two vertices. For any parallel edges between two vertices, they would be connected to each their own, unique intermediary vertex as to uniquely define the paths returned from graph_tool.topology.all_paths(g, source, target)
.
Is there a way to return all paths in the form of edges between a source and destination vertex?