Jon Rumsey

An online markdown blog and knowledge repository.


Project maintained by nojronatron Hosted on GitHub Pages — Theme by mattgraham

Partner Power Hour - Graphs and Navigation App

Speaker: Roger R

Codefellows Alum and current Java TA

Dijkstra's Algorithm

Used to find shortest path from starting location to a destination.

Based on a Graph datastructure.

Demo

Hashmap: Key-value pairs structure. In this case: Keys of Cities, and a collection of values (roads with time to travel).

Edges are bi-directional in this graph.

Stored Info class: Stores KVPs City:TravelDetails.

Inputs include:

NavPrompt Class:

Dijkstra Class:

Notes

When comparing for the 'least distance' or a minimum value, it was imporant to start the existing value at MAX_VALUE to simplify comparisons.

If travel times between the same two cities in opposing directions are not the same, utilize bidirectional Edge properties in the Graph.

Return to pph index

Return to root README