%\documentclass[twocolumn]{article}
%\usepackage{ltugboat}
%\usepackage{xypic}
\documentstyle[twocolumn,xy]{ltugboat}
\xyoption{graph}
\xyoption{frame}
\xyoption{ps}
\xyoption{dvips}

\let\tensl=\sl	% ltugboat needs this in the header


\def\Neuron#1{\POS*{#1}*++[o]{}*+\frm{o}}
\def\uNeuron{\POS+(0,.2)*++[o]{}*\frm{o}}
\def\dNeuron{\POS-(0,.2)*++[o]{}*\frm{o}}
\def\Link{\ar @{-}}
\def\cLink#1{\ar @{-}@*{[thicker][#1]}}         % to allow other style/colours
\def\Output{\ar +(.35,0)}
%%
%% ... with these dropping the timing step labels ...
%%
\def\Timelabel{Time}
\def\Time#1{\ifcase#1\POS-(.5,0)*{t}
  \save\POS+(0,.5)*\txt{\Timelabel}\relax\restore  %   also places `Time' as heading 
 \else\POS-(.5,0)*{t-#1}\relax                     %   otherwise typeset value only
 \fi}
%%
%%  
%%  The following macros specify which of the above are
%%  required with each type of node present in the network.
%%
%%
%%  1. Higher-level Neurons
%%  ---  the #1 is used to give a name to its <pos>
%%
\def\OutNeuron#1{\Neuron{#1}="#1"\Output}
\def\NeuronAB#1{\Neuron{#1}="#1"\Link"A",\Link"B"\relax}
%%
%%
%%  2. Neuron pairs  (do not need names)
%%
\def\biNeuron#1#2{\ifcase#1%    #1 = how many connections,
  \def\next{\relax}%            #2 = list of the connection <pos>s
 \or\def\next{\leafs#2}%        single connecting neuron
 \or\def\next{\bileafs#2}%      pair of neurons
 \else\def\next{\relax}%        (others could be added here)
 \fi\next}
%%
%%  ... with these placing the lowest-level `leaf' neurons ...
%%
\def\leafs#1{%
 \save\uNeuron\Link"#1"\restore
 \save\dNeuron\Link"#1"\restore
}
\def\bileafs#1#2{\save
 \uNeuron\Link"#1",\Link"#2"\restore
 \save
 \dNeuron\Link"#1",\Link"#2"\restore
}
%%

%\begin{document}

\title{Typesetting Neural Nets using \Xy-pic}

\author{ Ross Moore\thanks{work was partially supported by the Australian
	Research Council and through a research agree\-ment with the
	Digital Equipment Corporation.}\\
		Mathematics Department\\ Macquarie University\\
		NSW~2109, Australia \\
  ross@mpce.mq.edu.au
 }

\begin{document}
\maketitle

\begin{abstract}
This note gives an example of how to use \Xy-pic's
 ``Graph Combinator'' feature to specify the type of
diagram that is frequently used to display Neural Networks.
\end{abstract}

\bigskip
\noindent
Look at the following diagram\footnote{%
thanks also to Peter Vamplew and La Monte Yarroll, University of Tasmania,
for this example.\hfil} and attempt to describe it in words, 
capturing the essential structure.

\begin{figure}[h]
$$\xy\xygraph{~{<5pc,0pc>:<0pc,3.3pc>::} 
 [] !{\OutNeuron A}
 [d]!{\OutNeuron B}
"A"[lu]!{\NeuronAB a}
    [d]!{\NeuronAB b}
    [d]!{\NeuronAB c}
    [d]!{\NeuronAB d}
"a"[u(.5)l] 
    (?!{\Time0},?!{\biNeuron1 a})
[d] (?!{\Time1},?!{\biNeuron2{ab}})
[d] (?!{\Time2},?!{\biNeuron2{bc}})
[d] (?!{\Time3},?!{\biNeuron2{cd}})
[d] (?!{\Time4},?!{\biNeuron1 d})
}\endxy $$
\caption{Example of a Neural Network}
\end{figure}

\medskip\noindent
Here is one possible attempt.

\begin{quotation}\it
There are 3 types of object.
Two objects, called $A$ and $B$, 
are positioned one above the other; 
from each an arrow points to the right, 
away from the main part of the diagram.

To the left of these are four more objects, 
each connected by lines to both $A$ and $B$.
They are positioned vertically above one another 
and labelled $a$, $b$, $c$, $d$ respectively.

Further to the left are five more objects, again placed above
each other, but so that the inner ones are located intermediate 
between the objects of the second type.
These are more complicated, being a pair of sub-objects each connected
to the nearest two of the second type, except for the outer ones which
connect only to the single nearest object of the second type. 
Furthermore, each pair has a label indicating a time-value, 
from~~$t$ decreasing in unit steps to~~$(t-4)$.

Objects and sub-objects are displayed as circles 
surrounding the single-letter names where applicable.
\end{quotation}

\noindent
Now look at the following segment of code, which was actually
used to specify figure~1.

\begin{verbatim}
$$\xy\xygraph{!{<5pc,0pc>:<0pc,3.3pc>::} 
 [] !{\OutNeuron A}
 [d]!{\OutNeuron B}
"A"[lu]!{\NeuronAB a}
    [d]!{\NeuronAB b}
    [d]!{\NeuronAB c}
    [d]!{\NeuronAB d}
"a"[u(.5)l] 
    (?!{\Time0},?!{\biNeuron1 a})
[d] (?!{\Time1},?!{\biNeuron2{ab}})
[d] (?!{\Time2},?!{\biNeuron2{bc}})
[d] (?!{\Time3},?!{\biNeuron2{cd}})
[d] (?!{\Time4},?!{\biNeuron1 d})
}\endxy $$
\end{verbatim}

\noindent
Some syntax needs to be explained, but basically the three types
of object are represented by 
\verb|\OutNeuron|, \verb|\NeuronAB| and \verb|\biNeuron|,
each occurring within \verb|!{...}| and accompanied by a simple
specification of its name or its links to other objects. 
Given that \verb|[l]|, \verb|[d]| and \verb|[lu]| essentially 
mean ``move left'', ``move down'' and ``move left and up'' respectively 
and \verb|"A"| means ``move to where $A$ is'', 
then the code is seen to correspond closely to the verbal description.
Including a factor allows moves by fractional amounts,
e.g. \verb|[u(.5)l]| moves a half-step up and full step to the left. 

Initially \verb|!{<5pc,0pc>:<0pc,3.3pc>::}| establishes basis
directions and lengths for the ``hops'' using \verb|[l]|, \verb|[d]|, etc.
In particular \verb|<5pc,0pc>:| establishes that 
\verb|[r]| will subsequently move 5pc to the right with no vertical shift,  
while \verb|<0pc,3.3pc>::| establishes \verb|[u]| will move 3.3pc 
 upward with no horizontal shift. 
Then \verb|[l]|, \verb|[d]| move opposite to \verb|[r]| and \verb|[u]|
respectively. Composite hops, such as \verb|[ddr]|, are interpreted
by adding the displacements for the occurrences of \verb|u,d,r,l|.  

The above meanings are established by the \verb|\xygraph| command 
which interprets its single argument as a collection of moves 
and actions to take at the resulting locations. 
For a complete description of the possibilities, see
``Graph Combinator'' feature in the \Xy-pic Reference Manual\cite{R94:XY-picRM}. 
Constructions of the form \verb|!{...}| are used to execute
portions of \Xy-pic kernel code and higher level user-defined code.
Parentheses \verb|(...)| enclose a comma-separated list of actions 
in which \verb|?| refers to the position immediately prior 
to encountering the list.

