Question: #include #include #include #include #include #include #include #include #include #include / / For setw using namespace std; class Graph { private: int verticescount,edgecount; string labelsOfNodes

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include // For setw
using namespace std;
class Graph
{
private:
int verticescount,edgecount;
string labelsOfNodes[80]; // sehirlerimizin isimlerini array seklinde tutuyoruz,
unordered_map> vertexMap; //ehirler ve komuluk ilikilerini tutacak hash table
vector> adjacencyMatrix; //vector> trnde bir 2D vektr (vector of vectors) nesnesini temsil eder. sehirlerin edgelerini tutucak
unordered_map> adj; // Adjacency structure
string mymatrix[82][84];// suan distance tablosunun tm verisini tutucak,su an her eyi string turunde okur
unordered_map> distances; // arlklar burfa
// sehirlerin uzaklklarn tutuyorum.
public:
Graph(int V)//: verticescount(V), edgecount(0)
{
verticescount=V;
edgecount=0;
adjacencyMatrix.resize(V, vector(V,0)); // Initialize adjacencyMatrix with V x V dimensions and fill with 0.
}
int V()//number of vertices
{
return verticescount;
}
int E()//number of edges
{
return edgecount; // her ehrin komu says onun edgesini verir
}
bool adjacent(string x, string y)
{
if (adj.find(x)!= adj.end()){
auto it = find(adj[x].begin(), adj[x].end(), y);
return it != adj[x].end();
}
return false;
}
void addVertex(string vertex, int i)
{
if (vertexMap.find(vertex)== vertexMap.end())
{
labelsOfNodes[i]= vertex;
vertexMap[vertex]={}; // Bo bir vektr atyoruz
}
cout< neighbors(string x)//komsular
{
vector result;
if (vertexMap.find(x)!= vertexMap.end())
{
result = vertexMap[x];
}
return result;
}
void addDistance()//string x, string y, int distance
{
int i,j,mesafe;
string temp1, temp2;
for(i=1;i<82;i++)
{
//column 1 den baslasnki plate numberi almasn ya uff
temp1=mymatrix[i][1];
//cout<> distances;
int distance = stoi(mymatrix[i][j]);
distances[temp1][temp2]= distance;
}
cout<<"adddistancede biseyler deniom ";
}
for (const auto& from : distances)
{
const string& fromCity = from.first;
for (const auto& to : from.second)
{
const string& toCity = to.first;
int distance = to.second;
cout << "Distance from "<< fromCity <<" to "<< toCity <<": "<< distance <<" km
";
}
}
}
void tablotut(int column,int row, string x)
{
mymatrix[row][column]=x;
}
void tablobas()
{
int i,j;
for(i=0;i<82;i++)
{
for(j=0;j<84;j++)
{
cout<

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!