So asĀ continuation from my last post, I’ve decided to map out all the major air traffic routes worldwide. Data were obtained from openflights, with the individual airport data here and the route data here. You can see the processed gexf file here. I’ve started work on creating an automated script to convert raw data into a .gexf file. It’s not quite done yet, but the script used to do so can be found below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
setwd("./openflights-code-769/openflights/data") ### create node XML airports <- read.csv("airports.dat",header=FALSE) head(airports) airports$nodes <- paste('<node id="', as.character(airports$V1), '.0" label="',airports$V5, '"/>',sep="") ### create edge XML routes <- read.csv("routes.dat",header=FALSE) routes$edgenum <- 1:nrow(routes) head(routes) routes$edges <- paste('<edge id="', as.character(routes$edgenum),'.0" source="', routes$V3, '" target="',routes$V5, '"/>',sep="") ### build metadata gexfstr <- '<?xml version="1.0" encoding="UTF-8"?> <gexf xmlns:viz="http:///www.gexf.net/1.1draft/viz" version="1.1" xmlns="http://www.gexf.net/1.1draft"> <meta lastmodifieddate="2010-03-03+23:44"> <creator>Gephi 0.7</creator> </meta> <graph defaultedgetype="undirected" idtype="string" type="static">' ### append nodes gexfstr <- paste(gexfstr,'\n','<nodes count="',as.character(nrow(airports)),'">\n',sep="") fileConn<-file("output.gexf") for(i in 1:nrow(airports)){ gexfstr <- paste(gexfstr,airports$nodes[i],"\n",sep="")} gexfstr <- paste(gexfstr,'</nodes>\n','<edges count="',as.character(nrow(routes)),'">\n',sep="") ### append edges and print to file for(i in 1:nrow(routes)){ gexfstr <- paste(gexfstr,routes$edges[i],"\n",sep="")} gexfstr <- paste(gexfstr,'</edges>\n</graph>\n</gexf>',sep="") writeLines(gexfstr, fileConn) close(fileConn) |
I’ve created three separate graphs using different measures of influence – Betweenness Centrality, Eigenvector Centrality, and Degree. Click on an image to expand the graph, although be aware that it may take a while to load.
You’ll notice that some airports such as LAX, which weren’t noteworthy in the graphs depicting domestic flight routes have gained new prominence from an international perspective since they serve as important traffic hubs for overseas flights. Other important airports include Dubai International Airport (DXB), Beijing Capital International Airport (PEK), Charles De Gaulle International Airport (CDG), and interestingly, Anchorage International Airport (ANC).