Skip to main content
. 2025 Oct 23;25(21):6534. doi: 10.3390/s25216534
Algorithm 1 Dijkstra-based upload routing in time instant t.
  • Require: 

    Directed graph G(t)=(V,E(t),(t)) with (t)(u,v)>0; UD index set N={1,,N}; BS index 0

  • Ensure: 

    For each iN: shortest upload path Pi0(t) and time T(t)(i)

  •  1:

    Build in-neighbor adjacency: for each (x,y)E(t), append x to InNbr(y) and store (t)(x,y)

  •  2:

    Initialize: for all vV, set d(v)+, pred(v); set d(0)0

  •  3:

    Initialize a min-priority queue Q keyed by d(·) and insert 0

  •  4:

    while Q not empty do

  •  5:

        uQ.ExtractMin()

  •  6:

        for all vInNbr(u) do

  •  7:

            dd(u)+(t)(v,u)

  •  8:

            if d<d(v) then

  •  9:

               d(v)d, pred(v)u

  •   10:

               if vQ then

  •   11:

                   Q.DecreaseKey(v)

  •   12:

               else

  •   13:

                   Q.Insert(v)

  •   14:

               end if

  •   15:

            end if

  •   16:

        end for

  •   17:

    end while

  •   18:

    Output per UD

  •   19:

    for all iN do

  •   20:

        if d(i)=+ then

  •   21:

            Pi0(t)[]; T(t)(i)+

  •   22:

        else

  •   23:

            path[i], vi

  •   24:

            while v0 do

  •   25:

               vpred(v); if v= then path[]; d(i)+; break

  •   26:

               append v to path

  •   27:

            end while

  •   28:

            Pi0(t)path; T(t)(i)d(i)

  •   29:

        end if

  •   30:

    end for

  •   31:

    return {Pi0(t),T(t)(i):iN}