#include #include using namespace std; #define INFINITY 9999 #define max 5 void dijkstra(int G[max][max],int n,int startnode); int main() { int G[max][max]={{0,1,0,3,10},{1,0,5,0,0},{0,5,0,2,1},{3,0,2,0,6},{10,0,1,6,0}}; int n=5; int u=0; dijkstra(G,n,u); return 0; } void dijkstra(int G[max][max],int n,int startnode) { int cost[max][max],distance[max],pred[max]; int visited[max],count,mindistance,nextnode,i,j; for(i=0;i