Skip to main content
. 2017 Sep 15;17(9):2126. doi: 10.3390/s17092126
Algorithm 3 Optional Path Selection Function
  • Input: 

    The set of optional paths Pf of all flows F

  • Output: 

    A selected optional path p and its corresponding flow f

  • 1:

    for each pP do

  • 2:

      Calculate the count, restsize, and cap of p;

  • 3:

    end for

  • 4:

    Arrange P in ascending order according to count;

  • 5:

    Initialize i0, a temporary set of optional paths PtØ;

  • 6:

    for i=0;i|P|;i++ do

  • 7:

      if count[i]==count[0] then

  • 8:

       PtPt+P[i];

  • 9:

      end if

  • 10:

    end for

  • 11:

    Arrange Pt in descending order according to r¯ and restsize;

  • 12:

    for i=0;i|Pt|;i++ do

  • 13:

      if restsize[i]>0 then

  • 14:

       break;

  • 15:

      end if

  • 16:

    end for

  • 17:

    returnpP[i] and the corresponding flow f.