Dsa Assign 7
Dsa Assign 7
#include "templateDatastructs.h"
#include <iomanip>
//////////////////////
class Graph
int V;
int E, INF;
public:
Graph():INF(99999) {}
void createGraph();
void showGraphMatrix();
void floyd_warshall();
void graph_dist_matrix();
};
//////////////////////
int u, v;
ifstream inFile("a1.txt");
inFile>>ch;
V = static_cast<int>(ch) - 48;
//Creating 2D Array
Adj[u][v] = 0;
while (!inFile.eof())
u = static_cast<int>(ch) - 48;
v = static_cast<int>(ch) - 48;
Adj[u][v] = 1;
Adj[v][u] = 1; //As Graph is Undirected, So BOTH has to be Filled
inFile.close();
/////////////////////////
cout<<endl;
// cout<<"\n("<<u<<") ";
else cout<<setw(7)<<Adj[u][v];
// cout<<*(Adj+((V*u)+v)*sizeof(int))<<"\t";
cout<<endl;
////////////////////////
//Creating 2D Array
Adj[i][j] = matrix[i][j];
cout<<"\nOriginal Distance!";
showGraphMatrix();
////////////////////////
this->graph_dist_matrix();
int dist[V][V];
dist[i][j] = Adj[i][j];
Adj[i][j] = dist[i][j];
showGraphMatrix();
}
////////////////////////
int main()
Graph myG;
short ch;
do
cout<<"\n------MENU------\n"
switch(ch)
case 1:
myG.createGraph();
break;
case 2:
myG.floyd_warshall();
break;
case 3:
myG.showGraphMatrix();
break;
case 4:
return 0;
break;
}while(1);
cout<<endl;
return 0;