View
227
Download
0
Category
Preview:
Citation preview
8/3/2019 Succinct Trees
1/19
M. S. Ramaiah School of Advanced Studies 1
Succinct Trees
Sivaramaiah.B.V
CJB0910006
M. Sc. (Engg.) in Computer Science andNetworking
Module Leader: N.D.Gangadhar
Presentation
8/3/2019 Succinct Trees
2/19
M. S. Ramaiah School of Advanced Studies 2
Max marks score
Technical content 10
Grasp and
Explanation
10
Slides and Delivery 10
Q &A 10
8/3/2019 Succinct Trees
3/19
M. S. Ramaiah School of Advanced Studies 3
Contents
Introduction to Trees
Succinct Trees
Representation of Trees LOUDS Representation
Balanced Parentheses
DOUDS Representation
8/3/2019 Succinct Trees
4/19
M. S. Ramaiah School of Advanced Studies 4
Introduction to Trees
Trees are the most fundamental objects which stores a
large amount of data.
Standard representation of the binary trees on n nodes
using pointers take O(n log n) bits of space.
The extra space 2n is needed in order to support constant
time navigation between tree nodes.
8/3/2019 Succinct Trees
5/19
M. S. Ramaiah School of Advanced Studies 5
Succinct trees
Succinct trees takes only 2n+O(n) bits and support
constant time computation and a set of Query operations:
Parent(x): returns the parent of node x.
Degree(x): returns the degree i.e. number of children of
node x.
Child(x,i): Ith child at node x.
Depth(x): height or distance from root x.
LevelAncestor(x,d): return the ancestor of x with depth d.
8/3/2019 Succinct Trees
6/19
M. S. Ramaiah School of Advanced Studies 6
.
Binary tree representation
A Binary Trees on n nodes can be represented using
2n+O(n) bits to support:
1) Parent
2) Left child
3) Right child
in constant time.
8/3/2019 Succinct Trees
7/19M. S. Ramaiah School of Advanced Studies 7
Ordered trees
A rooted ordered tree of n nodes:
Navigational operations are
- Parent(x)=a
- first child(x)=b
- next sibling(x)=c
Other operations are
- degree(x)
- sub tree size(x)
x
a
c
b
8/3/2019 Succinct Trees
8/19M. S. Ramaiah School of Advanced Studies 8
LOUDS Representation
Louds is Level Order Unary Degree Sequence.
This is the name because of traversing the tree in level
order and writing the sequence of each node in unary
order.
The node with 3 children is written as 1110.
The parent and child can be formulated as
parent(x)=1+rank0(select1(x))
child(x)=rank1(select0(x-1)+k)
8/3/2019 Succinct Trees
9/19M. S. Ramaiah School of Advanced Studies 9
LOUDS contd..
The example for LOUDS is given below
8/3/2019 Succinct Trees
10/19M. S. Ramaiah School of Advanced Studies 10
LOUDS contd..
Now computing parent(7), for the first we need to calculateselect1(7).
Select1(7)=10, which is one corresponding position of the
node g.
Next is Rank0(10)=3, which gives the number of 0spreceding the unary degree of g parent.
Gs parent position is 1+Rank0(10)=4 and the node is D.
8/3/2019 Succinct Trees
11/19M. S. Ramaiah School of Advanced Studies 11
Balanced Parentheses Representation
This representation is obtained by traversing the tree by depth
first order writing a left parentheses when node is encounteredfirst and a closing parentheses when the same node is
encountered again while going up after traversing the sub tree.
The directions of parentheses is shown
in figure.( )
( )( ) ( )
( ) ( )
( )
( )
( )
8/3/2019 Succinct Trees
12/19M. S. Ramaiah School of Advanced Studies 12
Balanced Parentheses Representation
The operations are
- Parent(x)=Rankopen(enclose(selectopen(x)))
-subtreeSize(x)=(Findclose(selectopen(x))-selectopen(x)+1/2)
-firstchild(x)=x+1
-Rightsibling(x)=Rankopen(Findclose(selectopen(x))+1)
8/3/2019 Succinct Trees
13/19M. S. Ramaiah School of Advanced Studies 13
Balanced Parentheses Representation
The example is
8/3/2019 Succinct Trees
14/19M. S. Ramaiah School of Advanced Studies 14
Balanced Parentheses Representation
For the computation of parent(6), selectopen(6) should be
computed.
Selectopen(6)=8, which is the position of open parentheses
associated to node j.
Then, enclose(8)=3, which is the position of the closestopen parenthesis associated to js parent.
At last Rank(3)=3, we get the identifier js parent.
8/3/2019 Succinct Trees
15/19M. S. Ramaiah School of Advanced Studies 15
Balanced Parentheses Representation
Another computation is finding the SubtreeSize(9).
Selectopen(9)=16, which is the position of the ( of the
node d.
Findclose(16)=23, which is the position of ) associated
to d.
Then the SubtreeSize=(23-16+1)/2=4.
8/3/2019 Succinct Trees
16/19M. S. Ramaiah School of Advanced Studies 16
DFUDS Representation
DFUDS is Depth-First Unary Degree Sequence.
DFUDS combines both LOUDS and BP representation and
benefits of both.
Due to the combination of both representation, it is able to
support all the query operations with in the (2n+O(n)) bits.
8/3/2019 Succinct Trees
17/19M. S. Ramaiah School of Advanced Studies 17
DFUDS Representation
The example is shown below
8/3/2019 Succinct Trees
18/19M. S. Ramaiah School of Advanced Studies 18
Reference
[1] Mehta, D.P and S. Sahani (Eds.),Handbook of DataStructures and Applications, Chapman & Hall/CRC, 2005
[2] Jiri Fiala, Jan Kratochvil and Mirka Miller (Eds.),
Combinatorial Algorithms, Springer-Verlag Berlin
Heidelberg, 2009
8/3/2019 Succinct Trees
19/19M S Ramaiah School of Advanced Studies 19
Thank U
Recommended