Session Ready
Exercise

Most Traveled To and From Stations with Weights

So far, we've only looked at our network with unweighted edges. But our edge weights are actually the number of trips, so it seems logical that we would want to extend our analysis of degrees by adding a weighted degree distribution. This is important because while a balanced degree ratio is important, the item that would need to be rebalanced is bikes. If the weights are the same across all stations, then an unweighted degree ratio would work. But if we want to know how many bikes are actually flowing, we need to consider weights.

The weighted analog to degree distribution is strength. We can calculate this with the strength() function, which presents a weighted degree distribution based on the weight attribute of a graph's edges.

Instructions
100 XP
  • Create a data frame containing the following columns.
    • trip_out should contain the "out" weighted degree (strength) distribution of trip_g_simp.
    • trip_in should contain the "in" weighted degree distribution.
    • ratio should contain the ratio of "out" degrees divided by "in" degrees.
  • Filter trip_strng for rows where both trip_out and trip_in are greater than 10.
  • Plot a histogram of the filtered ratios.