20namespace shortest_path {
37 template<
typename TGraph>
48template<
typename TGraph>
51 using weight_type =
typename TGraph::edge_type::weight_type;
52 using node_type =
typename TGraph::node_type;
59 for (
auto &first : nodes) {
61 for (
auto &
second: nodes) {
70 for (
auto &first : nodes) {
71 for (
auto &s_edge :
graph.successorEdges(first)) {
73 dist[first][s] =
std::min(dist[s_edge.first][s_edge.second], s_edge.weight());
78 for (
auto &k : nodes) {
79 for (
auto &
i : nodes) {
81 for (
auto &j : nodes) {
83 dist[
i][j] =
std::min(dist[
i][j], dist[
i][k] + dist[k][j]);
93 throw std::out_of_range(
"FloydWarshall: Detected negative weight cycle.");
Class extending the map class from the standard library. Original reason is to allow printing of the ...
Definition: map.hpp:48
std::pair< iterator, bool > insert(const T &key, const R &value)
Insert variant with explicit key and value parameters.
Definition: map.hpp:118
static TNode const & other(const TEdge &e, const TNode &n)
Definition: FloydWarshall.hpp:22
static ext::map< typename TGraph::node_type, ext::map< typename TGraph::node_type, typename TGraph::edge_type::weight_type > > run(const TGraph &graph)
Definition: FloydWarshall.hpp:50
p second
Definition: ToRegExpAlgebraic.h:126
int i
Definition: AllEpsilonClosure.h:118
constexpr const T & max(const T &a)
Root case of maximum computation. The maximum from one value is the value itself.
Definition: algorithm.hpp:278
constexpr const T & min(const T &a)
Definition: algorithm.hpp:310
constexpr auto make_pair(T1 &&x, T2 &&y)
Definition: pair.hpp:79
Definition: ReconstructPath.hpp:14