Now \TeX\ cannot fully interpret the above code 
until we have defined macros 
\verb|\OutNeuron|, \verb|\NeuronAB|, \verb|\biNeuron| and \verb|\Time|.
Those used in figure~1 will now be described.
They involve simple \TeX{} programming constructions, to generate
fragments of \Xy-pic code which precisely specify the lines, circles,
arrowheads and pieces of text which must come together 
to produce the picture as typeset above. 

\begin{itemize}
\item Simplest is \verb|\OutNeuron|
\begin{verbatim}
\def\OutNeuron#1{%
 \Neuron{#1}="#1"\Output}
\def\Output{\ar+(.35,0)}
\end{verbatim}
which uses \verb|#1| to name the current position. 
The \verb|\ar| draws an arrow of length .35 units. 
%
\item
The neuron itself is drawn by
\begin{verbatim}
\def\Neuron#1{\POS
 *{#1}*++[o]{}*+\frm{o}}
\end{verbatim}
which typesets the contents of \verb|#1|, then ignores its size
by following it with a circular frame around an empty object of fixed
circular size (with radius $= 2\times\hbox{\it objectmargin}$).
The initial call to \verb|\POS|,
perhaps the most important of all the primitive commands within \Xy-pic,
initiates parsing of the subsequent tokens.
%
\item 
The macro \verb|\NeuronAB| similarly typesets using \verb|\Neuron|,
but also includes links to $A$ and $B$. 
These are simply an \verb|\ar| without arrow-tips:
\begin{verbatim}
\def\NeuronAB#1{\Neuron{#1}="#1"
 \Link"A",\Link"B"}
\def\Link{\ar @{-}}
\end{verbatim}
%
\item
More complicated is \verb|\biNeuron| since there are (at least) two types.
\begin{verbatim}
\def\biNeuron#1#2{%
 \ifcase#1\def\next{\relax}\or
  \def\next{\leafs#2}\or
  \def\next{\bileafs#2}\else
  \def\next{\relax}\fi\next}
\def\leafs#1{%
 \save\uNeuron\Link"#1"\restore
 \save\dNeuron\Link"#1"\restore}
\def\bileafs#1#2{\save\uNeuron
  \Link"#1",\Link"#2"\restore \save
  \dNeuron\Link"#1",\Link"#2"\restore}
\end{verbatim}
Typesetting done by \verb|\uNeuron| and \verb|\dNeuron| is
similar to \verb|\Neuron| but incorporate a displacement before
dropping the circular frame:
\begin{verbatim}
\def\uNeuron{\POS
 +(0,.2)*++[o]{}*\frm{o}}
\def\dNeuron{\POS
 -(0,.2)*++[o]{}*\frm{o}}
