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: Sat, 24 Jan 2009 17:39:25 +0100

Hi Tamas,

with my second question I was arguing - probably in a bad english -
how to find the adiacent vertex of v1 connected with v1 by blue
links...

I guess this can work:

friend=[]
nei_edges = g.adjacent(v1, type="in")
for nei_edge in nei_edges:
   if g.es[nei_edge]["color"] == "blue":
        friend.append(g.es[nei_edge].tuple[0])

cheers,
Simone

2009/1/22 Tamas Nepusz <address@hidden>:
> Hi Simone,
>
>> Could this be the a good strategy?
>>
>> 1) find all the neighbors of v1:
>>
>> 2) for each neighbor in the list:
>>
>> 3) check if they are blue-linked with v1 (using get_eids()):
>
> Yup, but since you will be checking the _edges_ adjacent to v1, you should
> find the adjacent edges in step 1 instead of the neighbours. So:
>
> nei_edges = g.adjacent(v1)
> for nei_edge in nei_edges:
>  if g.es[nei_edge]["color"] == "blue":
>    # do this
>  else:
>    # do that
>
> --
> 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]