BB7 - the Dijkstra Algorithm


The Dijkstra Algorithm computes the shortest path to all nodes from a given origin node in a network of Nodes and Edges. This solution is based on James Coplien's solution written in Ruby. The network is a modified and simplified Manhattan geometry The solution uses recursion rather than a loop.

This solution is noteworthy because two Roles(EastNeighbor and SouthNeighbor) have RoleMethods with the same name (recomputeTentativeDistance). These Roles are played by instances of the same class. There is no name conflict because Squeak/BabyIDE no longer used RoleMethod injection.

The code can be read and run in BabyIDE. Informally, the code can be read at

BB7Dijkstra:
reader-friendly version
printer-friendly version

There is a toggle for choosing between the versions at the top of the documents.