Professional Documents
Culture Documents
h>
#include <stdlib.h>
#include <limits.h>
// A utility function to find the vertex with minimum distance value, from
return min_index;
int i;
return x<y ? x : y;
}
int i, res = 1;
return res;
// memset(visited, 0, V * sizeof(int));
int i;
dist[src] = 0;
// for(i=0;i<V;i++){
// for(v=0;v<V;v++)
// printf("%d ",graph[i][v]);
// printf("\n");
// }
while(!allVisited(V, visited)){
visited[src] = 1;
printSolution(dist, V);
int main()
int **graph;
int V,src,i,edges,snode,enode,weight;
scanf("%d",&V);
scanf("%d",&edges);
for(i=0;i<V;i++)
printf("Enter the start node, end node and weight of edge no %d\n",i);
scanf("%d%d%d",&snode,&enode,&weight);
*(*(graph+snode)+enode) = weight;
*(*(graph+enode)+snode) = weight;
scanf("%d",&src);
return 0;