| Algorithm1: Dijkstra SPF |
| Input: “voice command data” |
| Output: GPS “SPF” |
| 1: Start |
| 2: Initialization: {distances to source node (s) = 0; distances to other nodes is empty (n) = ∅; queue (q) ∈ {all nodes}} |
| 3: Start value ← 0 |
| 4: for all N ∈ n-{s} |
| 5: dist [n] ← ∞ (all other distances should be set to infinity) |
| 6: while q ≠ ∅ (while there is a queue) |
| 7: do x ← min_distance (q, dist) (choose the q with the lowest distance) |
| 8: For all N ∈ neighbors [x] |
| 9: do if dist [N] > dist [x] + w (x, N) (if a new shortest path is discovered) |
| 10: then d[v]← d[x] + w (x, N) (change the shortest path with new value) |
| Return dist |