I can create a very simple graph using python-igraph...
import igraph
g=igraph.Graph.TupleList([("a", "b", 3.0), ("c", "d", 4.0), ("a", "c", 5.0)], weights=True)
print( igraph.summary(g, full=True) )
which looks like this:
IGRAPH UNW- 4 3 --
+ attr: name (v), weight (e)
+ edges (vertex names):
edge weight
[0] a--b 3
[1] c--d 4
[2] a--c 5
Finding the shortest path is easy!
source = g.vs[0] // vertex "a"
target = g.vs[len(g.vs)-1] // vertex "d"
g.shortest_paths(source=source, target=target, weights='weight')
which prints the result:
[[9.0]]
I am happy that the edge weight of the shortest path is 9.0. However, I would like to obtain the actual vertices and edges that make up the shortest path of the graph. It would be nice to get an object that looks like this:
shortestPath = [("a", "c", 5.0), ("c", "d", 4.0)]
Can python-igraph provide this to me? I have searched the documentation with no luck...