I'm trying to create an implementation of Dijkstra's pathfinding which seems to be working great, apart from if I ask it to create a route that starts and ends in the same place.
JSFiddle: http://jsfiddle.net/Lt6b4ecr/
I need it to pick the lowest possible weighted route which should be B-C-E-B but instead it just sits at 0 :(
My graph is designed as so:
var graph = {
A: { B: '5', D: '5', E: '7' },
B: { C: '4' },
C: { D: '8', E: '2' },
D: { C: '8', E: '6' },
E: { B: '3' }};
and worth noting that the connections/edges are to be treated as one way only.
Any help would be massively appreciated!