Created
January 16, 2018 22:12
-
-
Save theWhiteFox/fac2f5c45d5c8a5ada31436406586a6b to your computer and use it in GitHub Desktop.
Dijkstra created by steTheWhiteFox - https://repl.it/@steTheWhiteFox/Dijkstra
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
const graph = { | |
start: { A: 5, B: 2 }, | |
A: { C: 4, D: 2 }, | |
B: { A: 8, D: 7 }, | |
C: { D: 6, finish: 3 }, | |
D: { finish: 1 }, | |
finish: {}, | |
}; | |
console.log(graph); | |
const costs = { | |
A: 5, | |
B: 2, | |
finish: Infinity, | |
}; | |
console.log(costs); | |
const parents = { | |
A: 'start', | |
B: 'start', | |
finish: null, | |
}; | |
console.log(parents); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment