diff options
| author | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-11-16 01:24:14 +0100 |
|---|---|---|
| committer | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-11-16 01:24:14 +0100 |
| commit | 98567ec798aa8ca2cfbcb85c774dd470f30e30d4 (patch) | |
| tree | 5113d5cc24d1ad5f93810b6442ce584a36950dc8 /graph/floydWarshall.cpp | |
| parent | ad3856a6b766087df0036de0b556f4700a6498c9 (diff) | |
| parent | 8d11c6c8213f46f0fa19826917c255edd5d43cb1 (diff) | |
mzuenni tests
Diffstat (limited to 'graph/floydWarshall.cpp')
| -rw-r--r-- | graph/floydWarshall.cpp | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/graph/floydWarshall.cpp b/graph/floydWarshall.cpp deleted file mode 100644 index fb6263e..0000000 --- a/graph/floydWarshall.cpp +++ /dev/null @@ -1,26 +0,0 @@ -vector<vector<ll>> dist; // Entfernung zwischen je zwei Punkten. -vector<vector<int>> pre; - -void floydWarshall() { - pre.assign(sz(dist), vector<int>(sz(dist), -1)); - for (int i = 0; i < sz(dist); i++) { - for (int j = 0; j < sz(dist); j++) { - if (dist[i][j] < INF) { - pre[i][j] = j; - }}} - - for (int k = 0; k < sz(dist); k++) { - for (int i = 0; i < sz(dist); i++) { - for (int j = 0; j < sz(dist); j++) { - if (dist[i][j] > dist[i][k] + dist[k][j]) { - dist[i][j] = dist[i][k] + dist[k][j]; - pre[i][j] = pre[i][k]; -}}}}} - -vector<int> getPath(int u, int v) { - //return dist[u][v]; // Pfadlänge u -> v - if (pre[u][v] < 0) return {}; - vector<int> path = {v}; - while (u != v) path.push_back(u = pre[u][v]); - return path; //Pfad u -> v -} |
