PR 7
PR 7
C-75
Prac cal no :-7
Problem Statement:- There are flight paths between ci es. If there is a flight between City A and City B then there is
an edge between the ci es. The cost of the edge can be the me that flight take to reach city B from A, or the
amount of fuel used for the journey. Represent this as a graph. The node can be represented by the airport name or
name of the city. Use adjacency list representa on of the graph or use adjacency matrix representa on of the graph.
*/
#include <iostream>
#include <queue>
using namespace std;
while (!bfsq.empty()) {
int v = bfsq.front();
bfsq.pop();
for (int i = 0; i < n; i++) {
if (adj_mat[v][i] && !visited[i]) {
cout << arr[i] << " ";
visited[i] = true;
bfsq.push(i);
}
}
}
}
int main() {
int n, u;
cout << "Enter number of ci es: ";
cin >> n;
string ci es[MAX_CITIES];
Pr-7