


\ifthenelse {\boolean{paper}}
{
\abstract{
This paper discusses representing Euler Diagrams as graphs, or sets of relationships.
By representing Euler diagrams in this way,
algorithms to invesigate properties of the diagrams, are possible, without
having to resort
to extra unecessary CPU expensive area operations on the concrete diagrams. 

The graph representations presented here form the basis for several algorithms
and time saving procedures, implemented in the FMMD analysis tool.

}
}
{ %% Introduction
\section{Introduction}
This paper discusses representing Euler Diagrams as graphs, or sets of relationships.
By representing Euler diagrams in this way,
algorithms to invesigate properties of the diagrams, are possible, without
having to resort
to extra unecessary CPU expensive area operations on the concrete diagrams. 

The graph representations presented here form the basis for several algorithms
and time saving procedures, implemented in the FMMD analysis tool.
}


\section{Introduction : Euler Diagram }

Classical Euler diagrams consist of closed curves in the plane which are used to represent sets.
The spaitial relationship between the curves defines the set theoretic relationships, as defined below.
\begin{itemize}
\item Intersection - if the curves defining the area within curves overlap
\item Sub-set      - if a curve is enclosed by another
\item disjoint     - if the curves are separate
\end{itemize}

The definitions above allow us to read an Euler diagram
and write down set theory equations.
The interest here though, is to define relationships between the contours, that allow
processing and parsing of the diagram without resorting to extra area operations in the concerete plane.

\section{Defining `pure intersection' and `enclosure'}

%\begin{figure}[htp]
%  \begin{center}
%    \subfigure[Original image]{\label{fig:edge-a}\includegraphics[scale=0.75]{toucan.eps}}
%    \subfigure[After Laplace edge detection]{\label{fig:edge-b}\includegraphics[scale=0.75]{laplace_toucan.eps}} \\
%    \subfigure[After Sobel edge detection]{\label{fig:edge-c}\includegraphics[scale=0.75]{sobel_toucan.eps}}
%  \end{center}
%  \caption{Various edge detection algorithms}
%  \label{fig:edge}
%\end{figure}

%
%\begin{figure}[h]
% \centering
% \includegraphics[width=200pt,keepaspectratio=true]{./eulerg/eulerg1.jpg}
% % eulerg1.jpg: 513x215 pixel, 72dpi, 18.10x7.58 cm, bb=0 0 513 215
% \caption{An Euler Diagram showing enclosure and Pure Intersection}
% \label{fig:eulerg1}
%\end{figure}
%
%
%

\begin{figure}[ht]
\centering
   \subfigure[Euler Diagram]{
   \includegraphics[width=200pt,keepaspectratio=true]{./eulerg/eulerg1.jpg}
   \label{fig:subfig1}
 }

 \subfigure[Graph Representation]{
   \includegraphics[width=50pt,keepaspectratio=true]{./eulerg/eulerg_g.jpg}
   \label{fig:subfig2}
 }

% \subfigure[Subfigure 3 caption]{
%   \includegraphics[width=100pt,keepaspectratio=true]{./eulerg/eulerg1.jpg}
%   \label{fig:subfig3}
% }

 \caption{An Euler Diagram showing enclosure and Pure Intersection}
 \label{fig:eulerg1}

\end{figure}



The set theory term `intersection' can apply to both the curves overlapping and to the sub-set case.
Intersection in a concrete diagram can mean two curves bisecting.
For instance in diagram \ref{fig:eulerg1} the set theoretic intersection between
$A$ and $B$ exists, even though the curves do not bisect in the concrete plane.

$$ A \cap B \neq \emptyset $$

as does the intersection $D$ and $E$

$$ D \cap E \neq \emptyset $$

Clearly though these intersections are different, because
in the $A$, $B$ case 
$ A \backslash B = \emptyset \wedge B \backslash A \neq \emptyset $
This is not the case for $D$, $E$ where:
$ D \backslash E \neq \emptyset \wedge E \backslash D \neq \emptyset $.
Another way of expressing this is that $D \cap E \neq \emptyset$ and 
$ A \subset B$.

\paragraph{Enclosure}
To distinguish between these we can term the $A$, $B$ case to be 
$A$ `enclosed' by $B$. We can express this as a directed relationship.

$$ B {\enc} A $$


\paragraph{Pure Intersection}
In the $D$, $E$ case we have 

We can say that where the areas defined by the curves intersect but no one curve encloses the 
other, we can term this `pure intersection'.
We can express this as a non directed relationship.

$$ D \pin E $$


\paragraph{Mutual exclusivity of `pure intersection' and `enclosure'}

