\section{lib/neatogen/closest.c File Reference}
\label{closest_8c}\index{lib/neatogen/closest.\-c@{lib/neatogen/closest.\-c}}
{\ttfamily \#include \char`\"{}kkutils.\-h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}closest.\-h\char`\"{}}\\*
{\ttfamily \#include $<$stdlib.\-h$>$}\\*
Include dependency graph for closest.\-c\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{closest_8c__incl}
\end{center}
\end{figure}
\subsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct {\bf Pair}
\item 
struct {\bf Pair\-Stack}
\item 
struct {\bf Pair\-Heap}
\end{DoxyCompactItemize}
\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define {\bf L\-T}(p, q)~((p).{\bf dist} $<$ (q).{\bf dist})
\item 
\#define {\bf E\-Q}(p, q)~((p).{\bf dist} == (q).{\bf dist})
\item 
\#define {\bf push}({\bf s}, x)
\item 
\#define {\bf pop}({\bf s}, x)~(({\bf s}-\/$>${\bf top}==0) ? {\bf F\-A\-L\-S\-E} \-: ({\bf s}-\/$>${\bf top}-\/-\/, x = {\bf s}-\/$>${\bf data}[{\bf s}-\/$>${\bf top}], {\bf T\-R\-U\-E}))
\item 
\#define {\bf read\-\_\-top}(h, x)~(({\bf s}-\/$>${\bf top}==0) ? {\bf F\-A\-L\-S\-E} \-: (x = {\bf s}-\/$>${\bf data}[{\bf s}-\/$>${\bf top}-\/1], {\bf T\-R\-U\-E}))
\item 
\#define {\bf sub}(h, i)~(h-\/$>${\bf data}[i])
\item 
\#define {\bf left}(i)~(2$\ast$(i))
\item 
\#define {\bf right}(i)~(2$\ast$(i)+1)
\item 
\#define {\bf parent}(i)~((i)/2)
\item 
\#define {\bf inside\-Heap}(h, i)~((i)$<$h-\/$>$heap\-Size)
\item 
\#define {\bf greater\-Priority}(h, i, j)~({\bf L\-T}(h-\/$>${\bf data}[i],h-\/$>${\bf data}[j]) $|$$|$ (({\bf E\-Q}(h-\/$>${\bf data}[i],h-\/$>${\bf data}[j])) \&\& (rand()\%2)))
\item 
\#define {\bf exchange}(h, i, j)
\item 
\#define {\bf assign}(h, i, j)~\{h-\/$>${\bf data}[i]=h-\/$>${\bf data}[j]\}
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void {\bf closest\-\_\-pairs2graph} (double $\ast$place, {\bf int} n, {\bf int} num\-\_\-pairs, {\bf vtx\-\_\-data} $\ast$$\ast${\bf graph})
\end{DoxyCompactItemize}


\subsection{Macro Definition Documentation}
\index{closest.\-c@{closest.\-c}!assign@{assign}}
\index{assign@{assign}!closest.c@{closest.\-c}}
\subsubsection[{assign}]{\setlength{\rightskip}{0pt plus 5cm}\#define assign(
\begin{DoxyParamCaption}
\item[{}]{h, }
\item[{}]{i, }
\item[{}]{j}
\end{DoxyParamCaption}
)~\{h-\/$>${\bf data}[i]=h-\/$>${\bf data}[j]\}}\label{closest_8c_a375f0cb2b08b7ec0e9ea66eebd78ffe7}


Definition at line 98 of file closest.\-c.

\index{closest.\-c@{closest.\-c}!E\-Q@{E\-Q}}
\index{E\-Q@{E\-Q}!closest.c@{closest.\-c}}
\subsubsection[{E\-Q}]{\setlength{\rightskip}{0pt plus 5cm}\#define E\-Q(
\begin{DoxyParamCaption}
\item[{}]{p, }
\item[{}]{q}
\end{DoxyParamCaption}
)~((p).{\bf dist} == (q).{\bf dist})}\label{closest_8c_a0101900d9af579acec25746ee2c6603f}


Definition at line 34 of file closest.\-c.

