Search code examples
rcluster-analysisigraph

Extracting ground-truth clusters from stochastic block model generated using igraph


I generate a graph using sample_sbm with 100 nodes and 2 clusters and intra-cluster edge probability greater than inter-cluster edge probability. That is, I tell sample_sbm to generate a graph with two clusters by passing a 2-by-2 matrix into the pref.matrix parameter. My resulting graph looks like this:

Is there some way to recover the ground-truth clusters? It seems using cluster_leading_eigen works, but if I can recover the information used to generate the network in the first place, i.e., the exact membership, that would be best. I tried searching the documentation but had trouble finding what I needed. I'm working with larger networks with more clusters as well, so any way to recover this information efficiently would be fantastic!

Thank you!


Solution

  • Answered by Vincent Traag when I asked on the igraph forum. Based on the documentation for C and Python, it seems the clusters are assigned in consecutive order to the vertices.