如图所示 graph LRstart[最短路] --- simple[单源最短路]start --- multi[多源最短路]simple --- have_negative{是否有负权边}have_negative -- Yes --- dijkstra[Dijkstra算法]dijkstra --- usual[朴素Dijkstra算法 O n^2]dijk
如图所示
graph LR
start[最短路] --- simple[单源最短路]
start --- multi[多源最短路]
simple --- have_negative{是否有负权边}
have_negative -- Yes --- dijkstra[Dijkstra算法]
dijkstra --- usual[朴素Dijkstra算法 O n^2]
dijkstra --- heap_dijkstra[堆优化版Dijkstra算法 O mlogn]
have_negative -- No --- algorithm[some algorithm]
algorithm --- bellman_ford[Bellman-Ford O nm]
algorithm --- spfa[SPFA 一般Om 最坏Onm]
multi --- floyd[Floyd算法 O n^3]