Skip to content
Snippets Groups Projects
Commit a8a24971 authored by Jiří Škrobánek's avatar Jiří Škrobánek
Browse files

Figure of fat nodes

parent ec003e03
Branches
No related tags found
No related merge requests found
DefaultHead=TeXHead;
real factor = 0.4;
object Node(string l, pair p){
label(l,p*factor);
return draw("", ellipse, p*factor, xmargin=3mm,FillDraw(white,black));
}
void Version(string l, pair p){
draw(box(factor*(p-(0.5cm,0.5cm)),factor*(p+(0.5cm,0.5cm))), black+linewidth(0.2mm));
label(l,p*factor);
}
void Container(pair p){
draw(box(factor*(p-(0.6cm,0.6cm)),factor*(p+(2.6cm,0.6cm))), black+linewidth(0.2mm));
}
object a = Node("A", (-3cm,0cm));
object b = Node("B", (-3cm,-3cm));
object c = Node("C", (-3cm,-6cm));
object d = Node("D", (-3cm,3cm));
Container((0cm,0cm));
Version("1",(0cm,0cm));
Version("2",(1cm,0cm));
Version("4",(2cm,0cm));
Container((5cm,0cm));
Version("5",(5cm,0cm));
Container((0cm,-3cm));
Version("2",(0cm,-3cm));
Version("3",(1cm,-3cm));
Container((0cm,-6cm));
Version("3",(0cm,-6cm));
Version("5",(1cm,-6cm));
Container((0cm,3cm));
Version("4",(0cm,3cm));
pair left(object p){
return point(p,dir(-120));
}
pair right(object p){
return point(p,dir(0));
}
pair top(object p){
return point(p,dir(90));
}
pair bottom(object p){
return point(p,dir(-90));
}
draw(right(a)--(factor*-0.6cm,0cm), Arrow);
draw(right(b)--(factor*-0.6cm,factor*-3cm), Arrow);
draw(right(c)--(factor*-0.6cm,factor*-6cm), Arrow);
draw(right(d)--(factor*-0.6cm,factor*3cm), Arrow);
draw((factor*2.6cm,0cm)--(factor*4.4cm,0cm), Arrow);
draw(arc((-4cm,-3cm)*factor, r=3cm*factor, angle1=270, angle2=90),dotted, arrow=Arrow(TeXHead));
draw(bottom(d)--top(a),dotted,arrow=Arrow(TeXHead));
draw(top(b)--bottom(a),dotted,arrow=Arrow(TeXHead));
draw((factor*1cm,factor*-0.5cm)--(factor*1cm,factor*-2.4cm),arrow=Arrow(TeXHead),L=Label("l", position=MidPoint));
draw((factor*2cm,factor*-0.5cm)--(factor*2cm,factor*-2.4cm),arrow=Arrow(TeXHead),L=Label("l", position=MidPoint));
draw((factor*1cm,factor*-3.5cm)--(factor*1cm,factor*-5.4cm),arrow=Arrow(TeXHead),L=Label("l", position=MidPoint));
draw((factor*2cm,factor*0.5cm)--(factor*2cm,factor*2.4cm),arrow=Arrow(TeXHead),L=Label("r", position=MidPoint));
draw((factor*5cm,factor*0.5cm)--(factor*5cm,factor*3cm)--(factor*2.6cm,factor*3cm),arrow=Arrow(TeXHead),L=Label("r", position=MidPoint));
draw((factor*5cm,factor*-0.5cm)--(factor*5cm,factor*-6cm)--(factor*2.6cm,factor*-6cm),arrow=Arrow(TeXHead),L=Label("l", position=MidPoint));
\ No newline at end of file
......@@ -37,7 +37,9 @@ Multi-threading is easier when there is confidence that existing objects will no
\section{Basic Constructs}
We will explore several easy concepts, which we will later combine to reach optimal persistent pointer-based structure. Before that however, we notice that some data structures are persistent in their default implementation. Take stack for example.
We will explore several easy concepts, which we will later combine to reach optimal persistent pointer-based structure.
Before that however, we notice that some data structures are persistent in their default implementation.
Take stack for example.
\subsection{Persistent Stack}
......@@ -141,6 +143,13 @@ The order in which these allocations are executed can be arbitrary.
We can place an upper bound on the number of newly allocated fat nodes -- total number of vertices in the tree (including deleted vertices).
At most one new slot is occupied for every vertex in the tree.
Consider a tree with one vertex A and a sequence of updates.
First B is inserted as a left child of A, then C is inserted as a left child of B, then D is inserted as a right child of A, finally B is deleted and C becomes left child of A.
These operations are captured by a schema of fat vertices in figure \figref{taf-nodes}.
Inverse pointers for the latest version are dotted.
\figure[fat-nodes]{fat-nodes.pdf}{Fat Nodes}
To take advantage of fat nodes, we need the balancing algorithm to limit the number of vertices that change in one operation.
It is sufficient that the changes can be amortized to a constant number per update.
Furthermore, we need a limit on the number of pointers that can target one vertex at one time.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment