分布式计算-具有近邻知识的深度优先搜索

1、如果进程知道近邻的标识,通过在令牌中包括一张访问过的进程的表,就可避免令牌对非树边的遍历。进程p接到带有表L的令牌,并不将令牌转发给L中的进程。

2、算法

var fatherp:  process init udef;

for the initiator only,execute once:

     begin fatherp=udef then fatherp:=q0;

               send <tlist,{p}> to q

     end

 

for each process,upon receipt of  <tlist,L> from q0:

       begin if fatherp=udef then fatherp:=q0;

                 if 存在q∈Neightp\L

                    then begin choose qNeighp\L;

                                      send <tlist,L∪{p}> to q

                             end

               else if p is initiator

                      then decide

                      else send <tlist,L∪{p}>  to  fatherp

     end

你可能感兴趣的:(算法)