Research Article

An Efficient Algorithm to Solve the Conditional Covering Problem on Trapezoid Graphs

Algorithm 1

Algorithm CCP.
Input: A trapezoid graph with a trapezoid diagram and coverage radius 𝑅 .
Output: A conditional covering set 𝐷 in 𝑉 .
 Initially 𝐷 = πœ™ and 𝑖 = 0 .
Step 𝟏 : Compute the sets 𝑇 ( 𝑒 ) , 𝐡 ( 𝑒 ) and 𝑁 ( 𝑒 ) for each vertex 𝑒 ∈ 𝑉 .
Step 𝟐 : Construct the caterpillar. Compute the vertices of the spine and the sets 𝑋 𝑖 for
    𝑖 = 0 , 1 , 2 , … , 𝑙 ; where 𝑙 is the highest length of the caterpillar.
Step πŸ‘ : Compute 𝑝 = 𝑖 + 𝑅 .
   If 𝑑 ( 𝑒 , 𝑣 𝑗 ) ≀ 𝑅 , 𝑗 > 𝑝 + 2 and for all 𝑒 ∈ π‘Œ 𝑖 then
      𝐷 = 𝐷 βˆͺ { 𝑣 𝑗 } such that 𝑗 is maximum, replace 𝑖 by 𝑗 βˆ’ 1 , 𝑝 = 𝑖 + 𝑅 , goto Step 4;
   elseif 𝑋 𝑝 = βˆ… or 𝑒 ∈ 𝑁 ( 𝑒 βˆ— 𝑝 βˆ’ 1 ) βˆͺ 𝑁 ( 𝑒 βˆ— 𝑝 βˆ’ 2 ) for all 𝑒 ∈ 𝑋 𝑝 then
      𝐷 = 𝐷 βˆͺ { 𝑒 βˆ— 𝑝 } , replace 𝑖 by 𝑝 , 𝑝 = 𝑖 + 𝑅 , goto Step 5;
   else 𝐷 = 𝐷 βˆͺ { 𝑒 βˆ— 𝑝 βˆ’ 1 } , replace 𝑖 by 𝑝 βˆ’ 1 , 𝑝 = 𝑖 + 𝑅 , goto Step 5;
   endif
Step πŸ’ : If 𝑝 > 𝑙 then
     𝐷 = 𝐷 βˆͺ { 𝑣 } such that 𝑑 ( 𝑣 , 𝑣 𝑗 ) ≀ 𝑅 and finish;
   elseif 𝑝 = 𝑙 then
     𝐷 = 𝐷 βˆͺ { 𝑒 βˆ— 𝑝 } and finish;
   else go to step 6;
   endif;
Step πŸ“ : If 𝑝 > 𝑙 then
     𝐷 = 𝐷 βˆͺ { 𝑣 } such that 𝑑 ( 𝑣 , 𝑒 ) ≀ 𝑅 and finish;// 𝑒 is the latest selected member
                              of 𝐷 //
   elseif 𝑝 = 𝑙 then 𝐷 = 𝐷 βˆͺ { 𝑒 βˆ— 𝑝 } and finish;
   else go to step 6;
   endif;
Step πŸ” : If 𝑑 ( 𝑒 , 𝑣 𝑗 ) ≀ 𝑅 , 𝑗 > 𝑝 + 2 and for all 𝑒 ∈ π‘Œ 𝑖 then
      𝐷 = 𝐷 βˆͺ { 𝑣 𝑗 } such that 𝑗 is maximum, replace 𝑖 by 𝑗 βˆ’ 1 , 𝑝 = 𝑖 + 𝑅 , goto Step 7;
   elseif 𝑋 𝑝 = βˆ… or 𝑒 ∈ 𝑁 ( 𝑒 βˆ— 𝑝 βˆ’ 1 ) βˆͺ 𝑁 ( 𝑒 βˆ— 𝑝 βˆ’ 2 ) for all 𝑒 ∈ 𝑋 𝑝 then
      𝐷 = 𝐷 βˆͺ { 𝑒 βˆ— 𝑝 } , replace 𝑖 by 𝑝 , 𝑝 = 𝑖 + 𝑅 , goto Step 7;
   else 𝐷 = 𝐷 βˆͺ { 𝑒 βˆ— 𝑝 βˆ’ 1 } , replace 𝑖 by 𝑝 βˆ’ 1 , 𝑝 = 𝑖 + 𝑅 , goto Step 7;
   endif;
Step πŸ• : If 𝑝 > 𝑙 then
     𝐷 is the required solution;
   elseif 𝑝 = 𝑙 then
     If 𝑋 𝑝 = βˆ… or 𝑒 ∈ 𝑁 ( 𝑒 βˆ— 𝑝 βˆ’ 1 ) βˆͺ 𝑁 ( 𝑒 βˆ— 𝑝 βˆ’ 2 ) for all 𝑒 ∈ 𝑋 𝑝 then
        𝐷 is the required solution;
     else 𝐷 = 𝐷 βˆͺ { 𝑒 βˆ— 𝑝 } and finish;
     endif;
   else go to Step 8;
   endif;
Step πŸ– : If 𝑑 ( 𝑒 , 𝑣 𝑗 ) ≀ 𝑅 , 𝑗 > 𝑝 + 2 and for all 𝑒 ∈ π‘Œ 𝑖 and 𝑗 βˆ’ 1 + 𝑅 > 𝑙 then
      𝐷 = 𝐷 βˆͺ { 𝑣 𝑗 } and finish;
   elseif 𝑝 + 𝑅 > 𝑙 then
      𝐷 = 𝐷 βˆͺ { 𝑒 βˆ— 𝑝 } and stop;
   elseif 𝑝 + 𝑅 = 𝑙 and 𝑋 𝑝 + 𝑅 = βˆ… or 𝑒 ∈ 𝑁 ( 𝑒 βˆ— 𝑝 + 𝑅 βˆ’ 1 ) βˆͺ 𝑁 ( 𝑒 βˆ— 𝑝 + 𝑅 βˆ’ 2 ) for all 𝑒 ∈ 𝑋 𝑝 + 𝑅 then
      𝐷 = 𝐷 βˆͺ { 𝑒 βˆ— 𝑝 } and stop;
   else goto next Step;
   endif;
Step πŸ— : If 𝑒 ∈ 𝑁 ( 𝑒 βˆ— 𝑝 βˆ’ 1 ) βˆͺ 𝑁 ( 𝑒 βˆ— 𝑝 βˆ’ 2 ) , for all 𝑒 ∈ 𝑋 𝑝 then
     replace 𝑖 by 𝑝 + 1 and goto Step 3;
   else replace 𝑖 by 𝑝 and goto Step 3;
   endif;