From 9e285869eb141c1e69093c1a8d3bf637e49bbc9e Mon Sep 17 00:00:00 2001 From: shubh agrawal Date: Sat, 3 Oct 2020 11:28:38 +0530 Subject: [PATCH] adding some more graph algorithms --- Library/Graph/PRIMS.CPP | 68 ++++++++++++++++++++++++++++++++ Library/Graph/floydwarshall.cpp | 69 +++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 Library/Graph/PRIMS.CPP create mode 100644 Library/Graph/floydwarshall.cpp diff --git a/Library/Graph/PRIMS.CPP b/Library/Graph/PRIMS.CPP new file mode 100644 index 0000000..1d6cf5d --- /dev/null +++ b/Library/Graph/PRIMS.CPP @@ -0,0 +1,68 @@ +#include +#define I 32767 +using namespace std; +int main() +{int cost[8][8]={{I,I,I,I,I,I,I,I}, + {I,I,25,I,I,I,5,I}, + {I,25,I,12,I,I,I,10}, + {I,I,12,I,8,I,I,I}, + {I,I,I,8,I,16,I,14}, + {I,I,I,I,16,I,20,18}, + {I,5,I,I,I,20,I,I}, + {I,I,10,I,14,18,I,I}}; +int near[8]={I,I,I,I,I,I,I,I}; +int t[2][6]; +int i,j,u,v,k,n=7,min=I; +for(i=1;i<=n;i++) +{ +for(j=i;j<=n;j++) +{if(cost[i][j] +using namespace std; +#define INF 1e7 +void floydwarshall(int m[][100],int n) +{ + int dist[n][n]; + + for(int i=0;i>t; + while(t--) + { + int n; + cin>>n; + int m[100][100]; + for(int i=0;i>m[i][j]; + } + } + floydwarshall(m,n); + + /*for(int i=0;i