算法设计与分析课程复习笔记11——单源最短路径
单源最短路径
最短路径问题
输入:有权有向图G=(V,E)
路径p={
v0,v1,...,vkv_0, v_1, . . . , v_kv0,v1,...,vk}的权:
∑i=1kw(vi−1,vi)\displaystyle \sum_{i=1}^kw(v_{i-1},v_i)i=1∑kw(vi−1,vi)
最短路径的权:
δ(u,v)={
min(w(p)):u→v, if there exist a path from u to v∞, otherwiseδ(u,v)=\left\{ \begin{aligned} min(w(p)):u → v, if there exist a path from u to v\\ \infty, otherwise\\ \end{aligned} \right. δ(u,v)=