Ada PGM 4
Ada PGM 4
Ada PGM 4
// algorithm.
#include <stdio.h>
#include <stdbool.h>
#define INF 99999
#define V 5 // Number of vertices
// A function to find the vertex with the minimum distance value, from the set of
vertices not yet included in shortest path tree
int minDistance(int dist[], bool sptSet[]) {
int min = INF, min_index;
return min_index;
}
dist[src] = 0;
printSolution(dist);
}
// Driver code
int main() {
int graph[V][V] = {{0, 9, 6, 5, 3},
{9, 0, 0, 0, 0},
{6, 0, 0, 0, 0},
{5, 0, 0, 0, 0},
{3, 0, 0, 0, 0}};
dijkstra(graph, 0);
return 0;
}
Dijksta's 2
#include <stdio.h>
#include <limits.h>
return minIndex;
}
// Function to implement Dijkstra's algorithm for a given graph and source vertex
void dijkstra(int graph[MAX_VERTICES][MAX_VERTICES], int src, int vertices) {
int dist[MAX_VERTICES]; // The output array dist[i] holds the shortest distance
from src to i
int sptSet[MAX_VERTICES]; // sptSet[i] will be true if vertex i is included in
the shortest path tree or the shortest distance from src to i is finalized
int main() {
int vertices;
int graph[MAX_VERTICES][MAX_VERTICES];
int source;
return 0;
}