Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Case Studies: Network Analysis in R

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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
)
Code bewerken en uitvoeren