Skip to content

Instantly share code, notes, and snippets.

@arknave
Created October 23, 2015 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arknave/7f1e6fdb132d7a685748 to your computer and use it in GitHub Desktop.
Save arknave/7f1e6fdb132d7a685748 to your computer and use it in GitHub Desktop.
for (int i = 0; i < N; i++) {
dist[i] = INFINITY;
}
dist[start] = 0;
for (int k = 0; k < N - 1; k++) {
for (int i = 0; i < N; i++) {
for (int e = 0; e < adj[i].size(); e++) {
int j = adj[i][e].vertex;
int w = adj[i][e].weight;
dist[j] = min(dist[j], w + dist[i]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment