[Top][All Lists]
[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: |
Tamas Nepusz |
Subject: |
Re: [igraph] how to select eid on the basis of an edge attribute |
Date: |
Wed, 21 Jan 2009 10:07:54 +0000 |
> 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] how to select eid on the basis of an edge attribute, Simone Gabbriellini, 2009/01/21
- Re: [igraph] how to select eid on the basis of an edge attribute,
Tamas Nepusz <=
- Re: [igraph] how to select eid on the basis of an edge attribute, Simone Gabbriellini, 2009/01/21
- Re: [igraph] how to select eid on the basis of an edge attribute, Tamas Nepusz, 2009/01/21
- Re: [igraph] how to select eid on the basis of an edge attribute, Simone Gabbriellini, 2009/01/22
- Re: [igraph] how to select eid on the basis of an edge attribute, Tamas Nepusz, 2009/01/22
- Re: [igraph] how to select eid on the basis of an edge attribute, Simone Gabbriellini, 2009/01/24
- Re: [igraph] how to select eid on the basis of an edge attribute, Tamas Nepusz, 2009/01/25