Polychotomic Encoding - Semantic Scholar

Report 1 Downloads 312 Views
Polychotomic Encoding: A Better Quasi-Optimal Bit-Vector Encoding of Tree Hierarchies

Robert E. Filman

RIACS Technical Report 02.02 April 2002

16th European Conference on Object-Oriented Programming (ECOOP-2002), Málaga, Spain, June, 2002

Polychotomic Encoding: A Better Quasi-Optimal Bit-Vector Encoding of Tree Hierarchies

Robert E. Filman, RIACS RIACS Technical Report 02.02 April 2002

Polychotomic Encoding is an algorithm for producing bit vector encodings of trees. Polychotomic Encoding is an extension of the Dichotomic Encoding algorithm of Raynaud and Thierry. Polychotomic and Dichotomic Encodings are both examples of hierarchical encoding algorithms, where each node in the tree is given a gene—a subset of {1,…,n}. The encoding of each node is then the union of that node's gene with the genes of its ancestors. Reachability in the tree can then be determined by subset testing on the encodings. Dichotomic Encoding restructures the given tree into a binary tree, and then assigns two bit, incompatible (chotomic) “genes” to each of the two children of a node. Polychotomic Encoding substitutes a multibit encoding for the children of a node when the restructuring operation of Dichotomic Encoding would produce a new heaviest child (child requiring the most bits to represent a tree of its children) for that node. The paper includes a proof that Polychotomic Encoding never produces an encoding using more bits than Dichotomic Encoding. Experimentally, Polychotomic Encoding produces a space savings of up to 15% on examples of naturally occurring hierarchies, and 25% on trees in the randomly generated test set.

This work was supported in part by the National Aeronautics and Space Administration under Cooperative Agreement NCC 2-1006 with the Universities Space Research Association (USRA). © Springer-Verlag, http://www.springer.de/comp/lncs/index.html This report is available online at http://www.riacs.edu/trs/

                                      

   !"# $%%%     

 &'   (  )   )     ) *

    )  % &'   (  )   +      ,    (  ) )   '     - '% &'     ,    (  )  *  +       ) )  .      )    /  *  0 % -   )          1 )  .   )      % *  '     *    *'  *  )     )% ,    (  )      )     * '   

  )  . *  * 2  3 4) 5    

.     % &'   (  )  *     *

  )        .      )    ,    (  ) .     .     2  6  )   *          3   % -       &'   (  )       )  )  *   ,    (  )% (+  ' &'   (  )      )    0#7  +    '   )      #7     ' )     % 

   

                  

                                             !           "#   "#  $           %                       $      $                Æ  $                 &                                      %        &             '( ) * +, -          .     '/ 0, 1              2  % 

{} {1}

{2}

{1,3} {1,4}{2,3} {2,4}{2,5}

   *     )        &     3                  $                                                   "     #                       $      "    # 4 $   $           5          "6#    6              1     "1#      

 5  ' ,   (   "    #    2     '7, "248# %   6       1     

9       $    $      "   

           #                  6                 :   1     %  *      6                  1     :   6            ;<  1           :           (;<         

 



           =:           > "  # 5              ?      >         > >   @                      ": $    #    :               &    $          5                     $       5            A                                               $      $      

 %            

 "         -.# $        "       %.# 4        &         &                    &     $                                         

 %              &   B    3             A

               @@   ' ),    

.                                      "    # 

 $     5     " #           $         5               $      %               (    ' , $   A          5                         %                         &      5                    $       5         

        $              5        C       $        5     $                                                  5     ( "   $     ' +,  '+ ,#  $   $     D     (   0   7 ( 0 ( 7

 0 7 "' ++, ' + +, ' ++ , '+ +, '+ + ,  '++ ,#     :      .               " #   "#

 $                                                "5     $              # 5 $         C   

  "#   "#

    ?         E   "#                  "# 5   

{} {2} {1,3,5,7} {1,3,5,8} {1,4,5,7} {1,3,6,8}{1,4,5} {1,4,6}

Complete code

{2,3,5} {2,3,6} {2,4}

{} {2} {1,3,5,7} {1,3,5,8} {1,4,5,7} {1,3,6,8}{1,4,5} {1,4,6}

Reduced code {3,5} {3,6} {4} 00000000 01000000 10101010 10011010 10011000 10101001 10100101 10010100

Bit vector

01101000 01010000 01100100

  -      *     )     

 " #   "#    

                      " #   "#         "                :    # %      

                    "     #               5    " #

  " #   E            

        9   4                         %           9                  "#              "#   "# 











   

