Take the 2-minute tour ×

I need to model airline flight data in a graph database (I am specifically working with neo4j, though I will consider others if that becomes problematic). My question is more about how to model this data in a way that will ease traversal and discovery of different flight options. A few specific examples of the type of data I would like to both store and later query:

1) A direct flight scenario like JFK->LAX. Seems straightforward, simple two node relationship. But there are many flights that may be of interest between these two nodes. So, if I need to store individual flight detail, is that best in an array on the relationship between the JFK and LAX nodes?

2) A flight scenario with multiple stops, like JFK->LAX->SAN. In this scenario, it seems like there modeling the relationship between the three nodes may be of limited utility if I'm interested in the departure and arrival city? i.e. I could have a relationship from JFK->SAN and the fact that there is a layover in LAX could be a property on that relationship?

If I need to query or traverse the graph based on arrays of data in relationships between nodes, and those arrays become large (e.g. 100 different flights between JFK and LAX), will that introduce performance or scalability problems?

Hopefully this question isn't too open-ended - I'm just trying to avoid building something that works for a small example model with ~5 nodes but can't scale to hundreds of airports and tens of thousands of flights.

share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

Hundreds of airports and tens of thousands of flights is still a very small data set and I'd be surprised if that would be a problem in neo4j.

Off the top of my head you could perhaps have all the airports as their own nodes and each route could be its own node with relationships to all the airports it touches, maybe with an "order" property on each relationship which is local to the route.

         /    \           \
*order=1/      \*order=2   \*order=3
       v        v           v
    (JFK)       (LAX)      (SAN)

I'm sure there are better solutions.

share|improve this answer
add comment

Transport Dublin is a scheduling project, online at http://www.transportdublin.ie/

If that is interesting, check in at enter link description here

share|improve this answer
Sorry, this doesn't really answer my question unless I'm missing something at the linked site. I'm looking for a more specific answer about how to store this data using a graph data structure. If there is something I am missing from your response, or some additional information you could provide, I would change my vote. –  Chris Hart Jan 16 '12 at 1:18
Hi, the site Peter mentioned above is a site I built last year with Neo4j. You shouldn't have a problem scaling to 10k+ flights, I also stored departure times as an array on the relationships. I think bus and airline scheduling are in very similar domains and there is a lot of academic research in the area of time-dependent routing. Hopefully this paper should give you some ideas for airline networks modelling approaches: sommer.jp/csom_phdthesis.pdf –  paddydub Jan 20 '12 at 5:19
add comment

Check out Neo4J's contribution page

One of the winners of their contest was a gist describing US Flights and Airports it is very well done

share|improve this answer
add comment

Your Answer


