1、如果在有限次的网络拓扑结构变化后,网络拓扑结构保持为常数,那么算法在有限步后终止。
2、当算法终止时,表Nbu[v]满足:
a)如果v=u,那么Nbu[v]=local;
b)如果从u到v的路径存在,那么,Nbu[v]=w,其中w是从u到v的最短路径上,u的第一个近邻。
c)如果从u到v不存在路径,Nbu[v]=udef
3、算法
var Neighu: set of nodes;(*u的邻居*)
Du :arrary of 0...N;(*Du[v] 近似于d(u,v)*)
Nbu :array of nodes;(*Nbu[v] is preferred neightbor for v*)
ndisu :array of 0....N;(*ndisu[w,v] 近似于d(w,v)*)
Initialization:
begin forall w∈Neighu,v∈V do ndisu[w,v]:=N;
forall v∈V do
begin Du[v]:=N;Nbu[v]:=udef end;
Du[u]:=0;Nbu[u]=local;
forall w∈Neighu do send <mydist,u,0> to w
end
procedure Recompute(v):
begin if v=u
then begin Du[u]:=0;Nbu[v]:=local end
else begin (*估计到v的距离*)
d:=1+min{ndisu[w,v]:w∈Neighu};
if d<N then
begin Du[v]:=d;
Nbu[v]:=w with 1+ndisu[w,v]=d
end
else begin Du[v]:=N;Nbu[v]:=udef end
end;
if Du[v] has changed then
forall x∈Neighu do send <mydist,v,Du[v]> to x
end
Processing a <mydist,v,d> message from neighbor w:
{A <mydist,v,d> is at the head of Qwv}
begin receive <mydist,v,d> from w;
ndisu[w,v]:=d;Recompute(v)
end
Upon failure of channel uw:
begin receive <fail,w>;neighu:=Neighu\{w};
forall vv do Recompute(v)
end
Upon repair of channel uw:
begin receive <repair,w>;Neighu:=Neighu∪{w};
forall v∈V do
begin ndisu[w,v]:=N;
send <mydist,v,Du[v]> to w
end
end