source: trunk/documents/theses/dstn/figs-kdtree/r-only-fig.tex @ 12343

Revision 12343, 3.0 KB checked in by dstn, 14 months ago (diff)

touch up r-only fig

Line 
1\input{kdfigs-tikz}
2\setpagesize{\ronlyfigwidth}{\ronlyfigheight}
3\begin{document}%
4\thispagestyle{empty}%
5\begin{center}%
6\newcommand{\myscale}{0.8}
7\begin{tikzpicture}[scale=\myscale, >=latex]
8  \tikzstyle{box} = [draw, thick, minimum size=\myscale cm, inner sep=0, anchor=west]
9  \tikzstyle{lab} = [anchor=east]
10
11  \tikzstyle{brace} = [anchor=north, inner sep=0]
12  \tikzstyle{lev}   = [anchor=south, inner sep=0]
13
14  \tikzstyle{plusone} = [anchor=west,pos=0.4, font=\footnotesize]
15
16  \begin{scope}[yshift=0.8cm, nodes={anchor=base}]
17    \draw (1,-0.1) node [brace] {$\overbrace{\rule{0.6cm}{0pt}}$};
18    \draw (1,0) node [lev] {1};
19
20    \draw (2.7,-0.1) node [brace] {$\overbrace{\rule{1.2cm}{0pt}}$};
21    \draw (2.7,0) node [lev] {2};
22
23    \draw (5.9,-0.1) node [brace] {$\overbrace{\rule{2.4cm}{0pt}}$};
24    \draw (5.9,0) node [lev] {3};
25
26    \draw (0.4,0) node [lab, anchor=base east] {Level in the tree:};
27  \end{scope}
28
29  \begin{scope}[yshift=-0.2cm]
30    \begin{scope} [xshift=0.5cm]
31      \draw (0,0) node (N0) [box] {0};
32      \draw (-0.1,0) node [lab] {Node index ($i$):};
33    \end{scope}
34    \begin{scope} [xshift=1.7cm]
35      \draw (0,0) node (N1) [box] {1};
36      \draw (1,0) node (N2) [box] {2};
37    \end{scope}
38    \begin{scope} [xshift=3.9cm]
39      \draw (0,0) node (N3) [box] {3};
40      \draw (1,0) node (N4) [box] {4};
41      \draw (2,0) node (N5) [box] {5};
42      \draw (3,0) node (N6) [box] {6};
43    \end{scope}
44  \end{scope}
45
46
47  \begin{scope}[yshift=-1.5cm]
48    \begin{scope} [xshift=0.5cm]
49      \draw (0,0) node (R0) [box] {19};
50      \draw (-0.1,0) node [lab] {Rightmost ($R$):};
51    \end{scope}
52    \begin{scope} [xshift=1.7cm]
53      \draw (0,0) node (R1) [box] {9};
54      \draw (1,0) node (R2) [box] {19};
55    \end{scope}
56    \begin{scope} [xshift=3.9cm]
57      \draw (0,0) node (R3) [box] {4};
58      \draw (1,0) node (R4) [box] {9};
59      \draw (2,0) node (R5) [box] {14};
60      \draw (3,0) node (R6) [box] {19};
61      %\draw (5,0) node (S) [anchor=west] {{\small store these}};
62    \end{scope}
63  \end{scope}
64
65  \begin{scope}[yshift=-3.5cm]
66    \begin{scope} [xshift=0.5cm]
67      \draw (0,0) node (L0) [box] {0};
68      \draw (-0.1,0) node [lab] {Leftmost ($L$):};
69    \end{scope}
70
71    \begin{scope} [xshift=1.7cm]
72      \draw (0,0) node (L1) [box] {0};
73      \draw (1,0) node (L2) [box] {10};
74    \end{scope}
75
76    \begin{scope} [xshift=3.9cm]
77      \draw (0,0) node (L3) [box] {0};
78      \draw (1,0) node (L4) [box] {5};
79      \draw (2,0) node (L5) [box] {10};
80      \draw (3,0) node (L6) [box] {15};
81      %\draw (5,0) node (DS) [anchor=west] {{\small don't store these}};
82    \end{scope}
83  \end{scope}
84   
85  \draw [->, thick] (R1.south) to node [plusone] {+1} (L2.north);
86  \draw [->, thick] (R3.south) to node [plusone] {+1} (L4.north);
87  \draw [->, thick] (R4.south) to node [plusone] {+1} (L5.north);
88  \draw [->, thick] (R5.south) to node [plusone] {+1} (L6.north);
89
90  %\draw [->, thick, shorten >=0.2cm] (S.west)  to (R6.east);
91  %\draw [->, thick, shorten >=0.2cm] (DS.west) to (L6.east);
92\end{tikzpicture}%
93\end{center}%
94\end{document}
Note: See TracBrowser for help on using the repository browser.