Session Ready
Exercise

Betweenness of ties

Previously you saw that nodes can have a measure of betweenness. Ties can also have this measure: betweenness of ties is defined by the number of shortest paths going through a tie.

Ties with high betweenness may have considerable influence within a network by virtue of their control over information passing between nodes. Removing them will most disrupt communication between nodes.

In the Madrid dataset, the weight of a tie is the strength of the connection between two people – a high weight means the two people are closely connected. However, when you calculate betweenness using edge_betweenness(), the weights argument works as a distance between two nodes – a high weight means the two people are considered further apart. To reconcile this, we pass the reciprocal of the edge weights to the weights argument of edge_betweenness(), thus giving them the same meaning.

The network g and the data frame ties are at your disposal.

Instructions
100 XP
  • Calculate the reciprocal (1 / x) of the tie weights, assigning to dist_weight.
  • Call mutate() on the data frame nodes to add an betweenness variable, setting it to the edge betweenness of g, weighted by dist_weight.