1. Learn
  2. /
  3. Courses
  4. /
  5. Case Studies: Network Analysis in R

Exercise

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).

Instructions 1/3

undefined XP
    1
    2
    3
  • Set the color property of the vertices to the membership() of communities_louvain as a factor.
  • Use crossing() to find edges that cross between the communities of communities_louvain in retweet_graph.
  • Use ifelse() to set the linetype property of the edges to "solid" when is_crossing is TRUE and "dotted" otherwise.