Creating an itinerary from flights and cities
We modelled cities and flights in the previous chapter. In this chapter, our primary focus will be on creating an itinerary from the graph we have. A few considerations while we are fetching the itinerary are as follows:
- Even if there is no direct flight from city A to city B, most people are comfortable with two or less stopovers/changes of flights
- If there is a change of flights or stopover involved, the stopover should be at least for two hours so that the travelers can change flights in spite of any unforeseen delays
Information and paths
In a graph, we discover information by traversing the nodes and relationships from some starting node or nodes. Collectively, the start node, the end node, the relationships, and intermediate nodes together consist of a path. We define the path using the node labels and relationship types. Writing queries with node labels and relationship types allows the query to be expressive.
Using Cypher to find a path
In...