Discussion:
[igraph] Problem with cut_at to specify number of communities for leading eigenvector method
Qiwen Zheng
2017-07-26 02:44:29 UTC
Permalink
Hi all,

I used cluster_leading_eigen() to generate a community object, and then
used cut_at() in order to find the cluster assignment under specified
number of communities.

The cut_at() worked quite well when I use other algorithms like walktrap
and edgebetweenness in igraph. But for leading eigenvector method when I
use cut_at, and specify the number of community to be 10 (which is larger
than the optimal number of clusters the cluster_leading_eigen function
provides), it gives me a warning that

"In cut_at(tempLE, no = 10) : Cannot have that few communities".

Below please see my codes: Y is an adajacency matrix.



diag(Y)=0

n=dim(Y)[1]

g1=graph.adjacency(Y)

g2=as.undirected(g1)
tempLE=cluster_leading_eigen(g2)
cut_at(tempLE,no=10)

In my initial investigation, I found that the number of rows the
merges(tempLE) provides is only 3, while for walktrap or edgebetweenness
method, merges() yields an n by 2 matrix. I think the reason I have that
warning is because merges(tempLE) has too few rows, but I don't know why?

Since leading eigenvector is a hiearchical method, the cut_at function
should work for it. Anyone has any thoughts on it?

Thanks,
Qiwen

Loading...