Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm looking for an efficient algorithm to find clusters on a large graph (It has approximately 5000 vertices and 10000 edges).

So far I am using the Girvan–Newman algorithm implemented in the JUNG java library but it is quite slow when I try to remove a lot of edges.

Can you suggest me a better alternative for large graphs?

share|improve this question
    
Have you looked at k-means? –  Oded Jan 19 '12 at 9:54
    
Can you please give me some reference to learn about how to use it on a graph? –  mariosangiorgio Jan 19 '12 at 9:59
    
    
I switched to the JUNG implementation of the VoltageClusterer and it is definitely fast. jung.sourceforge.net/doc/api/edu/uci/ics/jung/algorithms/… –  mariosangiorgio Jan 19 '12 at 11:25
1  
Isn't this more appropriated for <cs.stackexchange.com>; since it is more about computer science than software engineer? –  Oeufcoque Penteano Apr 11 '12 at 5:04

3 Answers 3

I personally suggest Markov clustering. I have used it several times in the past with good results.

Affinity propagation is another viable option, but it seems less consistent than Markov clustering.

There are various other options, but these two are good out of the box and well suited to the specific problem of clustering graphs (which you can view as sparse matrices). The distance measure you are using is also a consideration. Your life will be easier if you are using a proper metric.

I found this paper while looking for performance benchmarks, it is a good survey of the subject.

share|improve this answer
    
Thanks, I'll have a look at all the algorithms you suggested. –  mariosangiorgio Jan 19 '12 at 22:46
    
Correction: these algorithms need as input weights that reflect similarity, not distance. The metric property (triangle inequality) does not come into it. It can be useful to transform weights so they fall in a natural range, e.g. for (Pearson) correlations as described here (micans.org/mcl/man/clmprotocols.html#array), and for BLAST E-values as described here (micans.org/mcl/man/clmprotocols.html#blast). –  micans Sep 24 '13 at 10:14

Hierarchial Clustering

This was recommended to me by a friend. According to Wikipedia:

In this method one defines a similarity measure quantifying some (usually topological) type of similarity between node pairs. Commonly used measures include the cosine similarity, the Jaccard index, and the Hamming distance between rows of the adjacency matrix. Then one groups similar nodes into communities according to this measure. There are several common schemes for performing the grouping, the two simplest being single-linkage clustering, in which two groups are considered separate communities if and only if all pairs of nodes in different groups have similarity lower than a given threshold, and complete linkage clustering, in which all nodes within every group have similarity greater than threshold.

Markov Cluster

This is what I use in your situation. It is a very useful algorithm. I found a link to a nice PDF about the Algorithm. It's a great algorithm, and it is, for lack of a better term, extremely "powerful". Try it out and see.

share|improve this answer

For your problem here, I think you should think of a way to map vertices-edges to a set of coordinates for each vertex. I am not sure if there is a better way to do this. But, I think you could start off by representing each vertex as a dimension and then, the edge value to a particular vertex would become the value you need to work with for that particular dimension. After that you could do a simple Euclid distance and work with that.

share|improve this answer
    
After reading up a bit, I found this, here and I think you should have a look. –  viki.omega9 Jan 19 '12 at 10:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.