Discussion:
[igraph] shortest path with vertex weights
Arjun Krishnan
2017-10-23 22:46:02 UTC
Permalink
Hi,

I'm trying to use igraph to run a shortest path algorithm using
g.shortest_path_dijkstra but with vertex weights. I have a list of random
weights wt and a graph g. I'm doing this by making edge weights the same if
they have the same source vertex.

Then I use something like this

for x in g.vs:
vwt = wt.pop() # get a weight for a vertex
for y in g.es.select(_source=x.index):
y["weight"] = vwt


This takes a long time to run even in a graph with like 10000 vertices.
Perhaps the g.es.select() function is very slow? Is there a faster way to
assign edge weights to a graph?

Loading...