Get startedGet started for free

Weighted Clustering Randomizations

We can see support for the hypothesis that a graph with low connectivity would also have very high clustering, much higher than by chance. But our graph is more than just an undirected graph, it also has weights that represent the number of trips taken. So now we have several things to consider in our randomization. First, the weighted version of the metric is local only, so a transitivity value is calculated for each vertex. Second, the random graph doesn't include weights. To solve both of these problems, we'll look at the mean vertex transitivity, and implement a slightly more complicated randomization scheme.

To calculate the weighted vertex transitivity of a network, you'll need to set type to "weighted" in your call to transitivity().

The bike trip network, trip_g_simp is available.

This exercise is part of the course

Case Studies: Network Analysis in R

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Find the mean local weighted clustering coeffecient using transitivity()
actual_mean_weighted_trans <- mean(___(___, type = "weighted"))

# Calculate the order
n_nodes <- ___(trip_g_simp)

# Calculate the edge density
edge_dens <- edge_density(___)

# Get edge weights
edge_weights <- E(___)$___
Edit and Run Code