Visualize central vertices
As we saw in the last lesson, station 275 had the lowest out/in degree ratio. We can visualize this using make_ego_graph()
to see all the outbound paths from this station. It's also useful to plot this on a geographic coordinate layout, not the default igraph
layout. By default, igraph
uses the layout_nicely()
function to display your graph, making an algorithmic guess about what the best layout should be. However, in this case we want to specify the coordinates of each station, because when a vertex is above another it means it's actually north of it.
This exercise is part of the course
Case Studies: Network Analysis in R
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Make an ego graph of the least traveled graph
g275 <- make_ego_graph(___, 1, nodes = "___", mode= "out")[[1]]
# Plot ego graph
plot(
g275,
# Weight the edges by weight attribute
edge.width = E(g275)$weight
)