February 2017
Intermediate to advanced
274 pages
5h 58m
English
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)) ...Read now
Unlock full access