\end{verbatim}
%
\item
Finally the time labels are placed using \dots
\begin{verbatim}
\def\Timelabel{Time}
\def\Time#1{\ifcase#1
 \POS-(.5,0)*{t}\save
 \POS+(0,.5)*\txt{\Timelabel}\restore 
 \else\POS-(.5,0)*{t-#1}\relax\fi}
\end{verbatim}
This both constructs the label to be typeset and positions
it relative to the location of the \verb|\biNeuron|.
Notice the special treatment of the case at time $t$.
\end{itemize}

Only the following macros actually place any marks on the page,
the others handling the logic determining what should be placed and
where to place it:
\verb|\uNeuron|, \verb|\dNeuron|, \verb|\Neuron|, 
\verb|\Output|, \verb|\Link|, \verb|\Time|, \verb|\Timelabel|.
Thus details in the picture may be changed by redefining these
to place different things, while the logic governing the overall layout 
remains the same.

On the other hand it is easy to change parts of the
code for figure~1, e.g. add more neurons or remove some
or link them differently,
to obtain new diagrams while maintaining a consistent style. 
For example it is not always necessary to have labels
and frequently networks are drawn with horizontal layers.

\begin{figure}[hbt]
\def\Neuron#1{\POS*+[o]{}*+\frm{o}}\def\Timelabel{}
\def\Output{\ar +(.4,0)}
$$\xy\xygraph{!{<0pc,4pc>:<-3.3pc,0pc>::} 
 [] !{\OutNeuron A}
 [d]!{\OutNeuron B}
"A"[lu]!{\NeuronAB a}
    [d]!{\NeuronAB b}
    [d]!{\NeuronAB c}
    [d]!{\NeuronAB d}
"a"[l]!{+(0,.5)}
    (?!{\Time0},?!{\biNeuron1 a})
[d] (?!{\Time1},?!{\biNeuron2{ab}})
[d] (?!{\Time2},?!{\biNeuron2{bc}})
[d] (?!{\Time3},?!{\biNeuron2{cd}})
[d] (?!{\Time4},?!{\biNeuron1 d})
}\endxy $$
\caption{}
\end{figure}

The diagram in figure~2 was specified using the same code as previously,
except for setting-up the basis with \verb|!{<0pc,4pc>:<-3.3pc,0pc>::}|,
\verb|\def\Output{\ar+(.4,0)}\def\Timelabel{}| and 
\verb|\def\Neuron#1{\POS*+[o],*+\frm{o}}| so as to be smaller
and omit the labels.

\medskip
Labels can be easily added to the links. 
In the following code the characters \verb|^ _|
and \verb@|@ are used to place the label
``above'', ``below'' or at a ``break'' in
the middle of the link. A specification
such as \verb|{^(.3){|{\it label}\verb|}}|
would position the label the given fraction  
along the link, rather than halfway.  

\begin{figure}[hbt]
%
\def\Neuron{\POS*+[o]{},*=<10pt>\frm{o}}
\def\Output#1{\ar +(.25,0)*!L
 \txt<1cm>{\tiny #1}}
\def\Input#1{\POS{\ar @{-}-(.25,0)},
 ="1"*++!UR\txt{\tiny #1}}
%
\def\OutNeuron#1#2{\Neuron="#1"
 \Output{#2}}
\def\InNeuron#1#2#3#4#5{%
 \Neuron;p\Input{#1}\POS p
 \save\ar"a"#2\restore\save\ar"b"#3
 \restore\save
  \ar"c"#4\restore\save\ar"d"#5
 \restore }
\def\Hidden#1#2#3{\Neuron="#1"\save
  \ar"A"#2\restore \save\ar"B"#3
 \restore}
%
\def\labelbox#1{\object+<1.5pt>
 {\scriptscriptstyle#1}}
$$\xy\xygraph{!{<6pc,0pc>:<0pc,3pc>::@i} 
   []!{+(0,.25)}!{\OutNeuron A{NAND gate}}
  [d]!{-(0,.50)}!{\OutNeuron B{XOR gate}} 
"A"!{+(-1,.75)}!{\Hidden a{^{4.3}}{|{3.5}}}
    [d]!{\Hidden b{^{3.0}}{|{0.8}}}
    [d]!{\Hidden c{|{2.2}}{_{5.1}}}
    [d]!{\Hidden d{|{-3.6}}{_{-0.5}}}
"b"[l]!{+(0,.25)}!{\InNeuron{Input 1}%
 {^{-3.1}}{^{-1.7}}{|{-3.9}}{|{1.9}}}
   [d]!{-(0,.50)}!{\InNeuron{Input 2}%
 {|{-3.1}}{|{-1.8}}{_{4.0}}{_{1.4}}}
}\endxy $$
\caption{Neural network for Boolean operations}
\end{figure}

\begin{verbatim}
\def\Neuron{\POS*+[o]{},*=<10pt>\frm{o}}
\def\Output#1{\ar +(.25,0)*!L
 \txt<1cm>{\tiny #1}}
\def\Input#1{\POS{\ar @{-}-(.25,0)}
 ,="1"*++!UR\txt{\tiny #1}}

\def\OutNeuron#1#2{\Neuron="#1"
 \Output{#2}}
\def\InNeuron#1#2#3#4#5{%
 \expandafter\POS\Neuron;p\Input{#1}\POS p
 \save\ar"a"#2\restore\save\ar"b"#3
 \restore\save\ar"c"#4\restore
 \save\ar"d"#5\restore }
\def\Hidden#1#2#3{\Neuron="#1"\save
  \ar"A"#2\restore \save\ar"B"#3
 \restore}
%
\def\labelbox#1{\object+<3pt>
 {\scriptscriptstyle#1}}
$$\xy\xygraph{!{<6pc,0pc>:<0pc,3pc>::@i} 
   []!{+(0,.25)}!{\OutNeuron A{NAND gate}}
  [d]!{-(0,.50)}!{\OutNeuron B{XOR gate}} 
"A"!{+(-1,.75)}
       !{\Hidden a{^{4.3}}{|{3.5}}}
    [d]!{\Hidden b{^{3.0}}{|{0.8}}}
    [d]!{\Hidden c{|{2.2}}{_{5.1}}}
    [d]!{\Hidden d{|{-3.6}}{_{-0.5}}}
"b"[l]!{+(0,.25)}!{\InNeuron{Input 1}%
 {^{-3.1}}{^{-1.7}}{|{-3.9}}{|{1.9}}}
   [d]!{-(0,.50)}!{\InNeuron{Input 2}%
 {|{-3.1}}{|{-1.8}}{_{4.0}}{_{1.4}}}
}\endxy $$
\end{verbatim}

\noindent
The \verb|\labelbox| command here determines the formatting
for labels on the links, including the spacing around those
that occur as ``breaks''.

\medskip

Many neural networks can be typeset without the need to
explicitly assign names to the nodes. For example the
layered network in figure~4 was typeset using the
following code.

\begin{figure}[ht]
\def\OutNeuron#1{\Neuron @+
  \Output{#1}}
\def\InNeuron#1{\Neuron @+
  \Input {#1}}
\def\Hidden{\Neuron 
 ;@@{\connect\dir{-}}\POS p}
%
\def\Neuron{\POS*+[o]{},*\frm{o}}
\def\Output#1{\ar +(.5,0)^-{#1}}
\def\Input#1{\ar @{<-}-(.5,0)_>>{#1}}
\def\Extend{\save\drop!C\txt{\bf\vdots}\restore}

$$\xy\xygraph{!{<4pc,0pc>:<0pc,3pc>::@(} 
   [] !{\OutNeuron a}
  [d] !{\OutNeuron b} 
[llu] !{\InNeuron{x_1}}
  [d] !{\InNeuron{x_2}}
 [ruu]!{+(0,.25)}!{\Hidden}
 [d]!{\Hidden}
 [d]!{+(0,.25)}!{\Extend}!{+(0,.25)}
 [d]!{\Hidden}
 [d]!{\Hidden}
!{@i@)}}\endxy $$
\caption{Layered neural net}
\end{figure}

\begin{figure*}[tb]
\def\OutNeuron#1#2{\Neuron{#1}
 \POS="O"-(.5,0)*!R\txt{\small #2}
 \POS"O"\Output}
\def\Neuron#1{\POS*!C{#1}
 \POS*+++[o]{}*[o]\frm{o}}
\def\Output{\ar +(0,.35)}
\def\Input{\Neuron{}
 ;@@{\connect\dir{-}}\POS p}
\def\Hidden#1#2{\Neuron{#1}\POS @+
 \ar @{-}"O"|{#2}}
\def\Extend{\drop\txt{$\bf\cdots\cdots$}}
\def\Extendd{\POS="2"\Extend\POS;"O"
 **\dir{}?*\txt{$\bf\cdots$}\POS"2"}
\def\longbrace#1{\POS"a"."b"
 !C.*++\frm{_\}}!D*++!U\txt{\small#1}}
\def\leftxt#1{\POS*++!L\txt{\tiny #1}}
\def\nudgeL{\POS-<.7pc,0pc>}

\def\objectstyle{\scriptscriptstyle}
\def\labelbox#1{\object+<3pt>
 {\scriptscriptstyle#1}}
$$\xy\xygraph{!{<3pc,0pc>:<0pc,5pc>::} 
 []!{\OutNeuron{-0.5}{Output unit}}
[dlll]="H"
 !{\drop!R\txt{\small Hidden Layer}}
 !{+(.5,0) @i} !{\Hidden {-0.5}{1}} 
[r]!{\Hidden {-1.5}{-1}}
[r]!{\Hidden {-2.5}{1 }}
[r]!{\Hidden {-3.5}{-1}}
[r]!{\Extendd}
[r]!{\nudgeL\Hidden {.5-k}{-1}}
"H"[d]!{\drop!R\txt{\small Input Layer}}
 !{+(.50,0)}!{\Input}="a"
[r]!{\Input} [r]!{\Input} 
[r]!{\Input} [r]!{\Extend}
[r]!{\nudgeL\Input}="b"
!{@i \longbrace{$k$ units}}
"b"!{+(0,.5)\leftxt{All strengths = 1}}
}\endxy $$
\caption{A network that computes parity.}
\end{figure*}

\begin{verbatim}
\def\OutNeuron#1{\Neuron @+
  \Output{#1}}
\def\InNeuron#1{\Neuron @+
  \Input{#1}}
\def\Hidden{\Neuron 
 ;@@{\connect\dir{-}}\POS p}

\def\Neuron{\POS*+[o]{},*\frm{o}}
\def\Output#1{\ar +(.5,0)^-{#1}}
\def\Input#1{\ar @{<-}-(.5,0)_>>{#1}}
\def\Extend{*!C\txt{\bf\vdots}}

$$\xy\xygraph{!{<5pc,0pc>:<0pc,3.3pc>::@(} 
   [] !{\OutNeuron a}
  [d] !{\OutNeuron b} 
[llu] !{\InNeuron{x_1}}
  [d] !{\InNeuron{x_2}}
 [ruu]!{+(0,.25)}!{\Hidden}
 [d]!{\Hidden}
 [d]!{+(0,.25)}!{\Extend}!{+(0,.25)}
 [d]!{\Hidden}
 [d]!{\Hidden}
!{@i@)}}\endxy $$
\end{verbatim}

The ``hidden units'' connect to all the ``inputs'' and to all the
``outputs''. This is achieved within the \Xy-pic diagram by 
using the ``stack'' construction. 
Initialisation of the new stack is done by \verb|@(| while 
\verb|@+|, used in \verb|\InNeuron| and \verb|\OutNeuron|, 
 pushes positions onto the stack. 
Within \verb|\Hidden| the \verb|@@{...}| construction interprets
the code within \verb|{...}| for each position in the stack.
Thus each call to \verb|\Hidden| makes a solid line connection
from its position to each input and output node.
The second use of \verb|@i@)| empties the stack before leaving it, 
when it is no longer needed.


\medskip
Many of the above techniques were used to produce figure~5,
which is based on the diagram on p.142 of \cite{neucomp}.


\begin{verbatim}
\def\OutNeuron#1#2{\Neuron{#1}
 \POS="O"-(.5,0)*!R\txt{\small #2}
 \POS"O"\Output\POS"O"}
\def\Neuron#1{\POS*!C{#1}
 \POS*+++[o]{}*[o]\frm{o}}
\def\Output{\ar +(0,.35)}
\def\Input{\Neuron{}
 ;@@{\connect\dir{-}}\POS p}
\def\Hidden#1#2{\Neuron{#1}\POS @+
 \ar @{-}"O"|{#2}}
\def\Extend{\drop\txt{$\bf\cdots\cdots$}}
\def\Extendd{\POS="2"\Extend\POS
 ;"O"**\dir{}?*\txt{$\bf\cdots$}\POS"2"}
\def\longbrace#1{\POS"a"."b"
 !C.*++\frm{_\}}!D*++!U\txt{\small#1}}
\def\leftxt#1{\POS*++!L\txt{\tiny #1}}
\def\nudgeL{\POS-<.7pc,0pc>}

\def\objectstyle{\scriptscriptstyle}
\def\labelbox#1{\object+<1.5pt>
 {\scriptscriptstyle#1}}
$$\xy\xygraph{!{<3pc,0pc>:<0pc,5pc>::} 
 []!{\OutNeuron{-0.5}{Output unit}}
[dlll]="H"
 !{\drop!R\txt{\small Hidden Layer}}
 !{+(.5,0) @i} !{\Hidden {-0.5}{1}} 
[r]!{\Hidden {-1.5}{-1}}
[r]!{\Hidden {-2.5}{1 }}
[r]!{\Hidden {-3.5}{-1}} [r]!{\Extendd}
[r]!{\nudgeL\Hidden {.5-k}{-1}}
"H"[d]!{\drop!R\txt{\small Input Layer}}
 !{+(.50,0)}!{\Input}="a"
[r]!{\Input} [r]!{\Input} 
[r]!{\Input} [r]!{\Extend}
[r]!{\nudgeL\Input}="b"
!{@i \longbrace{$k$ units}}
"b"!{+(0,.5)\leftxt{All strengths $=1$}}
}\endxy $$
\end{verbatim}

\subsection*{Overview}
A structured programming approach seems to be most appropriate for these
Neural Network diagrams. 
The ``top-level'' specification should be easily human-readable, 
containing a specification of the existence of the various objects
within the diagram, together with text for any associated labels.
Also at this level is information concerning the visual layout.
Typically the user invents control-sequence names (macros) for the objects; 
names which parallel the jargon commonly used in the particular field-of-study.  

The ``lowest level'' of specification contains the details of how a particular
(part of an) object is to be drawn on the page, using \Xy-pic kernel language
or features. This allows easy access to the code to specify size, shape, exact spacing, 
placement of labels relative to the object being labelled, styles for links,
whether or not arrow-heads are required, and a myriad of other details.

Between these levels are the definitions of the user's macros. The high-level
objects generally will have some structure, some of which may be in common with
other objects. Sometimes there will be a need to differentiate between 
subcases of a class of objects. 
This level tends to consist of definitions in terms of macros
which are not used explicitly at the top level. 
Drawing an analogy with the neural net diagrams presented above,
this level of code represents a ``hidden'' layer which interfaces the 
top-level code as ``Input'' to the \Xy-pic code that actually places marks on
the paper as ``Output''. 

\bigskip
Many types of diagram can be produced
by making just small changes to code presented in the above examples. 
The \Xy-pic Reference Manual\cite{R94:XY-picRM} is the primary source 
to peruse for the coding required to obtain a desired effect.

\bibliographystyle{plain}%

\begin{thebibliography}{1}

\bibitem{neucomp}
Igor Aleksander and Helen Morton.
\newblock {\em An Introduction to Neural Computing}.
\newblock Chapman and Hall, 1990.

\bibitem{R94:XY-picRM}
Kristoffer~H. Rose and Ross Moore.
\newblock {\XY}-pic reference manual.
\newblock Mathematics Report 94--155, MPCE, Macquarie University, NSW 2109,
  Australia, June 1994.
\newblock For version 2.10. Latest version (3.0+) available by anonymous ftp in
  {\tt ftp.diku.dk: /diku\slash users\slash kris\slash TeX\slash xyrefer.ps.gz}
  or in {\tt ftp.mpce.mq.edu.au: pub\slash maths\slash TeX\slash
  xyrefer.ps.gz}.

\end{thebibliography}


\vfill
\end{document}