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

Exercise

Compare Subscriber vs. Non-Subscriber Distances

Let's compare subscriber to non-subscriber graphs by distance. Remember we can think of subscribers as local Chicago residents who regularly use the bikes, whereas non-subscribers are likely to be more casual users or tourists. Also it's important to keep in mind that this graph is a representation of geography. Which graph do you think has a further geographic distance? Why?

get_diameter() and farthest_vertices() both provide the vertices in the graph that have the longest "shortest route" between them – get_diameter() provides all the intermediate vertices, whereas farthest_vertices() provides the end vertices and the number of nodes between them.

calc_physical_distance_m(), a function that takes in two station IDs as inputs and calculates the physical distance between the stations (in meters), is also provided. You can view the function by running calc_physical_distance_m in the console.

Instructions 1/2

undefined XP
    1
    2
  • Get the diameter of subscriber_trip_graph.
  • Repeat for customer_trip_graph.
  • Find the farthest vertices in subscriber_trip_graph.
  • Repeat for customer_trip_graph.