$u\to v$: the directed edge between vertex $u$ and $v$
$u\leadsto v$: the path that connects vertex $u$ and $v$
$\ce{dist}: \texttt{\gray{\blue{Map}<\blue{Vertex}, \blue{int}\,|\,\purple{$\infty$}>}}$
$\ce{pred}:\texttt{\gray{\blue{Map}<\blue{Vertex}, \blue{Vertex}\,|\,\purple{null}>}}$
null
for all vertices.An edge $u\to v$ is tense if:
$$ \ce{dist}[u] + \ce{weight}(u\to v) < \ce{dist}[v] $$
@Hint
If $u\to v$ is tense, then the distance from start to $v$ can be improved by including $u$ as the predecessor of $v$.
Combining ${\tt{start}}\rightsquigarrow u$ and $u\to v$ is better than the current ${\tt{start}}\rightsquigarrow v$.
If $u\to v$ is tense, we relax it by:
function RelaxEdge(u→v: Edge):
dist[v] = dist[u] + weight(u→v)
pred[v] = u
Improve $\text{dist}[v]$ by including $u$ as the predecessor of $v$.
Go to next: