ComeçarComece de graça

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.

Este exercício faz parte do curso

Fraud Detection in R

Ver curso

Instruções do exercício

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

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Each account type is assigned a color
___ <- c(___, ___, ___)

# Add attribute color to V(net) which holds the color of each node depending on its account_type
___ <- ___[___(___)$___]

# Plot the network
___
Editar e executar o código