This documentation is automatically generated by online-judge-tools/verification-helper
#include "cpp/graph/dijkstra.hpp"#pragma once
#include "graph/graph_list.hpp"
/**
* ダイクストラ法
* 有向グラフの単一始点最短経路 O((E+V)logV)
* 辺のコストが全て0以上
* 到達不能:max
* https://algo-logic.info/dijkstra/
*/
template <class Cost, class E>
void ListGraph<Cost, E>::dijkstra(int start_node) {
if (shortest_path_dist.count(start_node)) {
return;
}
using P = pair<Cost, int>;
vector<Cost> dist(n_, ListGraph::UNREACHABLE);
vector<int> parent(n_, -1);
dist[start_node] = 0;
priority_queue<P, vector<P>, greater<P>> pq;
pq.emplace(0, start_node);
while (!pq.empty()) {
P p = pq.top();
pq.pop();
Cost v = p.second;
if (dist[v] < p.first) {
continue;
}
for (const auto &e : adj[v]) {
if (dist[v] + e.cost < dist[e.to]) {
dist[e.to] = dist[v] + e.cost;
parent[e.to] = v;
pq.emplace(dist[e.to], e.to);
}
}
}
shortest_path_dist[start_node] = std::move(dist);
shortest_path_parent[start_node] = std::move(parent);
}Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/documentation/build.py", line 71, in _render_source_code_stat
bundled_code = language.bundle(stat.path, basedir=basedir, options={'include_paths': [basedir]}).decode()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/languages/cplusplus.py", line 187, in bundle
bundler.update(path)
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 401, in update
self.update(self._resolve(pathlib.Path(included), included_from=path))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 260, in _resolve
raise BundleErrorAt(path, -1, "no such header")
onlinejudge_verify.languages.cplusplus_bundle.BundleErrorAt: graph/graph_list.hpp: line -1: no such header