\index{closest.\-c@{closest.\-c}!exchange@{exchange}}
\index{exchange@{exchange}!closest.c@{closest.\-c}}
\subsubsection[{exchange}]{\setlength{\rightskip}{0pt plus 5cm}\#define exchange(
\begin{DoxyParamCaption}
\item[{}]{h, }
\item[{}]{i, }
\item[{}]{j}
\end{DoxyParamCaption}
)}\label{closest_8c_ab2de675f887eda5f05581d2bcd95319e}
{\bfseries Value\-:}
\begin{DoxyCode}
\{Pair temp; \(\backslash\)
        temp=h->data[i]; \(\backslash\)
        h->data[i]=h->data[j]; \(\backslash\)
        h->data[j]=temp; \(\backslash\)
\}
\end{DoxyCode}


Definition at line 93 of file closest.\-c.



Referenced by build\-\_\-ranks().

\index{closest.\-c@{closest.\-c}!greater\-Priority@{greater\-Priority}}
\index{greater\-Priority@{greater\-Priority}!closest.c@{closest.\-c}}
\subsubsection[{greater\-Priority}]{\setlength{\rightskip}{0pt plus 5cm}\#define greater\-Priority(
\begin{DoxyParamCaption}
\item[{}]{h, }
\item[{}]{i, }
\item[{}]{j}
\end{DoxyParamCaption}
)~({\bf L\-T}(h-\/$>${\bf data}[i],h-\/$>${\bf data}[j]) $|$$|$ (({\bf E\-Q}(h-\/$>${\bf data}[i],h-\/$>${\bf data}[j])) \&\& (rand()\%2)))}\label{closest_8c_a0b64df25addc562bd20d57190fa78ef6}


Definition at line 90 of file closest.\-c.

\index{closest.\-c@{closest.\-c}!inside\-Heap@{inside\-Heap}}
\index{inside\-Heap@{inside\-Heap}!closest.c@{closest.\-c}}
\subsubsection[{inside\-Heap}]{\setlength{\rightskip}{0pt plus 5cm}\#define inside\-Heap(
\begin{DoxyParamCaption}
\item[{}]{h, }
\item[{}]{i}
\end{DoxyParamCaption}
)~((i)$<$h-\/$>$heap\-Size)}\label{closest_8c_adda52696a85f2fcd786c3c012ced5415}


Definition at line 89 of file closest.\-c.

\index{closest.\-c@{closest.\-c}!left@{left}}
\index{left@{left}!closest.c@{closest.\-c}}
\subsubsection[{left}]{\setlength{\rightskip}{0pt plus 5cm}\#define left(
\begin{DoxyParamCaption}
\item[{}]{i}
\end{DoxyParamCaption}
)~(2$\ast$(i))}\label{closest_8c_a88f812bfe1d7a86c0c2992626aa4b73d}


Definition at line 86 of file closest.\-c.

\index{closest.\-c@{closest.\-c}!L\-T@{L\-T}}
\index{L\-T@{L\-T}!closest.c@{closest.\-c}}
\subsubsection[{L\-T}]{\setlength{\rightskip}{0pt plus 5cm}\#define L\-T(
\begin{DoxyParamCaption}
\item[{}]{p, }
\item[{}]{q}
\end{DoxyParamCaption}
)~((p).{\bf dist} $<$ (q).{\bf dist})}\label{closest_8c_ae8b88a1d20ff710704fc37563500f7d2}


Definition at line 33 of file closest.\-c.

\index{closest.\-c@{closest.\-c}!parent@{parent}}
\index{parent@{parent}!closest.c@{closest.\-c}}
\subsubsection[{parent}]{\setlength{\rightskip}{0pt plus 5cm}\#define parent(
\begin{DoxyParamCaption}
\item[{}]{i}
\end{DoxyParamCaption}
)~((i)/2)}\label{closest_8c_a915a9564b15f2c25e828da2e9a05769c}


Definition at line 88 of file closest.\-c.



Referenced by create\-Blocktree(), lookup\-\_\-widget(), and push\-\_\-obj\-\_\-state().

\index{closest.\-c@{closest.\-c}!pop@{pop}}
\index{pop@{pop}!closest.c@{closest.\-c}}
\subsubsection[{pop}]{\setlength{\rightskip}{0pt plus 5cm}\#define pop(
\begin{DoxyParamCaption}
\item[{}]{{\bf s}, }
\item[{}]{x}
\end{DoxyParamCaption}
)~(({\bf s}-\/$>${\bf top}==0) ? {\bf F\-A\-L\-S\-E} \-: ({\bf s}-\/$>${\bf top}-\/-\/, x = {\bf s}-\/$>${\bf data}[{\bf s}-\/$>${\bf top}], {\bf T\-R\-U\-E}))}\label{closest_8c_aa66a3f6c0985b8467e2b7c6f57469a1a}


