igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] how to select eid on the basis of an edge attribute


From: Simone Gabbriellini
Subject: Re: [igraph] how to select eid on the basis of an edge attribute
Date: Wed, 21 Jan 2009 14:58:13 +0100

thanks Tamas...

I suppose a similar workaround could be made also for finding the
"blue" neighbors of vertex 1...

or the "blue" neighbors of vertex 1 AND vertex 2 (this should be a
kind of transitivite neighorhood, am I right?)

best regards,
Simone

2009/1/21 Tamas Nepusz <address@hidden>:
>> is it possible to tell igraph to select the eid of the RED link between 1 
>> and 2?
> Well, the C core has igraph_get_eids which returns all the edge IDs
> between two vertices, but it's not in the Python interface yet
> (*blushes*). As a workaround, you could use the following:
>
> def get_eids(graph, v1, v2):
>  eids = set(g.adjacent(v1, type="out"))
>  eids.intersection_update(set(g.adjacent(v2, type="in")))
>  return list(eids)
>
> Now, you can call get_eids(your_graph, 1, 2) to get all the edge IDs
> between vertex 1 and 2. Your original question will then be solved as
> follows:
>
> for eid in get_eids(your_graph, 1, 2):
>  if g.es[eid]["color"] == "red":
>    print eid      # or do whatever you want
>
> --
> Tamas
>
>
>
>
> _______________________________________________
> 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]