\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 investigate properties of the diagrams, are possible, without having to resort to extra unnecessary 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 chapter discusses representing Euler Diagrams as graphs, or sets of relationships. By representing Euler diagrams in this way, algorithms to investigate properties of the diagrams, are possible, without having to resort to extra unnecessary 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 spatial 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 concrete plane. \section{Defining `pair-wise intersection' \\ and `enclosure'} \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 Pair-wise 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 figure \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 $$ %\clearpage \paragraph{Pair-wise 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 `pair-wise intersection'. We can express this as a non directed relationship. $$ D \pin E $$ \paragraph{Mutual exclusivity of `pair-wise intersection' and `enclosure'} Clearly these two properties are mutually exclusive. No contour can be both pair-wisely 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{definition} \label{def:mutex} No contour can be both pair-wisely intersected and enclosed with the same contour. \end{definition} \clearpage \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} \label{def:enctrans} Enclosure relationships are transitive. \end{definition} \pagebreak[1] \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{Representing Euler diagrams as graphs} As the relationships {\em enclosure} and {\em pair-wise intersection} are mutually exclusive and {\em enclosure} is transitive and {\em pair-wise intersection} is not, we can represent an {\em enclosure} relationship as a directed vertice and {\pic} as non-directed on the same graph. Figures \ref{fig:eulerg1} and \ref{fig:eulerg_enc} show Euler diagrams with corresponding graphs. The next section will introduce the concept of a {\pic} and will present graphs where both enclosure and pair-wise intersection are represented on the same graph. \pagebreak[1] \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 `pair-wise intersection' relationships to form `chains' of contours reachable by pair-wise 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=400pt,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} \label{def:encpic} If any contour in a {\pic} is enclosed by any contour not belonging to the chain, all the contours within the {\pic} will be enclosed by it. \end{definition} Note that any contour which bisects another contour in a {\pic} becomes part of the pair-wise~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 pair-wise 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 pair-wise intersection 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 pair-wise intersection 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 unnecessary 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{Pair-wise Intersection chain PIC1 as a graph} \label{fig:eulerg_pic_g} \end{figure} % \subsection{The Pair-wise 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 pair-wise 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[1] \subsection{Enclosure and pair-wise \\ intersection in the graph} Because enclosure is a directed relationship and {\em pair-wise intersection} is non-directed we can represent them both on the same graph, see figure \ref{fig:eulerg_pic_g_a}. \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{Graph of Euler diagram in figure \ref{fig:eulerg_pic}.} \label{fig:eulerg_pic_g_a} \end{figure} \pagebreak[1] \subsection{Reducing clutter in the graph} Contour A encloses the pure intersection chain $PIC1$; using definition \ref{def:encpic}, we can draw this in a less cluttered way, by only drawing one enclosure relationship to the {\pic} (see figure \ref{fig:eulerg_pic_g_a_unc}). We only need to show contour A enclosing one member of the {\pic} $PIC1$ in order to show that contour A encloses all contours in $PIC1$. \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[9] \clearpage \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} That 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 analyse {\pic}s separately, thus reducing the $2^N$ overhead of analysing an Euler diagram for available zones. \pagebreak[3] \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). Using $|P|$ to represent the number of contours within a {\pic} and $K$ to represent the number of {\pic}s in a diagram, using the result in definition \ref{picreduction}, we can break the diagram into small segments (the {\pic}s) which have an order $K.2^{|P|}$. The exponential $2^N$ overhead is thus broken down into several smaller $2^{|P|}$ operations. 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 $K.|P|.2^{|P|}$ instead of $N.2^N$ as $K < N$. This has effectively reduced the order of the searching algorithm from exponential to polynomial order. \vspace{40pt}