[Top][All Lists]

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

[igraph] Re: graph.knn in python

From: Simone Gabbriellini
Subject: [igraph] Re: graph.knn in python
Date: Mon, 7 Feb 2011 16:07:18 +0100

can this be considered a valid substitute of the knn function?

vs = g.vs()
vcount = g.vcount()
neisets = [set(g.neighbors(i)) for i in xrange(vcount)]
deg = [g.degree(i) for i in xrange(vcount)]
for u in vs:
        neiavedeg = []
        for v in neisets[u.index]:
        u["neideg"] = (sum(neiavedeg) / float(len(neiavedeg)) if len(neiavedeg) 
> 0 else 0)


Il giorno 07/feb/2011, alle ore 11.20, Simone Gabbriellini ha scritto:

> Hello List,
> is there any graph.knn() function in the python 0.6? Or any hint on how to 
> implement it in python?
> best,
> Simone

reply via email to

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