Introduction
Lesson 1 of 9 in Coddy's Dijkstra's Algorithm - Graph Algorithms course.
Welcome back to the Graph Algorithms series! So far our edges were all equal. Now they carry a weight (a cost or distance), and we want the cheapest route.
Dijkstra's Algorithm finds the shortest-distance from a single source to every other vertex in a graph with non-negative edge weights.
A weighted graph is given as n (vertices 0 to n - 1) and edges, a flat array of triples [u0, v0, w0, u1, v1, w1, ...] where each triple is a directed edge u -> v of weight w.
Let's get started!
Try it yourself
This lesson doesn't include a code challenge.
This lesson includes a short quiz. Start the lesson to answer it and track your progress.