Clearly these two properties are mutually exclusive. No
contour can be both purely intersected and enclosed with the same contour.
Also enclosure, is transitive. That is to say if B encloses A, and A encloses C
then B encloses C, see figure \ref{fig:eulerg_enc}.

\begin{figure}[h]
 \centering

 \subfigure[Euler Diagram]{
 \includegraphics[width=200pt,keepaspectratio=true]{./eulerg/eulerg_enc.jpg}
 % eulerg_enc.jpg: 315x269 pixel, 72dpi, 11.11x9.49 cm, bb=0 0 315 269
 \label{eulerenc}
 }

 \subfigure[Graph Representation]{
 \includegraphics[width=100pt,bb=0 0 240 43,keepaspectratio=true]{./eulerg/eulerg_enc_g.jpg}
 % eulerg_enc_g.jpg: 240x43 pixel, 72dpi, 8.47x1.52 cm, bb=0 0 240 43
  \label{graphenc}
 }
 \caption{Enclosure, a transitive relationship}
 \label{fig:eulerg_enc}
\end{figure}

$$ B {\enc} A \wedge A {\enc} C \implies B {\enc} C $$

\begin{definition}
Enlcosure relationships are transitive
\end{definition}

\section{Representing Euler Diagrams \\ as sets of relationships}

The diagram in figure \ref{fig:eulerg1} can be represented by the following relationships.

$$ B {\enc} A $$
$$ D {\pin} E $$


The diagram in figure \ref{fig:eulerg_enc} can be represented by the following relationships.

$$ B {\enc} A $$
$$ A {\enc} C $$

\section{Represeting Euler diagrams as graphs}

As the relationships {\em enclosure} and {\pic} are mutually exclusive
and {\em enclosure} is transitive and {\pic} is not, we can represent
an {\em enclosure} relationship as a directed vertice and 
{\pic} as non-directed.

\pagebreak[0]
\section{The {\pic}}
In graph theory a node is said to be reachable from another node
if you can start at the one node, travel via the edges
and arrive at the other. 
Contours may be connected via `pure intersection' relationships to form 
`chains' of contours reachable by pure intersection.
These are termed {\pic}s.
Figure \ref{fig:eulerg_pic} shows a {\pic} consisting of contours $M,N,O,P$ and $Q$.

\begin{figure}[h]
 \centering
 \includegraphics[width=300pt,keepaspectratio=true]{./eulerg/eulerg_pic.jpg}
 % eulerg_pic.jpg: 955x286 pixel, 72dpi, 33.69x10.09 cm, bb=0 0 955 286
 \caption{{\pic} with Enclosure}
 \label{fig:eulerg_pic}
\end{figure}

%\textbf{rule:}
\begin{definition}
If any contour in a {\pic} is enclosed by any contour not belonging to the chain, 
all the countours within the 
{\pic} will be enclosed by it. 
\end{definition}

This is because a contour 
enclosing which bisects another contour in a {\pic}
becomes part of the pure~intersection~chain.
% Hmmmm thats true but a better way to say it ????
%The diagram in figure \ref{fig:eulerg_enc} can be represented by the following relationships.


\vbox{
The diagram in figure \ref{fig:eulerg_pic} can be represented by the following relationships.

$$ M {\pin} N $$
$$ N {\pin} O $$
$$ O {\pin} P $$
$$ O {\pin} Q $$
$$ Q {\enc} P $$
$$ A {\enc} M $$
$$ A {\enc} N $$
$$ A {\enc} O $$
$$ A {\enc} P $$
$$ A {\enc} Q $$
}

To form the {\pic} we can follow
reachable pure intersection relationships.

$ M {\pin} N {\pin} O {\pin} P $ are part of the same chain.
following from $O$, $O {\pin} Q$.
Thus by the definition of being reachable by pure instersection relationships,$M,N,O,P,Q$
are in the same {\pic}, even though $Q$ encloses $P$.

We can define this {\pic} as $PIC1$ as a set of contours.

$$ PIC1 = \{ M,N,O,P,Q \} $$