5           

         $     "# 5    

  E  

      

 !    $   "       #       :                              Æ  FGH    ' ,        $      

                                     

            -.     $  2   '0, 5  $        2  9   $          

       $           

             $      

         I            

     :

  J  4  H ' 7, :       2     =                    4$            K  L        @             $ $                     :          5                          2      '7,   =     

       5      $ $                    -           $      5   1     ' , 1              :        1           %  ; 5    M           5   $  $                     : 5        

   

          :        $                             5                "   %.  

#  $   "  %.  #                     Æ    N                          %.        "%   # ' (, 

 $        

 :                    :  :     "  $     # !  %     





  

29   ';,             

       "     #             .                                 

    ' , >  J  4  H ' 7,  N 29     6    "6# $                    

    B    3 ' ), :     6 $   Æ          6O

     

   2@@6     5  ' ,      

  "   

              #            1          

           $      (    "     #            5                                   $           $

   .                      :       5                      "# $  $   .                    P        P                  P   0

      $              

                       

    

   

          

       ) ) % 248        $                         1                       

   $                 $    '     ,    ? "  #    $  "       #      8 $       $  + 8 $     $         8 $  $   $  (            $     $           $      $ K L     " #  "  # .  

$   " $  P (#            

             5              $   5         

G A0

B0

C0

D0

E0

2

F0 H0

I0

J0

2

2

D0 E0

F0

G4 2

A0

B0

C0

H0

J0

I0

G4 A0

B0

C0

D0

E0

F0 2

2

2 H0

I0

E0 A0

2

B0

G4

2

4

J0

C0

F0 H0

D0

2

J0

I0

G4 C0

D0

E0

F0

8 2

A0

J0

B0 H0

I0

2

2

E0

B0

C0

E0 J0

D0 H0

A0

B0

2

2

2

G4

F0

G4 2

4

2 A0

6

C0

D0

I0

  ,    (  ) .  . ) 

F0 H0

I0

J0

  "  0#       5       D :            $   D            1     5             $        7    1      5  ? $         $     $     .   2@@6       5             N      1                                    5        @@     1      0M0/<            J4H .        $          '       , $     5                D  

     5             5   $   " '          ,#      $  9   $         9  5                   ( -        1          ?

 " #             $      $    " #     +

 > +  P 

 > 

"  # >  ( P   "'       P (      ,#



