This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Changes to original version | |
// 1. Calculate the distance between any nodes in the dataset, without needing to edit the problem dictionary. | |
// 2. Prevent algorithm from going back to start node if loops exist in graph (e.g., in problem below) | |
const problem = { | |
start: {A: 5, B: 2}, | |
A: {start: 1, C: 4, D: 2}, | |
B: {A: 8, D: 7}, | |
C: {D: 6, finish: 3}, | |
D: {finish: 1}, |