I'm trying to find a fixed number of communities in a fully connected graph with weighted edges.

How to do community detection in a weighted social network/graph? suggests the use of iGraph's fastgreeedy function for community detection.

I have a graph with vertices as people and edge weights as the similarity between the vertices.

I'm new to graph theory so I'm not sure if this is correct but I'm in a way trying to achieve max-sum k-clustering.


This post discusses two possible igraph community functions that allow you to set a specific number of communities:


Quoting from Jim Leach:

You can use either the cluster_spinglass() function and set spins to be the number of communities desired. Or use one of the hierarchical methods and then use cut_at() to get the desired number of communities, using the no argument to specify how many communities you want. [....] Note that the spinglass method will give you back a communities object, whereas the cut_at method simply gives you back the community indices for all nodes in the graph (i.e. a simple numeric vector).

However, unless there is a specific network metric that you want to inform the formation of your communities, you might just want to use a normal k-means clustering algorithm directly on the weight adjacency matrix, something like this:



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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