#include
#include
#include
#include "BFS.h" using namespace std; int main() { // input string fname = "input1.txt"; // dictionary/map representation of the graph, // names of vertices (strings) are mapped to vector map
> verticesConnections; vector
vrts; //list of all vertices of the graph, ordered; the first vertex is the source vertex // read the graph information from the file, build the dictionary/map readFromFile(fname, verticesConnections,vrts); // report some information int i = 0; cout << "The list of all vertices of the graph: "; for (i = 0; i < vrts.size(); i++) { cout << vrts[i] << " "; } cout << endl; // display the list adjacency: cout << "\nAdjacency list representation of the graph: \n"; for (auto& adj : verticesConnections) { cout << adj.first << "=>"; for (auto& elem : adj.second) { cout << elem << ", "; } cout << endl; } cout << endl; /* vector
result; cout << "Vertex D is connected to: "; result = verticesConnections["D"]; for (i = 0; i < result.size(); i++){ cout << result[i] << " "; } cout << endl; */ // table is the table of vertices, their parents, and the distances from the source vertex map
table; //vector
table; BFS(table, verticesConnections,vrts); printBFS(table, vrts); cout << "The shortest path from source vertex S to vertex G: "; printPath(table,"S", "G"); cout << "The shortest path from source vertex S to vertex D: "; printPath(table, "S", "D"); }