changeset 3 | 0d0e9abd157b |
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/code/dijkstra.code Tue Feb 22 19:02:39 2011 +0100 1.3 @@ -0,0 +1,13 @@ 1.4 +DIST[s]=0; 1.5 +Insert(U,0,s); 1.6 +forall(v:V\{s}) { 1.7 + DIST[v]=infty; 1.8 + Insert(U, infty, v); 1.9 +} 1.10 +while !Empty(U) { 1.11 + (d,u)=DeleteMin(U); 1.12 + forall(e=(u,v):E) { 1.13 + if(DIST[v]>DIST[u]+c(u,v)){ 1.14 + DIST[v]=DIST[u]+c(u,v); 1.15 + DecreaseKey(U,v,DIST[v]); 1.16 +}}} 1.17 \ No newline at end of file