BWbwchen/Coding_Practice

The cost array of bellman-ford algorithm should be the previous time record

BWbwchen opened this issue · 0 comments

for (int adjecent = 0; adjecent < vertex; ++adjecent) {
if (graph[n][adjecent] != MAXN &&
cost[n] + graph[n][adjecent] < cost[adjecent] ) {
pi[adjecent] = n;
cost[adjecent] = cost[n] + graph[n][adjecent];
}
}