igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] how to iterate a vertex seq to find neighbors


From: Simone Gabbriellini
Subject: Re: [igraph] how to iterate a vertex seq to find neighbors
Date: Tue, 23 Dec 2008 18:57:02 +0100

yes, this is what where in my mind!!!

btw, I see that get_eid(v1, v2) interprets v1 as the target node and
v2 as the source node in a directed graph... is it intentional?

thanks again,
simone

2008/12/23 Tamas Nepusz <address@hidden>:
>> I am a bit confused... "weight" is an attribute of the edge, not of
>> the vertex...
>
> Sorry, I misunderstood your question. You can use g.get_eid(mynode,
> myneighbor) to get the ID of an edge connecting mynode and myneighbour:
>
> g.es[g.get_eid(mynode, myneighbor)]["weight"]
>
> Alternatively, you can get all the weights and the node-neighbour pairs in
> advance into a dict and then use that dict to look up the weight:
>
> weight_dict = dict(zip(g.get_edgelist(), g.es["weight"]))
>
> weight_dict[mynode, myneighbour] will then give you the weight of the
> corresponding edge.
>
> --
> T.
>
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>




reply via email to

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