[Top][All Lists]

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

[igraph] Selecting edges by _source and _target in an undirected graph

From: Santiago Videla
Subject: [igraph] Selecting edges by _source and _target in an undirected graph
Date: Wed, 6 May 2015 18:57:41 -0300


Using igraph-python, I found something which as far as I understand, it doesn't match the documentation:

In [1]: import igraph as ig

In [2]: g = ig.Graph(3, [(0,1), (2,0)], directed=False)

In [3]: len(g.es.select(_source=0))

Out[3]: 2

In [4]: len(g.es.select(_target=0))

Out[4]: 0

Shouldn't g.es.select(_target=0) return 2 edges as well?

In fact, in the tutorial (http://igraph.org/python/doc/tutorial/tutorial.html#querying-vertices-and-edges-based-on-attributes) it says:

There are also a few special structural properties for selecting edges:

Using _source or _from in the keyword argument list of EdgeSeq.select() filters based on the source vertices of the edges. E.g., to select all the edges originating from Claire (who has vertex index 2):

>>> g.es.select(_source=2)

Using _target or _to filters based on the target vertices. This is different from _source and _from if the graph is directed.

I understand that for an undirected graph, it should hold::

g.es.select(_source=vid) == g.es.select(_target=vid)

or not?



reply via email to

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