Exercise

Visualizing node attributes

The structure of a network typically depends on the attributes of the nodes embedded in it. Being able to visualize these attributes in a graph can help us see patterns, and to understand better the relationships in the data. Using different colors and shapes for the nodes are useful tools to show this information in a graph. The node attribute account type can take 3 different values and we define three different colors that depend on this attribute.

The network net is added to your workspace. The updated V(net)$account_type object from the previous exercise is already available in your workspace: each node is an account of type 1, 2 or 3.

Instructions

100 XP
  • Create an object vertex_colors that contains the colors "grey", "lightblue" and "darkorange" (in this order).
  • Add an attribute color to V(net) which holds the color of each node depending on account_type.
  • Plot the network net with its new node attributes.