Talk:Dijkstra's algorithm: Difference between revisions

No edit summary
Line 265:
The line:
 
int i = h->index[v] || ++h->len;
 
Does not evaluate correctly the expression. If h->index[v] == 0 then ++h->len is not assigned to i, instead 1 is assigned. In theory the compiler should assign the right side expression to i but is not working with gcc. For example, the graph:
Line 286:
Will output '5 agde' and is wrong because path '4 abcde' is shorter. Next line fixes the problem:
 
int i = h->index[v] ? h->index[v] : ++h->len;
 
 
== Directed vs undirected graphs ==
Anonymous user