Demo entry 6341674

test

   

Submitted by anonymous on Dec 31, 2016 at 14:17
Language: ANTLR With CPP Target. Code size: 1.2 kB.

code for processor Pi,0<=i<=n-1
Var parent:init nil;
   children:init  
   unexplored:init all the neighbors of Pi;
   
   upon receiving no msg:
    if(i=r) and (parent=nil) then
    {
       parent:=i;
       send <already> to all processors in unexplored;
       for all Pj in unexplored;
       remove Pj from unexplored;
       send M to Pj;
    }
    upon receiving <already> from Pj;
    {
       remove Pj from unexplored;
    }
    upon receiving <M> from Pj;
    {
       parent :=j;
       remove Pj from unexplored;
       if (unexplored !=empty) then
       {
           for all Pk in unexplored;
           remove Pk from unexplored;
           send M to Pk;
           send <already> to all prcessors in unexplored;
       }else send <parent> to parent;
    }else send <reject> to Pj;
    upon receiving <parent> or <reject> from neigh our Pj;
    if receiving <parent> then add j to children;
    if unexplored is empty then
    {
       if parent !=i then send <parent> to parent;
       terminate;
    }else
    {
       for all Pk in unexplored;
       remove Pk from unexplored;
       send M to PK;
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).