igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] Generating Dijkstra Shortest Path


From: Ronquillo, Edgar Nahum
Subject: [igraph] Generating Dijkstra Shortest Path
Date: Fri, 19 Jun 2015 18:12:14 +0000

Hello all,

I have been working on how to get the  shortest_paths_dijkstra. I am working in graphs with millions of nodes(vertices ) and edges. I have created a graph and added vertices and edges the following way:

 

G. add_vertex(vertex_name) where vertex_ name is a string of the name of the vertex.

G. add_edge(vertice1, vertice2, weight = some_float ) where vertice1 and vertice2 are edges of nodes(vertices) that I previously added with the G.add_vertex. Moreover, the some_float value is a float that represents the cost or weight for that given edge, in this case vertice1 to vertice2.

 

After populating my vertices and edges I call the function for Dijkstra the following way:

 

G.shortest_paths_dijkstra(vertice1, vertice2) where vertice1 and vertice2 represent the source and target, of course. I would like for this to return a list of vertex names of the shortest path using the weights/costs that I passed when I added the edges. Am I doing this correct? Do I have to pass anything else for the function to utilize the weights that I used when I added the edges?

 

When I call the function it does output a list of numbers, I am not sure exactly what it is though. I am assuming is the shortest path of the weights, however, I would like to print the shortest path of the vertex names I added previously. I hope this is understandable.

 

Any help would be greatly appreciated.

 

Thanks

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]