Hi all,
i have been working on the Dijkstra's code for a couple of weeks and i am now puzzled on how to do it this is my code for it so far
void d_run(Table T, Graph G){
Vertex V, W;
V = 0;
W = 0;
for (int i = 0; i < T.V; i++){
int newdist = 0;
int current = 20000;
for (int j = 0; j < T.V; j++)
{
newdist = T.entries[j].dist;
if (newdist < current && (T.entries[j].known == false)){
current = newdist;
V = j;
}
}
if (V == notavertex){
break;
}
T.entries[V].known = true;
// pointer to beginning of list of edges need
// to work out how to read them
T.entries[V].header = G.edges[i];
//T.entries[V].header = T.entries[W].header;
//for (){
if (!T.entries[W].known){
if (T.entries[V].dist < T.entries[W].dist){
T.entries[W].dist = T.entries[V].dist;
T.entries[W].path = V;
}
//return T.entries;
}
printf("%d ", V);
//}
}
printf("\n");
}
it only prints vertices from 5 0 1 2 3 4 6
or someone to explain shortest paths algorithm for dijkstra's
Thank You in Advance