1. Learn
  2. /
  3. Courses
  4. /
  5. Case Studies: Network Analysis in R

Connected

Exercise

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.

Instructions 1/3

undefined XP
    1
    2
    3
  • Calculate the mean of the weighted transitivity of the trip network, trip_g_simp.
  • Calculate the number of vertices (the order of the graph).
  • Calculate the edge density of the graph.
  • Get the edge weights from the weight element of the edges.