Definition at line 71 of file closest.\-c.

\index{closest.\-c@{closest.\-c}!push@{push}}
\index{push@{push}!closest.c@{closest.\-c}}
\subsubsection[{push}]{\setlength{\rightskip}{0pt plus 5cm}\#define push(
\begin{DoxyParamCaption}
\item[{}]{{\bf s}, }
\item[{}]{x}
\end{DoxyParamCaption}
)}\label{closest_8c_af7f06c8101cccc3de70e05a25c78a225}
{\bfseries Value\-:}
\begin{DoxyCode}
\{ \
	if (s->top>=s->max\_size) \{ \(\backslash\)
                s->max\_size *= 2; \(\backslash\)
                s->data = (Pair*) realloc(s->data, s->max\_size*\textcolor{keyword}{sizeof}(Pair)); \(\backslash\)
        \} \(\backslash\)
        s->data[s->top++] = x; \(\backslash\)
\}
\end{DoxyCode}


Definition at line 63 of file closest.\-c.

\index{closest.\-c@{closest.\-c}!read\-\_\-top@{read\-\_\-top}}
\index{read\-\_\-top@{read\-\_\-top}!closest.c@{closest.\-c}}
\subsubsection[{read\-\_\-top}]{\setlength{\rightskip}{0pt plus 5cm}\#define read\-\_\-top(
\begin{DoxyParamCaption}
\item[{}]{h, }
\item[{}]{x}
\end{DoxyParamCaption}
)~(({\bf s}-\/$>${\bf top}==0) ? {\bf F\-A\-L\-S\-E} \-: (x = {\bf s}-\/$>${\bf data}[{\bf s}-\/$>${\bf top}-\/1], {\bf T\-R\-U\-E}))}\label{closest_8c_aea017fa043f1ddc3b710a8cec06985f1}


Definition at line 73 of file closest.\-c.

\index{closest.\-c@{closest.\-c}!right@{right}}
\index{right@{right}!closest.c@{closest.\-c}}
\subsubsection[{right}]{\setlength{\rightskip}{0pt plus 5cm}\#define right(
\begin{DoxyParamCaption}
\item[{}]{i}
\end{DoxyParamCaption}
)~(2$\ast$(i)+1)}\label{closest_8c_aa5fbf3b618e0f76fb19954b173e3cfd7}


Definition at line 87 of file closest.\-c.



Referenced by bezier\-\_\-clip(), dot\-\_\-concentrate(), heapdown(), and update\-\_\-bb\-\_\-bz().

\index{closest.\-c@{closest.\-c}!sub@{sub}}
\index{sub@{sub}!closest.c@{closest.\-c}}
\subsubsection[{sub}]{\setlength{\rightskip}{0pt plus 5cm}\#define sub(
\begin{DoxyParamCaption}
\item[{}]{h, }
\item[{}]{i}
\end{DoxyParamCaption}
)~(h-\/$>${\bf data}[i])}\label{closest_8c_afd2c78e1b41a67a50859e3444aee66ad}


Definition at line 75 of file closest.\-c.



Referenced by agassociate(), html\-\_\-string(), xml\-\_\-string0(), and xml\-\_\-url\-\_\-string().



\subsection{Function Documentation}
\index{closest.\-c@{closest.\-c}!closest\-\_\-pairs2graph@{closest\-\_\-pairs2graph}}
\index{closest\-\_\-pairs2graph@{closest\-\_\-pairs2graph}!closest.c@{closest.\-c}}
\subsubsection[{closest\-\_\-pairs2graph}]{\setlength{\rightskip}{0pt plus 5cm}void closest\-\_\-pairs2graph (
\begin{DoxyParamCaption}
\item[{double $\ast$}]{place, }
\item[{{\bf int}}]{n, }
\item[{{\bf int}}]{num\-\_\-pairs, }
\item[{{\bf vtx\-\_\-data} $\ast$$\ast$}]{graph}
\end{DoxyParamCaption}
)}\label{closest_8c_a5bd28c1cbbed3d38be4c53ea295e1153}


Definition at line 354 of file closest.\-c.



References free\-Stack().



Referenced by iterative\-P\-C\-A\-\_\-1\-D().

