[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] On walktrap clustering and isolated vertices
From: |
Tamás Nepusz |
Subject: |
Re: [igraph] On walktrap clustering and isolated vertices |
Date: |
Tue, 27 May 2014 22:54:03 +0200 |
> I'm a bit confused. I tried this on an empty graph with ten vertices, and
> it puts all of the vertices in the same cluster.
No, it completes the dendrogram first, and then when you convert it to a flat
clustering using the .as_clustering() method, it tries to decide where to "cut"
the dendrogram by looking at the modularity scores of the clusterings after 1,
2, ..., n merges. Since the modularity score is zero in your case for all
possible cuts, it will arbitrarily choose one (depending on how I wrote the
.as_clustering() method ;)), and it looks like it decides to stop after all the
merges have been performed.
> Similarly, if I have a K_9 with a single isolated vertex, I also get one big
> cluster.
Interestingly enough, the algorithm is not incorrect here either. If you put
every single node into one big cluster, you get a modularity of zero. If you
put the 9 nodes in the K_9 part into one cluster and the isolated vertex into
another, you still get a modularity of zero. However, any other configuration
during the merges performed by the walktrap clustering algorithm yields a
negative modularity score.
> Printing the dendrogram after running it through the
> fixing function still causes an exception, though now it looks like a
> Python 3 compatibility issue
Yes, it is -- I'll try to fix that ASAP.
Actually, there's still one issue with the fix_dendrogram function but you may
have figured that out already; the following statement is missing from the end:
cl._nitems = graph.vcount()
--
T.