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: Tamas Nepusz
Subject: Re: [igraph] how to iterate a vertex seq to find neighbors
Date: Mon, 22 Dec 2008 21:04:12 +0100

Hi Simone,


I am wondering how to use the neighbors function... I do:

g = igraph.Graph.Read_Pajek(filename)

for node in g.vs:
    vicinato = igraph.GraphBase.neighbors(node, type="IN")
Strangely enough, .neighbours() requires a vertex index and not a Vertex object, so this will work:

for node in g.vs:
  vicinato = g.neighbors(node.index, type="IN")

or this one:

for i in xrange(g.vcount()):
  vicinato = g.neighbors(i, type="IN")

--
T.





reply via email to

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