Procedure path_algorithm ( ){
    calculate the transition probability for each
path by the formula (1);
random=Rnd();
 if( < random < )
choose the path to the sink
}
Procedure update pheromone algorithm
{//the node receives the ACK successfully
if( =node.hop){ // the node.hop in the Sink
; node.hop = ;
}
;
if( > th)
 calculate the volatilization coefficient by the
formula (6);
Else
;
 calculate the correction value by the formula (5);
update the pheromone by the formula (2);
}
Algorithm 3: Distributed ant colony algorithm.