[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[igraph] count neighbourhood (python)
From: |
Raphael Clifford |
Subject: |
[igraph] count neighbourhood (python) |
Date: |
Sat, 15 Sep 2012 09:21:13 +0100 |
I would like to count the number of vertices within a 2 hop distance
of each node in a large sparse graph. I see there is a function which
one could call with neighborhood size(vertices=g.vs, order=2). What
method is used to do the calculation?
A classic way to do it would be to represent the graph as a sparse
matrix, square it using a clever sparse matrix multiplication
algorithm and count the number of elements in each row that are
non-negative. I am wondering how this would compare to the
implemented method in igraph. Can igraph make a sparse matrix that
could be fed directly into
http://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.html#scipy.sparse.csr_matrix
for example?
Raphael
- [igraph] count neighbourhood (python),
Raphael Clifford <=