Research Article

Shortest Paths Based Web Service Selection in Internet of Things

Algorithm 6

Expanding neighbors with the same hops in PruningBFSKNN.
PruningBFSKNNMapper ( ):
(1)for all   in   do
(2) emit ;
(3)end for;
(4)for all   in   do
(5)if     then
(6)  return;
(7)else if     then
(8)  
(9)end if;
(10)  emit ;
(11)  end for;
PruningBFSKNNReducer (output of PruningBFSKNNMapper):
(12) for all     do
(13)  Let ;
(14)  for all     do
(15)   if     then
(16)     ;
(17)   else if     then
(18)     ;
(19)   end if;
(20)  end for;
(21)  emit( );
(22) end for