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