Understanding vertex degrees
Within the context of graph theory, the degrees around a vertex are the number of edges around the vertex. In our flights example, the degrees are then the total number of edges (that is, flights) to the vertex (that is, airports). Therefore, if we were to obtain the top 20 vertex degrees (in descending order) from our graph, then we would be asking for the top 20 busiest airports (most flights in and out) from our graph. This can be quickly determined using the following query:
display(tripGraph.degrees.sort(desc("degree")).limit(20))
Because we're using the display
command, we can quickly view a bar graph of this data:
Diving into more details, here are the top 20 inDegrees
(that is, incoming flights):
display(tripGraph.inDegrees.sort(desc("inDegree")).limit(20))
While here are the top 20 outDegrees
(that is, outgoing flights):
display(tripGraph.outDegrees.sort(desc("outDegree")).limit(20))
Interestingly, while the top 10 airports (Atlanta/ATL to Charlotte/CLT) are...