Get startedGet started for free

Comparing community algorithms

There are many ways that you can find a community in a graph (you can read more about them here). Unfortunately, different community detection algorithms will give different results, and the best algorithm to choose depends on some of the properties of your graph Yang et. al..

You can compare the resulting communities usingcompare(). This returns a score ("the variance in information"), which counts whether or not any two vertices are members of the same community. A lower score means that the two community structures are more similar.

You can see if two vertices are in the same community using membership(). If the vertices have the same membership number, then they are in the same community.

This exercise is part of the course

Case Studies: Network Analysis in R

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Make retweet_graph undirected
retweet_graph_undir <- as_undirected(___)

# Find communities with fast greedy clustering
communities_fast_greedy <- (___

# Find communities with infomap clustering
communities_infomap <- ___

# Find communities with louvain clustering
communities_louvain <- ___
Edit and Run Code