diff --git a/floydWarshal b/floydWarshal new file mode 100644 index 0000000..3aacbcb --- /dev/null +++ b/floydWarshal @@ -0,0 +1,36 @@ +#include +#include +#define NODE 7 +#define INF 999 +using namespace std; +//Cost matrix of the graph +int costMat[NODE][NODE] = { + {0, 3, 6, INF, INF, INF, INF}, + {3, 0, 2, 1, INF, INF, INF}, + {6, 2, 0, 1, 4, 2, INF}, + {INF, 1, 1, 0, 2, INF, 4}, + {INF, INF, 4, 2, 0, 2, 1}, + {INF, INF, 2, INF, 2, 0, 1}, + {INF, INF, INF, 4, 1, 1, 0} +}; +void floydWarshal(){ + int cost[NODE][NODE]; //defind to store shortest distance from any node to any node + for(int i = 0; i