Having issues with Djikstra's algorithm

57 views Asked by At

Trying to implement Dijkstra's via the instructions in this article:

https://medium.com/@adriennetjohnson/a-walkthrough-of-dijkstras-algorithm-in-javascript-e94b74192026

My repl below:

https://repl.it/@Stylebender/DJIK#index.js

  1. The actual Dijkstra method within the Graph class is throwing a not defined error. Just wondering is there a typo or something I did wrong on my end?

  2. In any case, would this be a solid implementation of Dijkstra's?

1

There are 1 answers

2
Ghost On

In the end change findPathWithDijkstra("Fullstack", "Cafe Grumpy"); to map.findPathWithDijkstra("Fullstack", "Cafe Grumpy");

You have created findPathWithDijkstra in the Graph class so you need to call it through an object, in your case map