Skip to content

Instantly share code, notes, and snippets.

@theWhiteFox
Created January 16, 2018 22:12
Show Gist options
  • Save theWhiteFox/fac2f5c45d5c8a5ada31436406586a6b to your computer and use it in GitHub Desktop.
Save theWhiteFox/fac2f5c45d5c8a5ada31436406586a6b to your computer and use it in GitHub Desktop.
Dijkstra created by steTheWhiteFox - https://repl.it/@steTheWhiteFox/Dijkstra
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