dist
English · noun
Senses
Sense 1 · noun · corpus
A code name that appears to stand for a distance value.
Source: Mova's open texts. Licence: cc-by-sa-4.0.
Usage and labels
corpus
In the Dijkstra code shown, dist[v] stores a distance for vertex v.
Examples
3 source examples.
- 1 function Dijkstra(Graph, source): 2 3 for each vertex v in Graph.Vertices: 4 dist[v] ← INFINITY 5 prev[v] ← UNDEFINED 6 add v to Q 7 dist[source] ← 0 8 9 while Q is not empty: 10 u ← vertex in Q with minimum dist[u] 11 Q.remove(u) 12 13 for each edge (u, v) in Graph: 14 alt ← dist[u] + Graph.Distance(u,v) 15 if alt < dist[v]: 16 dist[v] ← alt 17 prev[v] ← u 18 19 return dist[], prev[] — Wikipedia: Dijkstra's algorithm (Wikipedia contributors). Licence: cc-by-sa-4.0. — Mova's open texts (cc-by-sa-4.0)
- Instead of filling the priority queue with all nodes in the initialization phase, it is possible to initialize it to contain only source; then, inside the **if** *alt* < dist[*v*] block, the becomes an operation. — Wikipedia: Dijkstra's algorithm (Wikipedia contributors). Licence: cc-by-sa-4.0. — Mova's open texts (cc-by-sa-4.0)
- Yet another alternative is to add nodes unconditionally to the priority queue and to instead check after extraction (*u* ← *Q*.extract_min) that it isn't revisiting, or that no shorter connection was found yet in the if alt < dist[v] block. — Wikipedia: Dijkstra's algorithm (Wikipedia contributors). Licence: cc-by-sa-4.0. — Mova's open texts (cc-by-sa-4.0)
Notes and derived forms
corpus
Sources
Mova's open texts. Licence: cc-by-sa-4.0.
This page in Markdown https://md.dictionary.elamur.ai/free/en/english/dist/