Skip to content

Instantly share code, notes, and snippets.

@madx
Created April 13, 2009 16:55
Show Gist options
  • Save madx/94534 to your computer and use it in GitHub Desktop.
Save madx/94534 to your computer and use it in GitHub Desktop.
while(!all_processed(processed, network->city_c)) {
int u;
Neighbor *tmp;
u = extract_next(djk->marks, processed, network->city_c);
processed[u] = true;
tmp = network->cities[u]->neighbors;
while(tmp != NULL) {
int l;
int v = tmp->city_id;
travel = Travel_next(tmp->travel, djk->marks[u]%(24*60));
if (travel) {
l = djk->marks[u] + travel->arrival - djk->marks[u]%(24*60);
} else {
travel = tmp->travel;
l = djk->marks[u] + travel->arrival - djk->marks[u]%(24*60) + (24*60);
}
if (djk->marks[v] > l) {
djk->marks[v] = l;
djk->prev[v] = u;
}
tmp = tmp->next;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment