Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Counting paths in directed graph with multiedges

I would like to could paths in a directed graph with multiedges, where taking a different edge between a given pair of vertices is counted as a new path. For example:

A = DiGraph(multiedges=True)
A.add_edge(1,2,'a')
A.add_edge(1,2,'b')
A.add_edge(2,3,'c')
A.graphplot(edge_labels=True).show()
A.all_paths(1,3)

returns [[1,2,3]]. I would like to have it return 2 paths, ideally listed by the edges instead of the vertices, e.g. [a,c] and [b,c]. Any recommendations?