Created in 1965, Dijkstra's algorithm is the pinnacle of algorithmic art. A labyrinthine maze of logic and flow, it's as beautiful as it is functional.
See the step-by-step guide on how it's made or watch the algorithmic dance
function shortestPath(graph) {
var startNode = graph.start;
var endNode = graph.end;
var visited = [];
var shortest = null;
while (startNode != endNode) {
visited.push(startNode);
startNode = graph.neighbors(startNode);
}
return visited.join(' -> ');
}
View the real-world implementation