actually i would like to implement it myself. just to practice a little bit.
on paper Dijkstra is so easy but when it comes to an implementation im quite lost.
so maybe lets get more specific. im not that great in abstract thinking
so thats how i would like to do it:
i got a list of structs which contains an ID, a next pointer and a list of structs which contains the edges the current vector has. so it would look something like this
Code:
struct vector
int id
struct vector *next
struct vector edges []
now in my first iteration i check the edges array for the edges.
then iŽll post my result into another list of structs.
Code:
struct result
int fromID
int toID
int jumps (0 at the beginning)
int flag
struct result *next
now iŽll take the first toID out of my result list and search for it in my list of vector structs.
after that iŽll check for the edges again and save/update my result list and set the flag that i visited this vector.
so in pseudocode it may look like this
Code:
method(int start){
int jumps2 = 1;
while( something){
struct vector *ptr = pointer to struct which contains start as id;
k=0;
while(ptr->edges[k] !=NULL){
struct result *ptr2->fromID = ptr->ID;
struct result *ptr2->toID = ptr->edges[k]->ID;
ptr2->jumps = jumps2;
k++;
}
jumps2++;
ptr = the struct which contains the id of the next struct in ptr2;
ptr2=ptr2->next;
}
}
hope you get the idea how i mean to implement this.
would this work?
sorry for some stupid syntax misstakes.
thanks and cya!