igraph-help
[Top][All Lists]
Advanced

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

[igraph] Getting Shortest Paths with and without Edge Weights


From: Gokce Dilek
Subject: [igraph] Getting Shortest Paths with and without Edge Weights
Date: Wed, 20 Mar 2019 15:42:42 -0700

Hello,

I would like to ask a question about the "get_shortest_paths" function in python-igraph. Could you explain what is the impact of adding edge weights when calculating path lengths? I had a very interesting occurrence that I couldn't explain why:
Case 1: edge weights are nonzero (an attribute of edges)
Result: [[], [0, 1], [0, 2], [0, 1, 3]]
Case 2: edge weights are None
Result: [[0], [0, 1], [0, 2], [0, 1, 3]]
why does the first entry change like this?=O
My code is here:
clust = g1.clusters()
for c in clust:
   print("subgraph:")
   gcomponent=g1.subgraph(c)
   u=next(iter(gcomponent.vs))
paths=gcomponent.get_shortest_paths(u,to=None,weights=None,mode=ig.ALL,output="vpath")
   print(paths)
in which only the weights=None part is changed between the cases.
I would appreciate if you could provide meaning to this!

Thank you very much!


reply via email to

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