[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] <DKIM> Re: Retrieving edges weight
From: |
elastica |
Subject: |
Re: [igraph] <DKIM> Re: Retrieving edges weight |
Date: |
Sat, 24 Nov 2018 17:11:29 +0100 (CET) |
I get it now, thanks Tamas !
----- Mail original -----
De: "Tamas Nepusz" <address@hidden>
À: "Help for igraph users" <address@hidden>
Envoyé: Samedi 24 Novembre 2018 16:21:06
Objet: <DKIM> Re: [igraph] Retrieving edges weight
> 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).
Internally, the edges are identified by integers from 0 to M-1, where
M is the number of edges. If you only have the two endpoints of an
edge, you need to use get_eid() to get the numeric ID, then you can
use that to index into g.es["weight"]:
>>> edge_indices = [g.get_eid(*pair) for pair in tree.get_edgelist()]
>>> print(g.es[edge_indices]["weight"])
[1, 1, 2, 3, 2]
T.
_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help