- l(i, j) is the length of the edge between i and j.
- V is the set of vertices, assumed to be { 1, 2, ..., n }
- 1. t = 1; T = { } ; U = { 1 }
- 2. Scan V \ U:
- Find u such that l(t, u) is minimal
- 3. T := T + {edge<t-u>}
- 4. U := U + {u}
- 5. If U = V, halt
- 6. for each v in V \ U:
- l(t, v) := min(l(t, v), l(u, v));
- 7. Goto 2