> ((         

     1          Æ   :     $      $      *    1        A

    5         248    ; 1           $        $ 

       E  Æ         

  !  $       $    $          $       & $          9 $  @     1         $          $       E    ?

            $          6             .    1       $  N   $       &     1   $  $               $  $                  $     $      .  9  1         $     .  $    &      

      "248#           ;

        6     

G A0

B0

C0

D0

E0

2

F0 H0

I0

J0

A0

B0

A0

C0

D0

E0

D0 E0

F0 H0

4

G3

I0

2

G3

F0 H0

I0

J0

F0 H0

B0

2

C0

G3 2

2

I0

2

2

J0

E0 A0

B0

C0

J0

D0 7

2

A0

B0

G3

2 E0 C0

D0

4

F0 H0

I0

2

J0 A0

B0

C0

5 2

2

D0 E0

F0 H0

G3

I0

J0

  &'   (  ) 5    ?      A        C

 "# >





 (

> (  







"( #

8     $                   C 0 "#  " P (# 7 "# 5   Q"#   K L   E            A    Q"# >         " #   5 Q"R# > Q" +# > ;D Q" # > / @              $     " # 5 6     $     +

 > +  P 

 >    " # >  ( P 

 > (   "'       P (     ,#   (  P (   P Q"#

  (  P (  

      ! 

5       :   6             1           $   

D           $            

           "5                      D   N                       # 5   $       6          1         

 6        &        $   1     5      :  "&    

     #               .  $    K  L                        :   5  $       :              

 .                

"

# "       # $        

5  %      6                 1     "@         $# 5       $          $     " # " #    =         >    >   5    =                         .  $        =    :                   $ 6  1  AC  =          

               > '      ,  > (

" # >  P ( >  P (   6         N  >   > '   ,   ?     " # >  P (        " #

"'            ,# > "'           P (,# > "'           P (  P (,#    (  > "' P (  P (       P (  P (,#      N (  > " P (# P ( "(# .     >  P (   





      > '      ,   0

" # > 

P (   6        N     %  =      N 0

"'     ,#> "'   P (,# >  P 7 >  P (  0 >     P (  0 









       =       N   !     C " #      $  ( "(#    $  $  "0#    !      $  (

"'            ,# >  P (    >  P (    $  (    >   >   P (   >     P (   

 





   (  0  (            =  $                  $  (

"'            ,# > "'           P (,# > "'           P (  P (,#    (  > "' P (  P (       P (  P (,#  =     (   >       P ( P ( "(# .             >       P ( P ( "(# >      P ( P ( "(# >     P ( "# 









 



 





















 " @ 

"'            ,# > "'           P (,# > "'           P (  P (,# 

 

 (  > "'   P (       P (   P (,#  =     ( P    >           P ( P ( "" P #(# .      (            >          P ( P ( "" P #(# >        P (   >     P (   







 









 



 







 

 









  

P (   "'       ,#  P (  

5   $   (   (      

 



    =      ( 

   " # " #

6      (  " # > " #   > 0 $       > '     , .  P (    " # > " # .  P (   

" # > "'   P (,# >  P 7  " # >  P Q"0# >  P 0 .  P (      P 7   P (  "  $9   $   #  P 7   P 0 %         0  " # " # 5   $        =      N   ) H        (          

    : ! #  ; 9 



8  8!  8!  8  8  8  8  89



8  8:  8!  8!  8! 8#  8#

8#

































   0" 00 0 0: 0! 0# 0 0;



89 8 9 8 9  8 9  8 9  8 9  8 9  80"



8# 8  8  8  8  8  8  8













   



    

  ,      &'   (  )    P Q"# 5   $        N /     $            $             Q $   

   (   $    $       4$ $  

   (   Q $    ("( # " $     

 #    @ =       .   " # > ( " #D   =      $      % &

     

6              1     

 $    $        $                 ( 1       *  D 6      )    248 "      #  ) 4$         :                     $                  /    "  /# 5    3 6     "36#    C                         $    $                    :  $   

      E                              E   ?      $        6 !  $       6    $   36      %  +          ' !    ( 

5   $   :        C  :        K  L        " :                #            8             &           .          $ 

              5  :      248 1     6      3 6                  ? :  

 $C J  !(  1   0 %-5H*+     D  :    8:%   D  5PP      D   S  0     5 ?         ' 7, 

 :     .        $          :    -

" ' /,          #

{} {2} {1,3,5,7} {1,3,5,8} {1,4,5,7} {1,3,6,8}{1,4,5} {1,4,6} {2,3,5} {2,3,6} {2,4}

Dichotomic Encoding {} {2,4} {1,3,5} {1,3,6} {1,4,5} {1,4,6} {2,3,5} {2,3,6} {2,4,5} {2,4,6} {2,4,7}

Polychotomic Encoding {}

{2} {1,3,4} {1,3,5} {1,3,6}

{1,4,5} {1,4,6} {1,5,6} {2,3} {2,4} {2,5}

Greedy Polychotomic

        )    +   (, ) ?: @ 0%:  A  B?

  +=  = ,= +>  > ,> :00 :;0 0:#; 0!;9 0#;

# 9 !:! :"; #

0! 9; 0! #; 090

!%; !%#0 :%0 !%90 :%0

0;%#;9 00%0:0 %9;: :%9"! 0"%!""

; 9 0: ; 0#

"#

0!:0

0#0

!%:

9%9

;

!% 0%0:"

0

0;;"

#

:;%9! ;%:"

!

:%; "%0;"

@ 0%:   ' 09" "0";#  ,  ::0:" "0";#  ,  00!#9

 0;: 0;"; :0: ;9 0;!

0%9 ;% 0%!" 0%::9 0#%; #!%!##

9 0: 0#

!%9# 0%"0 %"0 %"0 ;%09 0%9#

,  ! .    ,   .   !

# 0:#

! 

:%9" "%!9 #% "%!

    ,.    

  

0### #!0

 !

%"" !%""

"%""" "%"""

%: :% #%: %!; %:

0%0# 0%:# %0" 0%#" %"#

C'DD  E  %  E   2   3 % += E +   *  )  %  = E )   *  )  % ,= E       *  )  % +> E +    ) %  > E   ) % -, E        ) %

  - & 

  :          $   1!.8 $   ' ;, !            5     

              A  #    "             #   ?         ?              "   # 5    ?   $     $                         $    

"    #                                             

                        $                          :     K    L K    L     

   $    ?      S  0       ? T     2     S  (; (++  .    $ K2   L        7   /         /   7 5   (          D 5   0                     5 :      6       $     1      $             6  1             

  9     5 K&   L   ) $       1  6         :    0+  $           5 :  $   $    N  (++ (+++ (++++  (+++++D         ( * 0(  (*      

              "  $ & #    "   & #  $     "   & # 5       &             1    D  $             6     J     &    K L        $   5    $      &            6        $   $   $                          N       

                  6    $            

   +      )    .   F *'  *    * )     *  )              *  )  % 2 2 33% B E "  )  .  G  )     % H .   I     * )   .  *  ' ? .   )                  * %          %         .  '     )    *'  ? )    )           ' ?  )      %   















;!%! #%! !%"

!%" !0%9 !"%!

:% :9% :9%

:9%" :9%" :9%"

;:%9 #9%! !%

:;%9 :% :!%;

:0%# :0%! :"%:

9%# 9% 9%"

#%; !#% :9%

:!%0 ::%# :%#

:%" :%" :0%;

:"% :"%! :"%

:"%0 %: ;%

#%! #%" !%!

:%" % %#

#%; #% !%;

!%" !%" !%"

!%" !%" :%

:9%9 :%! %;

% %0 0%0

0%: 0% 09%

0;% 0;%# 0;%:

:%: "% 0%

0;%! 0;%# 0;%

0% 0% 0%

0%" 0%0 0%"

%; 0%9 0;%#

0#%" 0!%; 0!%!

0% 0:%" 0%9

0%: 00%; 00%"

"" """

" """

%  #%0 !!%; :%! #  :%! ::%# 9%; 

 """

"" 

9 : !" "# " $

09

 & ,      &'         % ( * .

     *  *  6  *' ,(  *' &(% -  G   ' .    .             *  )   2

      .    %3

>

,(

&(

I&(

: # !0 9 #9

:  " " ::

0 9 " 0 :0

0 :"  09 :#

!0

:"





:"

:

9

;

@ 0%:   ' "0";#  ,  "0";#  , 

!" " ;:

; :9 !:

: :: :9

: : !"

,   .   ! ,  ! .   

! 0

! !

! 0

! 0

   @ 0%:  , ) ?: (+   A  B?

    ,.    

  

C'DD > E   *   )% ,( E ,    (  )% &( E &'   (  )% I&( E I' &'   (  )%

  )         

5       6             1            5  6              :     "   #     "5            

    ?       86  'R, 5  Æ   

    #           $  $                                               $         $   A   5  $  B    3  6O ' ),                 ) *  

-    2

  1

      5   6   @        5    &  5                        2     $   1!.8    

( +   

0% JK C >% =' % L  &%    %% (Æ      

   % 

0 2@ % 093 00#M0!% % =? >%  ,   &    L 1 $=-N&(& &  %         2 % 03 0#;M0"% :%  N% (Æ    )          %     2B )  ,%% 0:3 ;0M9;% !%  N% >* * %    L%   '   H% (  )                %      0 203 #"M% #%  % >% -'+       *      % 

 2003 M% %  ? %   C -% -   *     )% !" #$  2 * 09#3 "!M"% ;% I*) %   * ,% %$&' (        B'  ) % 209"3% 9% I ) @% @' =%   I%   = I% ( )   * " # +     B'  )  2"""3% % >* * %      L% =     )   '    ,-./ L  9:0  )A) = 20!3 0M0% 0"% C  % (% 0       '  1 2    %   B'  )  

 2093% 00% '   H%   - ' (%  6    *     )      %     Æ  '     %   + #&& L "; = D  )A) 2""03 0#M09"% 0%  * L% C% &?  % %   - ) L% ,  ) ' 

       % +++  3 0" 2H * 09:3 #:M"% 0:%  ? % (%       *' '   %    $ L  ) ) C  L    209#3 0090M009% 0!% A ? @% > % %   C % (Æ  '     %    4    2H * 0;3 0!M0#;% 0#% B  @%   % (%   C' ,% @% -     ,B ' %   !          ' 2 """3 ;0M;;% 0% B  ,% (%    ,% % 2(%3% !   5 ( 6%       & B )  ,%% 0:% )D  )% % ""%   

0;% O * N%   I  @% (Æ   * ' )   .  &P(  )%    #&& -   2H * ""03 M0"%

Recommend Documents