I am new to Community Detection and to make things harder I am also a beginner in R - please keep this in mind when you kindly answer. I am happy to add my data to this post if anyone could tell me how to achieve that please?
First Problem
I created a directed graph with 2198 nodes and 1380771 edges with weights (weights are contained in mylinks):
library(igraph)
net <- graph_from_data_frame(d=mylinks, vertices=mynodes, directed=T)
I then use the walktrap algorithm to create communities:
com <- walktrap.community(net, weights = E(net)$weight, steps = 4, merges =
TRUE, modularity = TRUE)
Walktrap splits the graph into 10 communities and gives me a modularity score of 0.4819893 (which I think is quite good):
length(com) # number of communities: 10
modularity(com) # how modular the graph partitioning is
I can plot a dendrogram with the 10 communities on top:
dendrogram <- dendPlot(com, mode="hclust")
Now my question: I need access to the modularity scores and memberships for all levels, not just the best cut level with 10 communities. So basically I want to be able to cut my dendrogram at each level and calculate the modularity as well as get the membership. How do I do this best please? I am after something like this:
- Level Modularity
- 1 ?
- 2 ?
- 3 ?
- ... ...
- 10 0.4819893
- ... ...
This list should include as many levels as the graph has nodes. Then in addition there should be something which shows me the membership for each level.
Second Problem
The second problem I have is to visualize this graph, as it contains so many nodes and edges that one can't really see anything:
com_plot <- plot(com, net)
Plotted graph with communities:
I would be glad for any ideas and solutions on this front.
Thank you for reading all this!