Skip to main content
. 2023 Jan 31;23(3):1556. doi: 10.3390/s23031556
Algorithm 2: SLE for SPA preparation
  • 1:

    Input:GP=(NP,EP),Li,j of all EP

  • 2:

    Output:SPA

  • 3:
    Set,
    • SN: source node
    • DN: destination node
    • K: the number of shortest paths between SN and DN
    • Pu: a path from SN to u
    • SPA: a heap structure keeps paths
    • P: set of shortest paths from SN and DN
    • countu: number of shortest paths for node u
  • 4:

    Initialize, P=empty,countu=0,L=0

  • 5:

    for all u node in NP do

  • 6:

       Insert path PSN=SN into SPA with cost 0

  • 7:

    end for

  • 8:

    whileSPAxxxempty&&countDN<Kdo

  • 9:

       SPA=SPAPu

  • 10:

       countu++

  • 11:

       if u=DN then

  • 12:

         P=PUPu

  • 13:

       end if

  • 14:

       if countuwwwK then

  • 15:

         for each EP adjacent to node u do

  • 16:

            Pv new path with L=L+Li,u

  • 17:

            Insert Pv into SPA

  • 18:

         end for

  • 19:

       end if

  • 20:

    end while

  • 21:

    returnSPA