Skip to main content
. 2024 Feb 27;26(3):208. doi: 10.3390/e26030208
Algorithm 1 Coding tree with height k via structural entropy minimization.
Input: a graph G=(V,E), a positive integer k>1
Output: a coding tree T with height k
  • 1:

    Generate a coding tree T with a root node vr and all nodes in V as leaf nodes;

  • 2:

    // Stage 1: Bottom to top construction;

  • 3:

    while|vr.children|>2do

  • 4:

       Select vi and vj from vr.children, conditioned on

         argmax(vi,vj){HT(G)HTMERGE(vi,vj)(G)};

  • 5:

       MERGE(vi,vj);

  • 6:

    end while

  • 7:

    // Stage 2: Compress T to the certain height k;

  • 8:

       while Height(T)>k do

  • 9:

         Select vi from T, conditioned on

         argminvi{HTREMOVE(vi)(G)HT(G)|

                    vivr&viV};

  • 10:

         REMOVE(vi);

  • 11:

    end while

  • 12:

    // Stage 3: Fill T to avoid cross-layer links;

  • 13:

    for viT do

  • 14:

         if |Height(vi.parent)Height(vi)|>1 then

  • 15:

              insert a new node vε between vi and vj;

  • 16:

         end if

  • 17:

    end for

  • 18:

    return T;