LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Fraud Detection in R

Kurs anzeigen

Anleitung zur Übung

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

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# 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
___
Code bearbeiten und ausführen