Jump to content

User:Brona/Images/fibonacci heap.tex

From Wikipedia, the free encyclopedia
%Example of fibonacci heap.
%
%latex fibonacci_heap; dvips fibonacci_heap
%open .ps file in gimp, choose strong antialias in both text and graphics,
%resulution 300, crop, blur by 1, scale to 50%, indexed mode, save as .png
%
\documentclass[12pt]{article}
\usepackage{pstricks}
\usepackage{pst-node}
\usepackage{fullpage}
%
\newrgbcolor{myblue}{0.7 0.8 1}
\def\NODE(#1,#2)#3{\cnode(#1,#2){.35cm}{#3}\rput(#1,#2){#3}}
\def\MARKED(#1,#2)#3{\cnode[fillstyle=solid,fillcolor=myblue](#1,#2){.35cm}{#3}\rput(#1,#2){#3}}
\def\ya{3.6}\def\yb{2.4}\def\yc{1.2}\def\yd{0}\def\yy{4.6}
%
\begin{document}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{pspicture}(0,0)(10,5)
%tree of order 0
\NODE(1,\ya){6}
%
%tree of order 1
\NODE(2,\ya){2} \NODE(2,\yb){5} \ncline{2}{5}
%
%tree of order 3
\NODE(5,\ya){1} \NODE(3,\yb){3}
\MARKED(4,\yb){4} \MARKED(5,\yb){7}
\MARKED(5,\yc){8} \NODE(5,\yd){9}
%
\ncline{1}{3} \ncline{1}{4}
\ncline{1}{7} \ncline{7}{8} \ncline{8}{9}
%
\rput(6,\yy){\rnode{from}{\strut{}minimum}}
\ncline[arrowsize=4pt 3]{->}{from}{1}
\end{pspicture}\\
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{pspicture}(0,0)(10,5)
\NODE(1,\ya){6}
%
\NODE(2,\ya){2} \NODE(2,\yb){5} \ncline{2}{5}
%
\NODE(3,\ya){3}
%
\NODE(4,\ya){4}
%
\NODE(5,\ya){7} \MARKED(5,\yb){8} \NODE(5,\yc){9}
\ncline{7}{8} \ncline{8}{9}
\end{pspicture}\\
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{pspicture}(0,0)(10,5)
\NODE(2,\ya){2} \NODE(1,\yb){5}
\NODE(2,\yb){3} \NODE(2,\yc){6}
\ncline{2}{5} \ncline{2}{3} \ncline{3}{6}
%
\NODE(3,\ya){4}
%
\NODE(4,\ya){7} \MARKED(4,\yb){8} \NODE(4,\yc){9}
\ncline{7}{8} \ncline{8}{9}
%
\rput(3,\yy){\rnode{from}{\strut{}minimum}}
\ncline[arrowsize=4pt 3]{->}{from}{2}
\end{pspicture}\\
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{pspicture}(0,0)(10,5)
\NODE(1,\ya){6}
%
\NODE(2,\ya){2} \NODE(2,\yb){5} \ncline{2}{5}
%
\NODE(4,\ya){1} \NODE(3,\yb){3} \MARKED(4,\yb){4}
\ncline{1}{3} \ncline{1}{4}
%
\NODE(5,\ya){7}
%
\NODE(6,\ya){8}
%
\NODE(7,\ya){0}
%
\rput(8,\yy){\rnode{from}{\strut{}minimum}}
\ncline[arrowsize=4pt 3]{->}{from}{0}
\end{pspicture}
%
%
\end{document}