Skip to main content
. 2021 Nov 2;23(11):1456. doi: 10.3390/e23111456
Algorithm 1 DBR
Input: Predecessor predlist, successors succlist, complex network G, source, target, forward business relationships fcrlist, reverse business relationships rcrlist
Output: The optimalpath between the source node and the target node.
  •  1:

    forward_fringe.add(source)

  •  2:

    reverse_fringe.add(target)

  •  3:

    whileforward_fringeandreverse_fringedo

  •  4:

       if len(forward_fringe) <= len(reverse_fringe) then

  •  5:

         this_levelforward_fringe, forward_fringe=[]

  •  6:

         for vthis_level do

  •  7:

            for wNeighbour[v] do

  •  8:

              if wpred then

  •  9:

                 kread_businessrelationship(G,v,w)

  • 10:

                if (fcrlist[v]=1) or (fcrlist[v]=1 and k=1) or (fcrlist[v]=0 and k=1) then

  • 11:

                   forward_fringe.add(w)

  • 12:

                   pred[w]v

  • 13:

                   d[w]k

  • 14:

                 else

  • 15:

                   wv

  • 16:

                 end if

  • 17:

              end if

  • 18:

              if wsucc then

  • 19:

                 if (fcrlist[w]=1) or (fcrlist[w]=1 and p[w]=1) or (fcrlist[w]=0 and p[w]=1) then

  • 20:

                   optimalpathpred+succ

  • 21:

                 end if

  • 22:

              end if

  • 23:

            end for

  • 24:

         end for

  • 25:

       else

  • 26:

         this_levelreverse_fringe, reverse_fringe=[]

  • 27:

         for vthis_level do

  • 28:

            for wNeighbour[v] do

  • 29:

              if wsucc then

  • 30:

                 jread_businessrelationship(G,v,w)

  • 31:

                 if (rcrlist[v]=1) or (rcrlist[v]=1 and j=1) or (rcrlist[v]=0 and j=1) then

  • 32:

                   succ[w]v

  • 33:

                   reverse_fringe.add(w)

  • 34:

                   p[w]j

  • 35:

                 else

  • 36:

                   wv

  • 37:

                 end if

  • 38:

              end if

  • 39:

              if wsucc then

  • 40:

                 if (rcrlist[w]=1) or (rcrlist[w]=1 and fcrlist[w]=1) or (rcrlist[w]=0 and fcrlist[w]=1) then

  • 41:

                   optimalpathpred+succ

  • 42:

                 end if

  • 43:

              end if

  • 44:

            end for

  • 45:

         end for

  • 46:

       end if

  • 47:

    end while