Contour $A$, by virtue of not bisecting any contour in the pure instersection
chain $PIC1$, does not belong to  $PIC1$. Because it encloses one of the contours, it
encloses all contours in the chain. 
Knowing this can save on unecessary area operations on the concrete diagram.

\begin{figure}[h]
 \centering
 \includegraphics[width=200pt,bb=0 0 330 158,keepaspectratio=true]{./eulerg/eulerg_pic_g.jpg}
 % eulerg_pic_g.jpg: 330x158 pixel, 72dpi, 11.64x5.57 cm, bb=0 0 330 158
 \caption{Pure Intersection chain PIC1 as a graph}
 \label{fig:eulerg_pic_g}
\end{figure}
%  \subsection{The Pure intersection chain PIC1}
%  \begin{figure}[h]
%   \centering
%   \includegraphics[width=200pt,bb=0 0 955 286,keepaspectratio=true]{./eulerg_pic_g.jpg}
%   % eulerg_pic.jpg: 955x286 pixel, 72dpi, 33.69x10.09 cm, bb=0 0 955 286
%   \caption{The pure Intersection PIC1 as a graph}
%   \label{fig:eulerg_pic1}
%  \end{figure}


Figure \ref{fig:eulerg_pic_g} only shows the {\pic}, but does not show the contour ($A$)
enclosing $PIC1$. Figure \ref{fig:eulerg_pic_g_a}
shows contour A enclosing all elements in $PIC1$

\pagebreak[0]
\subsection{Enclosure and pure \\ intersection in the graph}
\begin{figure}[h]
 \centering
 \includegraphics[width=200pt,bb=0 0 330 162,keepaspectratio=true]{./eulerg/eulerg_pic_g_a.jpg}
 % eulerg_pic_g_a.jpg: 330x162 pixel, 72dpi, 11.64x5.72 cm, bb=0 0 330 162
 \caption{PIC1 including enclosing contour A as a graph}
 \label{fig:eulerg_pic_g_a}
\end{figure}

Because we know that a contour enclosing a contour within a {\pic} but not belonging
to it, encloses all elements of the {\pic}, we can draw this in a less cluttered way
see figure \ref{fig:eulerg_pic_g_a_unc}.

\pagebreak[0]
\subsection{Reducing clutter in the graph}
\begin{figure}[h]
 \centering
 \includegraphics[width=200pt,bb=0 0 330 162]{./eulerg/eulerg_pic_g_a_unc.jpg}
 % eulerg_pic_g_a_unc.jpg: 330x162 pixel, 72dpi, 11.64x5.72 cm, bb=0 0 330 162
 \caption{Uncluttered graph of euler diagram in figure \ref{fig:eulerg_pic}}
 \label{fig:eulerg_pic_g_a_unc}
\end{figure}


\pagebreak[0]
\section{Reduction of searches \\ for available zones}

Another property of any {\pic} $P$, is that
the maximum number of euler zones within it is 

$$ MaxZones =  2^{|P|}  $$

Because no contours external to the {\pic} 
bisect any in it, no extra zones can be formed.
By enclosing a {\pic} with 
a contour, we change the nature of the zones within
the {\pic}, but the number of zones contributed by the {\pic}
stays the same.
\begin{definition}
\label{picreduction}
The number of available zones within a {\pic} $P$ does not change 
when other contours are added or removed from the diagram
that are not, or would not become members of the {\pic} $P$.
\end{definition}
his is to say, the the number of zones within a {\pic} is not affected by changes in the diagram 
that do not alter the {\pic}.
This allows us to analyses {\pic}s separately, thus reducing the $2^N$ overhead of analysing an Euler diagram for available zones.

\subsection{Available Zone Searching}

The available zones in an Euler diagram represent set theoretic combinations
that can be used in the diagram. 
%For FMMD analyis, the test~cases
Searching for an available zone involves finding out if the intersection exists, and then determining whether it is covered up
by any other contours. A brute force search for available zones using area operations
is therefore of the order $N.2^N$ (where N is the number of contours in the diagram).
By using the result in definition \ref{picreduction}, we can break the diagram into small segments
(the {\pic}s) which have an order $|P|.2^{|P|}$.
The order of area operations is generally\footnote{In the case where the diagram is not comprised of just one {\pic}, which has no enclosing contours.} 
reduced  by requiring several  $|P|.2^{|P|}$
instead of $N.2^N$ as $P \leq N$.

\vspace{40pt}

