Skip to content

Instantly share code, notes, and snippets.

@ehamberg
Created May 16, 2011 10:40
Show Gist options
  • Save ehamberg/974218 to your computer and use it in GitHub Desktop.
Save ehamberg/974218 to your computer and use it in GitHub Desktop.
\usepackage{varioref}
\usepackage{prettyref}
\usepackage{prettyref}
\def\reftextcurrent {}
\newrefformat{fig}{Fig.~\ref{#1}\vpageref{#1}}
\newrefformat{par}{Section~\ref{#1}\vpageref{#1}}
\newrefformat{sec}{Section~\ref{#1}\vpageref{#1}}
\newrefformat{sub}{Section~\ref{#1}\vpageref{#1}}
\newrefformat{table}{Table~\ref{#1}\vpageref{#1}}
\newrefformat{alg}{Algorithm~\ref{#1}\vpageref{#1}}
\newrefformat{chap}{Chapter~\ref{#1}}
\newrefformat{eq}{equation~\eqref{#1}}
To come up with the Prüfer sequence for a tree there first has to
be an ordering of the node labels, e.g. $0,1,2,\ldots,A,B,C,\ldots$.
The next label in the sequence is then found by removing the {}``smallest''
label and appending \emph{the node it is connected to} to the sequence.
For the example tree shown in \prettyref{fig:prufer-tree-example}
the first step would be to remove node~$0$ and add $B$ to the sequence.
The next nodes would be node~$1$ and node~$2$, which are connected
to node~$C$, yielding the sequence $B,C,C$ after three steps. Node~$3$
is then removed and $A$ added to the sequence before, in the last
step, node~$A$ is removed and $B$ is appended to the Prüfer sequence.
The two last nodes are not necessary to include in the sequence. The
final result is thus $B,C,C,A,B$.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment