Session Ready
Exercise

Visualize the network (part 1)

Throughout this course, you'll use the ggraph package. This extends ggplot2 with new geometries to visualize the nodes and ties of a network.

  • Geometries for nodes have names starting geom_node_. For example, geom_node_point() draws each node as a point. geom_node_text() draws a text label on each node.
  • Geometries for ties have names starting geom_edge_. For example, geom_edge_link() draws edges as a straight line between nodes.

How networks are laid out in a plot to make them more readable is not an exact science. There are many algorithms, and you may need to try several of them. In this exercise, you'll use the Kamada-Kawai layout that you specify by setting the layout argument to "with_kk". The possible layout values are not currently well documented; the easiest way to see a list is to run ggraph:::igraphlayouts.

For your convenience, ggraph is already loaded, the graph theme is set with the function set_graph_style(), and the network g is at your disposal.

Instructions 1/2
undefined XP
  • 1
  • 2
  • Visualize the network.
    • Use the Kamada-Kawai layout.
    • Add an edge link geometry, setting the transparency of ties (alpha) to weight.
    • Add a node link geometry without arguments. Can you spot the important nodes and ties?