Assignment 6
Assignment 6
h>
#include <limits.h>
return min_index;
int dist[V]; // Output array to hold the shortest distance from src
int sptSet[V]; // sptSet[i] will be true if vertex i is included in the shortest path tree
// Initialize distances to INFINITY and sptSet[] as false
dist[i] = INT_MAX;
sptSet[i] = 0;
dist[src] = 0;
sptSet[u] = 1;
// and the total weight of path from src to v through u is smaller than dist[v]
if (!sptSet[v] && graph[u][v] && dist[u] != INT_MAX && dist[u] + graph[u][v] < dist[v]) {
}
}
printSolution(dist);
int main() {
int graph[V][V] = {
};
printf("\n");
return 0; }
#include <stdio.h>
if (dist[i][j] == INF)
printf("INF ");
else
printf("\n");
int dist[V][V];
dist[i][j] = graph[i][j];
// Compute shortest paths
printSolution(dist);
int main() {
int graph[V][V] = {
{8, 0, 2, INF},
};
floydWarshall(graph);
return 0;