Visualizing the communities
Now that we've found communities, we'll visualize our results. Before we plot, we'll assign each community membership to each vertex and a crossing value to each edge. The crossing()
function in igraph
will return true if a particular edge crosses communities. This is useful when we want to see certain vertices that are bridges between communities. You may just want to look at certain communities because the whole graph is a bit of a hairball. In this case, we'll create a subgraph of communities only of a certain size (number of members).
This exercise is part of the course
Case Studies: Network Analysis in R
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Color vertices by community membership, as a factor
V(retweet_graph)$color <- factor(___(___))
# Find edges that cross between commmunities
is_crossing <- crossing(___,___)
# Set edge linetype: solid for crossings, dotted otherwise
E(retweet_graph)$lty <- ifelse(___, "solid","___")