algo — C++23 日本語リファレンス GitHub

shortest_path

関数 · 単一始点最短路 (shortest_path)

// (1)
template <template <class...> class Heap = dijkstra_priority_queue, properly_weighted_graph_type G, class T = graph_weight_t<G>>
std::vector<T> shortest_path(const G &g, int s = 0, T inf = std::numeric_limits<T>::max());

// (2)
template <unweighted_graph_type G>
std::vector<int> shortest_path(const G &g, int s = 0, int inf = std::numeric_limits<int>::max());

概要

(1) 単一始点最短路(実重み付きグラフはダイクストラ法)

(2) 単一始点最短路(重みなしグラフは BFS で $O(V+E)$)

関連項目