Route+Planning

Consider a real, physical journey. There are many modes of travel. Happily for you, we will abstract it down until only certain essential aspects are relevant. Real travel planners need consider these and much more.

Cities can be modeled as nodes on a directed graph. The arrows on the graph represent means of traveling from one city to another. Each arrow (each segment of a journey) has a cost. Separately, each arrow takes an estimated amount of time.

For now, let us not worry about some very real concerns, such as the time and quality of a connection. For example, if the United flight from PDX to JFK arrives two minutes before the flight to Frankfurt leaves, you can't really plan to make that connection. Be happy that we simplify for the sake of the exercise.

The world of travel possibilities can be represented as a collection of connections (arrows on a graph). For example: Map Example 1. . as .txt:. . . Rik's sample output from Map 1: Map Example 2. . as .txt. . . Rik's outpu for Map 2: (not completely desk-checked) []
 * Code || From || To || Cost || Time || Comment ||
 * = || Portland || Chicago || 380 || 420 || Two-way flight, 420 minutes includes some airport time ||
 * - || StLouis || NewOrleans || 5 || 10000 || A week steering a raft, down-river only. Time varies with river level. ||
 * /* ||  ||   ||   ||   || The above two lines define part of the graph. Those below query it. ||
 * /* ||  ||   ||   ||   || > is too special for the wiki. - suggests half of =, doesn't it? ||
 * * ||  ||   ||   ||   || Dump out the airports and connections ||
 * $ || Portland || StPaul ||  ||   || Find (and display) cheapest route. ||
 * @ || StPaul || Moline ||  ||   || Find (and display) fastest route ||
 * ? || Davenport || Fresno ||  ||   || User (programmer)-defined optimization criterion: find the best. ||

See [] BTW: It's pronounced "Dike-stra"