[Top][All Lists]

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

[igraph] shortest path with vertex weights

From: Arjun Krishnan
Subject: [igraph] shortest path with vertex weights
Date: Mon, 23 Oct 2017 18:46:02 -0400


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?

reply via email to

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