igraph-help
[Top][All Lists]
Advanced

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

[igraph] Retrieving edges weight


From: elastica
Subject: [igraph] Retrieving edges weight
Date: Sat, 24 Nov 2018 13:39:51 +0100 (CET)

Hi 

I'm using igraph with the Python 3 interface. 

I'm calling Prim algorithm like this : 

#-----------------------------------
from igraph import Graph

edges=[(0, 1), (0, 2), (1, 2), (1, 3), (3, 4), (4, 5), (5, 2), (2, 3)]
weights=[3, 1, 1, 2, 4, 3, 2, 2]
n=6

g = Graph(n, edges=edges)
g.es["weight"] = weights

tree=g.spanning_tree(weights)
print(tree.get_edgelist())
#-----------------------------------

but now I cannot retrieve edges weight from the tree. More generally, how do I 
get an edge attribute from a given graph ? I was expecting Graph interface to 
have an edges attribute. 
I only have a list of edges (given by a get_edgelist() method above and this 
returns tuple, not an edge object).

Thanks





reply via email to

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