#include "util/exception.hh" #include #include #define MAX_DIST (INT_MAX / 2) //#include "FloydWarshall.h" using namespace std; // All-pairs shortest path algorithm void floyd_warshall(const std::vector >& edges, std::vector >& dist) { UTIL_THROW_IF(edges.size() != edges.front().size(), util::Exception, "Error"); dist.clear(); dist.resize(edges.size(), std::vector(edges.size(), 0)); size_t num_edges = edges.size(); for (size_t i=0; i (dist[i][k] + dist[k][j])) dist[i][j] = dist[i][k] + dist[k][j]; }