PROGRAM 01_ (1)
PROGRAM 01_ (1)
#include <bits/stdc++.h>
using namespace std;
struct Edge {
int vertex;
int weight;
};
struct Compare {
bool operator()(pair<int, int> a, pair<int, int> b) {
return a.second > b.second;
}
};
int totalMinCost = 0;
while (!pq.empty()) {
int u = pq.top().first;
int d = pq.top().second;
pq.pop();
for (const auto& edge : graph[u]) {
int v = edge.vertex;
int weight = edge.weight;
cout << "Total Minimum Cost: " << totalMinCost << "\n";
}
int main() {
int n, m;
cout << "Enter the number of vertices: ";
cin >> n;
vector<vector<Edge>> graph(n);
int source;
cout << "Enter the source vertex: ";
cin >> source;
auto startTime = chrono::high_resolution_clock::now();
dijkstra(source, graph);
cout << "Execution Time: " << duration.count() << " microseconds\n";
return 0;
}
OUTPUT:
PROGRAM 02:
#include <bits/stdc++.h>
using namespace std;
return 0;
}
OUTPUT: