From d7b97b602d5cfee2fbb55eddc5cabe2f8457945a Mon Sep 17 00:00:00 2001 From: Abdurrezzak Efe Date: Thu, 16 Nov 2017 17:10:53 +0200 Subject: [PATCH] Add files via upload --- 25.FloydWarshall.cpp | 60 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 25.FloydWarshall.cpp diff --git a/25.FloydWarshall.cpp b/25.FloydWarshall.cpp new file mode 100644 index 0000000..a08940a --- /dev/null +++ b/25.FloydWarshall.cpp @@ -0,0 +1,60 @@ +/* + * This program constructs a graph from user inputs and + * computes all pairs shortest paths between every pair of nodes using + * Floyd Warshall Algorithm + * + * Coded by: Abdurrezak Efe + * */ + +#include +#include +using namespace std; + +const int V = 1000; //assumed number of vertices +int edges[V+1][V+1] = {0}; //the graph itself + +void floyd_warshall(int v) +{ + int distance[v+1][v+1]; + + + //initializing distance matrix + for(int i=0;i> v >> e; + + for(int i=0;i> x >> y >> w, edges[x][y] = edges[y][x] = w; + + floyd_warshall(v); +} \ No newline at end of file