% First paper on Pfaffians, revised version
% accepted on Elec. J. Comb. sent December 98

\documentclass[12pt,fleqn]{article}
\usepackage{latexsym}

%Definizioni Latex Anna 

\newtheorem{Definition}{\bf Definition}[section]
\newtheorem{Example}[Definition]{\bf Example}
\newtheorem{Remark}[Definition]{\bf Remark}
\newtheorem{Lemma}[Definition]{\bf Lemma}
\newtheorem{Theorem}[Definition]{\bf Theorem}
\newtheorem{Corollary}[Definition]{\bf Corollary}
\newtheorem{Proposition}[Definition]{\bf Proposition}

\textwidth 15.2 cm   %**************
\textheight 229 mm  %**************
\oddsidemargin 0 cm  %**************
\topmargin -\headheight  %**************

\newcommand{\bform}{\begin{displaymath}}
\newcommand{\eform}{\end{displaymath}\smallskip}
\newcommand{\beqn}[1]{\begin{equation}\label{#1}}
\newcommand{\eeqn}{\end{equation}\smallskip}
\newcommand{\beqna}[1]{\begin{eqnarray}\label{#1}}
\newcommand{\eeqna}{\end{eqnarray}\smallskip}
\newcommand{\beqnan}{\begin{eqnarray*}}
\newcommand{\eeqnan}{\end{eqnarray*}\smallskip}
\newcommand{\tr}[1]{#1^{\scriptscriptstyle T}}
\newcommand{\rif}[1]{(\ref{#1})}
\newcommand{\vect}[2]{\left(\begin{array}{c} #1\\#2 \end{array}\right)}
\newcommand{\done}{\hfill$\Box$\par}

\def\Re{I\!\!R}
\def\gt{>}
\def\lt{<}
\def\sp{\;\;}
\def\wug{=^{\!\!\!\!\!^{2}}}
\def\wnug{\ne^{\!\!\!\!\!^{2}}}
\def\prec{<^{\!\!\!\!\!^{L}}}
\def\prece{\le^{\!\!\!\!\!^{L}}}
\pagestyle{myheadings}
\markright{\sc the electronic journal of combinatorics 6 (1999), \#R6\hfill}

\begin{document}

\date{}
\begin{titlepage}
\thispagestyle{empty}
\title{\large {\bf On the Theory of Pfaffian Orientations.}\\ 
{\bf I. Perfect Matchings and Permanents.}} 

\author{
\thanks {Supported by NATO-CNR Fellowship}
       \normalsize {\bf Anna Galluccio}\\
       {\normalsize Istituto di Analisi dei Sistemi ed} \\
       {\normalsize Informatica - CNR}\\ 
       {\normalsize viale Manzoni 30}\\
       {\normalsize 00185 Roma}\\
        {\normalsize ITALY}\\
       {\normalsize galluccio@iasi.rm.cnr.it}
\and
\thanks{Supported by DONET, GACR 0194 and GAUK 194}
   \normalsize {\bf Martin Loebl}\\
   {\normalsize Department of Applied Mathematics }\\
   {\normalsize Charles University}\\
   {\normalsize Malostranske n. 25}\\
   {\normalsize 118 00 Praha 1}\\
   %{\normalsize and University of Waterloo }\\
   {\normalsize CZECH REPUBLIC}\\
   {\normalsize loebl@kam.ms.mff.cuni.cz}
}

\maketitle

\begin{center}
Received May 7, 1998; Accepted October 28, 1998.
\end{center}
\bigskip

\begin{abstract}
Kasteleyn stated that the generating function
of the perfect matchings of a graph of genus $g$ may be written as
a linear combination of $4^g$ Pfaffians. 
Here we prove this statement. As a consequence we present a combinatorial
way to compute the permanent of a square matrix.
\end{abstract}

\bigskip

\begin{center}
{\bf Mathematical Reviews Subject Numbers} 05B35, 05C15, 05A15
\end{center}

\end{titlepage}

\section{Introduction}
The theory of Pfaffian orientations of graphs has been introduced by 
Kasteleyn \cite{kast,KAST1,KAST2} in early sixties to solve some 
enumeration problems arising from statistical physics 
\cite{kw,pw}. He proved 
fundamental results in the planar case and extended his approach 
to toroidal grids \cite{KAST2,KAST1,kast}.
The case of general toroidal graphs was also considered in an
unpublished manuscript by Barahona \cite{b2}.

In the present paper we extend the method proposed by Kasteleyn and 
we prove that the generating function of the perfect matchings of a graph 
of genus $g$ may be obtained as a linear combination of $4^g$ 
Pfaffians.  
As a consequence, we provide a new technique to compute permanents of
square matrices, which completes the scheme proposed by P\'olya in \cite{Polya}. 

A graph is a pair $G=(V,E)$ where $V$ is a set of {\it vertices} and $E$ is 
 a set of unordered pairs of elements of $V$, called {\it edges}. In this 
 paper we shall consider only graphs with finite number of vertices.
 If $e=xy$ is an edge then the vertices $x,y$ are
 called {\it endvertices} of $e$. We associate with each edge $e$ of $G$ 
 a variable $x_e$ and we let $x=(x_e:e\in E)$. For each $M\subset E$, 
 let $x(M)$ denote the product of the variables of the edges of $M$.

A graph $G'=(V',E')$ is called a {\it subgraph} of a graph $G=(V,E)$ if
 $V'\subset V$ and $E'\subset E$.
A {\it perfect matching} of a graph is a set of disjoint edges,
 whose union equals the set of the vertices.

Let $\{v_1,e_1,v_2,e_2,...,v_i,e_i,v_{i+1},...,e_n,v_{n+1}\}$ be a sequence
 such that each $v_j$ is a vertex of a graph $G$, each $e_j$ is an edge
 of $G$ and $e_j=v_jv_{j+1}$, and $v_i\neq v_j$ for $i<j$ except if
 $i=1$ and $j=n+1$. If also $v_1\neq v_{n+1}$ then $P$ is called {\it a path}
 of $G$. If $v_1=v_{n+1}$ then $P$ is called {\it a cycle} of $G$.
 In both cases the {\it length} of $P$ equals $n$. When no 
confusion arises we shall also denote paths by simply listing their 
edges, namely  $P=(e_1,e_2,\dots,e_n)$. 

 A graph $G=(V,E)$ is {\it connected} if it has a path between any pair
 of vertices, and it is {\it $2$-connected} if the graph 
 $G_v=(V-\{v\},\{e\in E; v\notin e\})$ is connected for each vertex $v$
 of $G$. Each maximal $2$-connected subgraph of $G$ is called
a {\it $2$-connected component} of $G$. 

Let $A\Delta B$ denote the symmetric difference of the sets $A$ 
and $B$ and let $a\wug b$ denote $a=b$ modulo $2$. 

Let $M,N$ be two perfect matchings of a graph $G$. Then $M\Delta N$ consists
 of vertex disjoint cycles of even length. These cycles are called
 {\it alternating cycles} of $M$ and $N$.

An {\it orientation} of a graph $G=(V,E)$ is a {\it digraph} $D=(V,A)$
 obtained from $G$ by 
fixing an orientation of each edge of $G$, i.e., by ordering the elements
 of each edge of $G$. The elements of $A$ are called {\it arcs}. 

%Let $D$ be an orientation of graph $G$. An alternating cycle of two
% perfect matchings of $G$
%is called {\it even} in $D$ if it has an even number of arcs directed
% in each of the two possible ways of traversing it. Otherwise it
% is called odd in $D$.

Let $C$ be a cycle of $G$ and let $D$ be an orientation of $G$.  
$C$ is said to be {\it clockwise even} in $D$ if it has an even number
of edges directed in $D$ in agreement with the clockwise traversal.
Otherwise $C$ is called {\it clockwise odd}. 
 


\begin{Definition}
The {\it generating function
 of the perfect matchings} of $G$ is the polynomial ${\cal P}(G,x)$ which equals
  the sum of $x(P)$ over all perfect matchings $P$ of $G$.
\end{Definition}


\begin{Definition}
Let $G$ be a graph and let $D$ be an orientation of $G$. Let $M$ be a perfect
matching of $G$. For each perfect matching $P$ of $G$ let
$sgn(D,M\Delta P)=(-1)^n$ where $n$ is the number of 
clockwise even alternating cycles
of $M$ and $P$, and let ${\cal P}(D,M)$ be the sum of
$sgn(D,M\Delta P) x(P)$ over all perfect matchings $P$ of $G$.
\end{Definition}


\begin{Definition}
Let $G=(V,E)$ be a graph with $2n$ vertices and $D$ an orientation of $G$. 
Denote by $A(D)$
the skew-symmetric matrix with the rows and the columns indexed by 
$V$, where $a_{vw}=x_{vw}$ in case $(v,w)$ is an arc of $D$, 
$a_{vw}= -x_{vw}$ in case $(w,v)$ is an arc of $D$, and $a_{vw}=0$
otherwise. 

The {\it Pfaffian} of the skew-symmetric matrix $A(D)$ is defined as 
 
$$Pf(A(D))=\sum_{P} s^*(P)a_{i_1j_1} \cdots a_{i_nj_n}$$
 
\noindent
where $P=\{\{i_1j_1\},\cdots,\{i_nj_n\}\}$ is a partition of the 
set $\{1,\dots,2n\}$ into pairs, $i_k<j_k$ for $k=1,\dots,n$, and 
$s^*(P)$ equals the sign 
of the permutation $i_1j_1\dots i_nj_n$ of $12\dots (2n)$.

Each nonzero term of the expansion of the Pfaffian of $A(D)$ 
equals $x(P)$ or $-x(P)$ where $P$ is a perfect matching of $G$. 
If $s(D,P)$ denote the sign of the term $x(P)$, we have that  

$$Pf(A(D))=\sum_{P} s(D,P)x(P).$$ 

\end{Definition}

\bigskip

The following theorem was proved by Kasteleyn \cite{KAST2}. 

\begin{Theorem} 
\label{Kastel}
Let $G$ be a graph and $D$ an orientation of $G$. Let $P,M$ be two 
perfect matchings of $G$. Then
$$s(D,P)=s(D,M)sgn(D,M\Delta P).$$
Hence, 
$$Pf(A(D))=\sum_{P} s(D,P)x(P)=s(D,M)\sum_{P} sgn(D,M\Delta P)x(P)=
s(D,M){\cal P}(D,M).$$
\end{Theorem}

\bigskip
The relevance of Pfaffians in our context lies in the fact that, despite their 
similarity with the permanent, they are polynomial time computable 
for skew-symmetric matrices (see \cite{Cayley}). In fact, see 
\cite{kast} for a proof. 

\begin{Theorem}
\label{Cayley}
Let $G$ be a graph and let $D$ be an orientation of $G$. 
Then $$Pf^2(A(D)) = det(A(D)).$$
\end{Theorem}

\bigskip\noindent
In \cite{KAST2} Kasteleyn  introduced the following notion:

\begin{Definition}
A graph $G$ is called {\it Pfaffian} if it has a {\it Pfaffian} orientation,
i.e., an orientation such that all alternating cycles with respect 
to an arbitrary fixed perfect matching $M$ of $G$ are clockwise odd.
\end{Definition}

\medskip
Hence if a graph $G$ has a Pfaffian orientation $D$ then 
the signs $s(D,P)$ are equal for all perfect matchings $P$ of $G$ and 
${\cal P}(G,x)^2 = Pf^2(A(D))= det(A(D))$.

\medskip
An {\it embedding} of a graph on a surface is defined in a natural way:
 the vertices are embedded as points, and each edge is embedded as a
 continuous non-self-intersecting curve connecting the embeddings
 of its endvertices. The interiors of the embeddings of the edges
 are pairwise disjoint and the interiors of the curves embedding edges
do not contain points embedding vertices. 

A graph is called {\it planar} if it may be embedded on the plane. 
A {\it plane graph} is a planar graph together with its planar embedding.
The embedding of a plane graph partitions the plane into connected
 regions called {\it faces}. The (unique) unbounded face is called
 {\it outer face} and the bounded faces are called {\it inner faces}.

Let $G$ be a plane graph. A subgraph of $G$ consisting of the vertices 
and the edges embedded on the boundary
 of a face will also be called {\it a face}.
If a plane graph is $2$-connected then each face is a cycle.

\medskip
Kasteleyn \cite{KAST2} observed that the planar graphs have a Pfaffian 
orientation; more specifically, he proved that 

\begin{Theorem}
\label{plpf}
Every plane graph has a Pfaffian orientation such that all inner 
faces are clockwise odd.
\end{Theorem}
\medskip\noindent
{\bf Proof.} Let $G$ be a plane graph, and let $M$ be its perfect matching.
Each alternating cycle of $M$ belongs to a $2$-connected component of $G$. 

Observe that $G$ has an orientation so that each inner face
 of each $2$-connected component of $G$ is clockwise odd.
 Each such face `encircles' no vertex of the corresponding $2$-connected 
 component.
Let $W$ be a $2$-connected component of $G$.
 Observe that the orientation we constructed has the property
that a cycle $C$ of $W$ is clockwise odd if and only if $C$ encircles an
even number of vertices of $W$.
Let $C$ be an alternating cycle of $M$ and let $W$ be a $2$-connected
 component of $G$ which contains $C$.
Then $C$ encircles an even number of vertices of $W$ and hence it is 
 clockwise odd.
\done


\section{Embeddings and Pfaffian orientations}

The {\it genus} $g$ of a graph $G$ is that of the orientable 
surface ${\cal S}\subset \Re^3$ of minimal genus on which $G$ may 
be embedded. 
Any orientable surface of genus $g$ has a {\it polygonal 
representation} obtained by cutting the $g$ handles of its space model.
In what follows we base our working definition of a surface on this concept.
 
\begin{Definition}
\label{surface}
A surface $S_g$ of genus $g$ consists of a {\it base} $B_0$ and $2g$ 
{\it bridges} $B^i_j$, $i=1,...,g$ and $j=1,2$, where 

\begin{itemize}
\item [i)]  $B_0$ is a convex $4g$-gon with vertices
$a_1, ...,a_{4g}$ numbered clockwise;

\item [ii)]  $B^i_1$, $i=1,\dots,g$, is a $4$-gon
with vertices $x^i_1, x^i_2, x^i_3, x^i_4$ numbered clockwise. It is glued 
with $B_0$ so that the edge $[x^i_1,x^i_2]$ of $B^i_1$ is identified with
the edge $[a_{4(i-1)+1},a_{4(i-1)+2}]$ of $B_0$ and the edge $[x^i_3,x^i_4]$ of 
$B^i_1$ is identified with the edge $[a_{4(i-1)+3},a_{4(i-1)+4}]$ of $B_0$; 

\item [iii)] $B^i_2$, $i=1,\dots,g$, is a $4$-gon with vertices 
   $y^i_1, y^i_2, y^i_3, y^i_4$ numbered clockwise. It is glued 
 with $B_0$ so that the edge $[y^i_1,y^i_2]$ of $B^i_2$ is identified with
 the edge $[a_{4(i-1)+2},a_{4(i-1)+3}]$ of $B_0$ and the edge $[y^i_3,y^i_4]$ of 
 $B^i_2$ is identified with
 the edge $[a_{4(i-1)+4},a_{4(i-1)+5\\ (mod 4g)}]$ of $B_0$.
\end{itemize}
\end{Definition}

\medskip
Observe that in Definition~\ref{surface} we denote by $[a,b]$ 
edges of polygons and not edges of graphs.
The usual representation in the space of an orientable surface 
${\cal S}$ of genus $g$ 
may be then obtained from its polygonal representation $S_g$ by the 
following operation: for each bridge 
$B$, glue together the two segments which $B$ shares with the boundary of 
$B_0$, and delete $B$.
 
\begin{Definition}
\label{embed}
A graph $G$ is called a $g$-graph if it may be embedded on $S_g$
 so that all the vertices belong to the base $B_0$, and 
 the embedding of each edge uses at most one bridge. 
The set of the edges embedded entirely on the base will be denoted by
 $E_0$ and the set of the edges embedded on the bridge $B^i_j$ will be
 denoted by $E^i_j$, $i=1,\dots,g,$  $j=1,2$.
% We also let $G_0=(V,E_0)$ and $G^i_j=(V,E_0\cup E^i_j)$.
 \noindent
 If a $g$-graph $G$ satisfies the following further conditions:
\begin{enumerate}
\item[1.]
 the outer face of $G_0=(V,E_0)$ is a cycle,
 and it is embedded on the boundary of $B_0$,
\item[2.]
if $e\in E^i_1$ then $e$ is embedded entirely on $B^i_1$ and
one endvertex of $e$ belongs to $[x^i_1,x^i_2]$ and the other one belongs
 to $[x^i_3,x^i_4]$. Similarly,
if $e\in E^i_2$ then $e$ is embedded entirely on $B^i_2$ and
one endvertex of $e$ belongs to $[y^i_1,y^i_2]$ and the other one belongs
 to $[y^i_3,y^i_4]$.
\item[3.] each vertex is incident with at most one edge which does 
 not belong to $E_0$,
\item[4.] $G_0$ has a perfect matching,
\end{enumerate}

\noindent
then we say that $G$ is a {\it proper $g$-graph}.
\end{Definition}

\medskip
Given a proper $g$-graph $G$, we denote by $C_0$
 the cycle which forms the outer face of $E_0$; then, we fix 
 a perfect matching of $G_0$ and denote it by $M_0$. 



\begin{Definition}
\label{proj}
Let $G$ be a proper $g$-graph and let $G^i_j=(V,E_0\cup E^i_j)$.
If we draw $B_0 \cup B^i_j$ 
 on the plane as follows: $B_0$ is unchanged,
 and the edge $[x^i_1,x^i_4]$ ($[y^i_1,y^i_4]$ respectively) of $B^i_j$
 is drawn so that it belongs to the external boundary of $B_0\cup 
 B^i_j$, we obtain a planar embedding of $G^i_j$. This embedding 
 will be called {\it planar projection of $E^i_j$ outside $B_0$}.
\end{Definition}



\begin{Definition}
\label{proj1}
Let $G=(V,E)$ be a proper $g$-graph. 
A Pfaffian orientation $D_0$ of $G_0$ such that each inner face of
each $2$-connected component of $G_0$ is clockwise odd in $D_0$ 
is called a {\it basic} orientation of $G_0$.
\end{Definition}

Note that a basic orientation always exists for a planar graph 
by Theorem~\ref{plpf}. 

\medskip
\begin{Definition}
\label{proj2}
Let $G=(V,E)$ be a proper $g$-graph and $D_0$ a basic orientation 
of $G_0$. We define the orientation $D^i_j$ of each $G^i_j$ as follows:
We consider $G^i_j$ embedded 
 on the plane by the planar projection of $E^i_j$ 
outside $B_0$ (see Definition \ref{proj}), and 
 complete the basic orientation $D_0$ of $G_0$ to an orientation
 of $G^i_j$ so that each inner face of each $2$-connected
 component of $G^i_j$ is clockwise odd.

\noindent
The orientation $-D^i_j$ is defined by reversing the orientation $D^i_j$ of 
$G^i_j$.
\end{Definition}

\bigskip
Observe that after fixing a basic orientation $D_0$, 
the orientation $D^i_j$ is uniquely determined for each $i,j$.


\begin{Definition}
Let $G$ be a proper $g$-graph, $g \geq 1$. An orientation $D$ of $G$
which equals the basic orientation $D_0$ on $G_0$ and which equals 
$D^i_j$ or $-D^i_j$ on $E^i_j$
 is called {\it relevant}. We define its {\it type} 
 $r(D) \in \{+1,-1\}^{2g}$ as follows:
For $i =0,\dots,g-1$ and $j =1,2$, $r(D)_{2i + j}$ equals  $+1$ or $-1$
according to the sign of $D^{i+1}_j$ in $D$.
\end{Definition}

\begin{Definition}
\label{type}
Let $G$ be a proper $g$-graph and let $A$ be a subset of its edges. 
 The {\it type} of $A$ is a vector $t(A) \in \{0,1\}^{2g}$
 defined as follows: For $i =0,...,g-1$ and $j =1,2$, we let
 $t(A)_{2i+j}$ equals the number of edges of $A$
 which belong to $E^{i+1}_j$, modulo $2$.

Let $CR(A)\wug \sum_{i=0}^{g-1} t(A)_{2i+1}\cdot t(A)_{2i+2}$ 
denote the {\it number of crossings} of the embeddings of the 
edges of $A$, after making planar projections of $E^i_j$ for all 
$i,j$. 


Let $BR(A)$ denote the subset of edges of $A$ which do not belong to 
$E_0$. For each $e\in BR(A)$, let $d(e)=2i+j$ if $e\in E^{i+1}_j$.
\end{Definition}


\bigskip
We complete the section with a lemma. 

%crossings of closed curves drawn in the plane. 
%We want to show that 


\begin{Lemma}
\label{sgn0}
Let $G$ be a proper $g$-graph.
Let $C_1,...,C_k$ be vertex-disjoint cycles of $G$ and let ${\cal C}$
denote their union. Then 
$$CR({\cal C})\wug \sum_{i=1}^k CR(C_i).$$
\end{Lemma}
\medskip\noindent
{\bf Proof.}
Let us embed the cycles $C_1,...,C_k$ using the planar projections of 
$E^i_j$ outside $B_0$ by Definition \ref{type}.
Then $CR({\cal C})$ equals the total number of crossings of ${\cal C}$ 
(modulo $2$). Now, 
each cycle $C_l$, $l=1,...,k$ is represented as a closed curve in the 
plane and each pair of cycles $C_i$ and $C_j$, $i\ne j$, 
intersects an even number of times. 
Hence the sum (modulo $2$) of the number of crossings between pairs of 
cycles $C_i$ and $C_j$, $i\ne j$, is $0$ and does not affect $CR({\cal C})$. 
Each of the remaining crossings is a crossing of some $C_l$, 
$l=1,...,k$, with itself and the lemma follows. 
\done


\section{Perfect matchings}

Through this section, the graph $G$ will be a proper $g$-graph embedded on a fixed 
surface $S_g$. We also fix a perfect matching $M_0$ of $G_0$. 

The aim of this section is to prove that, for any perfect matching $P$, the\\ 
$sgn(D,M_0\ \Delta P)$ depends only  on the vectors $t(M_0\Delta P)$ and $r(D)$.


%on the number of edges of $M_0\Delta P$ and the orientation $D$ of $G$, namely,
Given an orientation $D$ of $G$ and an even length cycle $C$ of $G$, we denote  
by $l_D(C)$ the number of arcs of $C$ directed 
in agreement with any of the two possible ways of traversing $C$, modulo 2.
For short, any alternating cycle 
with respect to $M_0$ will be simply called an {\it alternating cycle}.
In order to prove our statement, we consider first the case that $M_0\Delta P$ 
consists of exactly one alternating cycle. 

\begin{Theorem}
\label{sgn1}
Let $G$ be a proper $g$-graph and let $D$ be a relevant orientation of $G$.
If $C$ is an  alternating cycle of $G$, then
$$l_D(C)\wug |BR(C)|-1-CR(C) + \frac{1}{2} \sum_{e\in BR(C)}(r(D)_{d(e)}+1).$$
\end{Theorem}
\medskip\noindent
{\bf Proof.}
We assume without loss of generality that $G=C \cup C_0 \cup M_0$, where $C_0$ 
is the outer face of $G_0$ and $M_0$ is the fixed perfect matching of $G_0$.
Let $D_0$ be the basic orientation of $G_0$.

\smallskip\noindent
{\bf Claim~1.} {\it
If $C$ intersects at most one of $E^i_1, E^i_2$, for each $i=1,...,g$, 
then} $$l_D(C)\wug |BR(C)|-1 + \frac {1}{2} \sum_{e\in BR(C)}(r(D)_{d(e)}+1).$$

\noindent
A cycle $C$ satisfying the properties of Claim~1 may be embedded 
without crossings using the planar projection of each $E^i_j$ 
outside $B_0$.
Hence $l_D(C)=1$ if and only if $|\{e \in BR(C): r(D)_{d(e)}=-1\}|\wug 0$. 
\hfill {\bf End of Claim~1.}

\medskip
The proof is by induction on $|BR(C)|$. The case $|BR(C)|=0$ is 
proved by Claim~1.
%So, we need to make the induction step. 
%Note that if Theorem \ref{sgn1} holds for cycle $C$, then $l_D(C)$ depends 
%only on $t(C)$ and $r(D)$.
By induction we assume that 

$$l_W(C')\wug |BR(C')|-1-CR(C') + \frac{1}{2} \sum_{e\in BR(C')}(r(W)_{d(e)}+1)$$

for any alternating cycle $C'$ of a proper $g$-graph $H$, with relevant 
orientation $W$, such that $|BR(C')|<|BR(C)|$. 

%Hence we assume that for each such alternating cycle $C'$, $l_W(C')$ depends only 
%on $t(C')$ and $r(W)$. This justifies the
%following notational agreement: we denote
%$l_W(C')$ simply by $l(t(C'), r(W))$. 


%We shall make the following notational agreement: if a segment $S$ of $C_0$
 %is traversed clockwise then we denote it by $+S$, otherwise by $-S$. 

%If $P$ is a path of a graph $G$ together with a prescribed way of traversing 
%it,
 %and $W$ is an orientation of $G$, we denote by $l_W(P)$ the parity of
 %the number of arcs of $P$ oriented in $W$ in agreement
 %with the way of traversing $P$. We let $l_W(P)=l(P)$ if no confusion can 
%arise.

We distinguish  two cases. 

\medskip\noindent
{\bf Case~1.} {\it There exists a bridge $B=B^i_j$ containing more than one 
edge of $C$.}
%, then the theorem holds.}

\noindent
Let $e=u_1u_2$ and $f=v_1v_2$ be two edges of $C\cap E^i_j$ which see 
each other on $B$, i.e., there is no other edge of $C$ drawn between them on $B$.
Without loss of generality, let $e$ be nearer to the edge 
$[a_{2(i-1)+j},a_{2(i-1)+j+3}]$ of $B=B^i_j$ than $f$ and let 
$u_1,v_1$ and $u_2,v_2$ belong to the edge $[a_{2(i-1)+j},a_{2(i-1)+j+1}]$ and 
$[a_{2(i-1)+j+2},a_{2(i-1)+j+3}]$, respectively.    
Since $e,f$ do not belong to $E_0$, they are not edges of $M_0\subset E_0$.

Let $R_i$ be the subpath of $C_0$ from $u_i$ to $v_i$, $i=1,2$,  
and let $R$ be the cycle of $G$ consisting of $(R_1,f,R_2,e)$.
By the choice of $e,f$, the cycle $R$ is the boundary of a face of 
the planar projection of $G^i_j=(V,E_0\cup E^i_j)$ outside $B_0$. 
Observe that $l_W(R)=1$ for each relevant orientation $W$ of $G$, 
since $R$ contains two edges embedded outside $B_0$.

Let us introduce a new edge $h$ (not belonging to $G$),
 between the endvertices of $e,f$ such that one of two cycles 
${\bar H}_1, {\bar H_2}$
 formed by $h$ and $C$ and containing $h$  is alternating.
 Without loss of generality, let $h$ have $u_1$ as an endvertex. 
Hence we have that $h=u_1v_1$ or $h=u_1v_2$.

We may assume without loss of generality that ${\bar H}_2$ is alternating. 
Hence ${\bar H}_1$ contains both $e,f$. Note that ${\bar H}_1$ consists 
of an even number of edges.
We denote by $h_1,h_2$ the two arcs with the same endvertices as $h$,
directed oppositely. 
 Let $D'=D\cup \{h_1,h_2\}$. Let $H_i$ be the subdigraph of $D'$
which is the orientation of ${\bar H}_i$ using $h_i$, $i=1,2$.
Observe that $l_D(C)=l_{D'}(H_1)+l_{D'}(H_2)$.


\medskip\noindent
{\it Subcase~1.1: $h_1=u_1v_1$.}

We adjust the boundary of $B_0$ by replacing $\{R_1\}$ with $h_1, h_2$.
Observe that $CR(C)\wug CR(H_1)+CR(H_2)$: attention should be drawn to the 
question of how crossings of $C$ with itself
are manifested as crossings of $H_1$ or $H_2$, when all $E^i_j$ are projected 
outside of $B_0$ (see Definition \ref{proj}). 
If two edges of $C$ cross and they are not separated in $C$ by the endvertices
of $h_1$, then that crossing counts as a crossing with in $H_1$ or $H_2$. 
We must therefore consider the parity of the number of
crossings of $C$ where the crossed edges are separated in $C$ by the endvertices
of $h_1$. These crossings are counted as crossings of $H_1$ with $H_2$. If the 
number of such crossings of $C$ is odd, then there must be an additional crossing 
of $H_1$ with $H_2$, since the total number of crossings of $H_1$ with $H_2$ must 
be even. 
Since $h_1$ and $h_2$ do not cross, this additional crossing must occur at an 
endvertex of $h_1$. 
It is easy to see that in the present case there is no such crossing, and so,
there 
are an even number of crossings of $C$ where the crossed edges are separated in 
$C$ by the ends of $h$.
The required congruence therefore follows in this case.


\noindent  
We construct now two digraphs $D_1, D_2$ as follows:
\begin{itemize}
\item [-] $D_1$ is obtained from $D-\{e,f\}$ 
by adding new vertices $u'_1,v'_1$ of degree $2$,
incident with new arcs $e',f',h'_1$. The arcs $e',f',h'_1$ are obtained from 
$e,f,h_1$ by replacing $u_1$ by $u'_1$ and $v_1$ by $v'_1$. 
We adjust the boundary of $B_0$ by replacing $\{R_2\}$ with
$\{e',f',h'_1\}$. Finally we add $h'_1$
 to $M_0$. Let $H'_1$ be the cycle of $D_1$ obtained from $H_1$
 by replacing $e,f,h_1$ by $e',f',h'_1$.
 Then $l_{D_1}(H'_1)=l_{D'}(H_1)$ and $CR(H_1')\wug CR(H_1)$;

\item[-] $D_2$ is obtained from $D-\{e,f\}$ by adding arc $h_2$. 
We remind that $h_2$ is embedded on the adjusted $B_0$ parallel to $R_1$.
Let $H'_2=H_2$. Then $l_{D_2}(H_2')=l_{D'}(H_2)$ and $CR(H_2')\wug CR(H_2)$.
\end{itemize} 

We remind that $l_D(R)=1$. Hence, exactly one of $h_i$ is oriented 
so that both cycles it makes with $R$ are clockwise odd.
Let it be $h_2$. Then $D_2$ is a relevant orientation and $D_1$ 
becomes relevant after reversing the orientation of $h'_1$: this digraph,
obtained from $D_1$ by reversing the orientation of $h'_1$, we denote by
$D^*_1$, and its subdigraph corresponding to $H'_1$ we denote by $H^*_1$. 
Then, $l_{D^*_1}(H^*_1)\wug l_{D_1}(H'_1)+1$. 

Note that both $D_2$ and $D^*_1$ are relevant orientations of proper $g$-graphs,
$H'_2$ is an alternating cycle of $D_2$, $H^*_1$ is an alternating cycle of 
$D^*_1$ and $CR(H^*_1) < CR(C)$ and $CR(H'_2) < CR(C)$. 
Hence, by the induction assumption, we have that:
 
%$l_{D_2}(H'_2)=l(t(H'_2),r(D_2))$ and $l_{D_1}(H'_1)+1\wug l_{D^*_1}(H^*_1)
%\wug l(t(H^*_1),r(D^*_1)) \wug l(t(H'_1),r(D_1)).$ 
%We have that
   
$$l_D(C)\wug l_{D'}(H_1)+l_{D'}(H_2)\wug l_{D_1}(H'_1)+l_{D_2}(H'_2)\wug 
l_{D_1^*}(H^*_1)+1+l_{D_2}(H'_2)\wug$$
%$$l(t(H'_1),r(D_1))+l(t(H'_2),r(D_2))+1\wug$$
$$|BR(H_1^*)|-1-CR(H^*_1) + \frac{1}{2} \sum_{p\in BR(H_1^*)}(r(D_1^*)_{d(p)}+1) +$$
$$|BR(H'_2)|-1-CR(H'_2) + \frac{1}{2} \sum_{p\in BR(H'_2)}(r(D_2)_{d(p)}+1)+1.$$

Now, the theorem follows by observing that $|BR(C)|\wug |BR(C-\{e,f\})|\wug 
|BR(H_1^*)|+|BR(H_2')| - 2$, $CR(C)\wug CR(H_1^*)+CR(H'_2)$ and
$r(D_1^*)_{d(p)}$, $r(D_2)_{d(p)}$ and $r(D)_{d(p)}$ coincide for any 
$p\in BR(C)-\{e,f\}$. Hence,
$$l_D(C)\wug |BR(C)|-1-CR(C)+ \frac{1}{2} \sum_{p\in BR(C)}(r(D)_{d(p)}+1).$$
\hfill {\it (End of Subcase~1.1)}

 
\medskip\noindent
{\it Subcase~1.2: $h_1=u_1v_2$.}

Let $h_1$ and $h_2$ be embedded on the bridge $B$.
Observe that $CR(C)\wug CR(H_1)+CR(H_2) +1$: attention again should be drawn to the 
question of how crossings of $C$ with itself
are manifested as crossings of $H_1$ or $H_2$, when all $E^i_j$ are projected 
outside of $B_0$ (see Definition \ref{proj}). To see this clearly, we introduce 
some notation. Let $A$ be a subset of arcs of $H_1$ and 
$B$ a subset of arcs of $H_2$. We denote by $CR(A\times B)$ the number of 
crossings between arcs of $A$ and $B$, mod $2$. We also denote by $cr(i,j)$ 
the number of crossings of arcs of $H_i\cap C$ with $h_j$. Hence, we have:

$$CR(H_1)\wug CR(H_1\cap C) + cr (1,1),$$ 
$$CR(H_2)\wug CR(H_2\cap C) + cr (2,2),$$
$$CR(C)\wug CR(H_1 \cap C) + CR(H_2 \cap C) + CR((H_1 \cap C)\times (H_2 \cap C)),$$
$$CR(H_1\times H_2)\wug 0,$$
and 
$$\sum_{i,j=1}^2 cr(i,j)\wug 0$$
since each arc which crosses $h_1$ crosses also $h_2$.

Hence it remains to show that 
$$CR(H_1\times H_2)\wug CR((H_1\cap C)\times (H_2\cap C)) + cr(1,2) + cr(2,1) + 1:$$
this follows since in this case one additional crossing between $H_1$ and 
$H_2$ must occur at an endvertex of $h$. The required congruence  
follows.  
 
We construct two digraphs $D_1, D_2$ as follows:
\begin{itemize}
\item [-] $D_1$ is obtained from $D-\{e,f\}$ 
by adding a new arc $h'_1$ between $v_1$ and the endvertex $u_2$ of 
$e$. If $l_{D'}(fh_1e)=1$ then we let $h'_1=(v_1,u_2)$.
If $l_{D'}(fh_1e)=0$ then 
%$l(e_1f)=1$ and 
we let $h'_1=(u_2,v_1)$.
 
We consider $h'_1$ embedded on the bridge $B$.
Let $H'_1$ be obtained from $H_1$ by replacing $\{f,h_1,e\}$ by $h'_1$.
We have $l_{D'}(H_1)=l_{D_1}(H'_1)$ and $CR(H_1)=CR(H'_1)$.
% and $t(H'_1)=t(H_1)$.

\item[-] $D_2$ is obtained from $D-\{e,f\}$ 
by adding the arc $h_2$. We consider $h_2$ embedded on the bridge $B$.  
We let $H_2=H'_2$. Thus again we have $l_{D'}(H_2)=l_{D_2}(H'_2)$ and 
$CR(H_2)=CR(H'_2)$. 
%and $t(H'_2)=t(H_2)$.
\end{itemize}


We remind that $l_D(R)=1$ and thus exactly one of $h_i$ is oriented so that
both cycles it makes with $R$ are clockwise odd. Let it be $h_2$.
Let $R_3$ be the subpath of $C_0$ from $v_1$ to $v_2$ such that $(e,R_1,R_3,R_2)$ 
is a cycle. We have $l_{D_1}(h'_1,R_3,R_2)\wug l_{D'}(e,h_1,f,R_3,R_2)\wug
l_{D'}(f,R_3)+l_{D'}(e,h_1,R_2)$.

We show now that both $D_1$ and $D_2$ are relevant orientations with 
$r(D_1)=r(D_2)=r(D)$. We only need to show that $h'_1$ and $h_2$ are correctly 
oriented in $D_1$ and $D_2$. This follows easily for $D_2$, since both
cycles $h_2$ makes with $R$ are clockwise odd.

For $D_1$ we distinguish two cases. First, let $r(D)_{2(i-1)+j}=1$.
In this case we have $l_{D'}(f,R_3)=1$ and $l_{D'}(e,h_2,R_2)=1$. 
Hence $l_{D'}(e,h_1,R_2)=0$. It follows that $l_{D_1}(h'_1,R_3,R_2)=1$
and $D_1$ is relevant with $r(D_1)=r(D)$.
Secondly, let $r(D)_{2(i-1)+j}=-1$. In this case we have 
$l_{D'}(f,R_3)=0$ and $l_{D'}(e,h_2,R_2)=1$. Hence $l_{D'}(e,h_1,R_2)=0$.
It follows that $l_{D_1}(h'_1,R_3,R_2)=0$ and $D_1$ is relevant with $r(D_1)=r(D)$.

Hence, $D_i$ is a relevant orientation of a proper $g$-graph,
$H'_i$ is an alternating cycle of $D_i$ and $|BR(H'_i)|<|BR(C)|$, for $i=1,2$, and, 
by the induction hypothesis, we have that:


%By the induction 
%for $D_k$ and $H'_k$, $k=1,2$, we get that
%$l_{D'}(H_k)\wug l_{D_k}(H'_k) \wug l(t(H_k),r(D))$.
%Using the definition of $l(t(H_k),r(D))$ we get:
$$l_D(C)\wug l_{D'}(H_1)+l_{D'}(H_2)\wug l_{D_1}(H'_1)+l_{D_2}(H'_2)\wug$$

%l(t(H_1),r(D))+l(t(H_2),r(D))\wug$$
%$$|BR(C)|-2-CR(C)-1 + \frac{1}{2} \sum_{p\in BR(C)-\{e,f\}}(r(D)_{d(p)}+1)+
%\frac{1}{2} (r(D)_{d(h_2)}+1)+
%\frac{1}{2} (r(D)_{d(h'_1)}+1) \wug $$

$$|BR(H'_1)|-1-CR(H'_1) + \frac{1}{2} \sum_{p\in BR(H'_1)}(r(D_1)_{d(p)}+1) +
\frac{1}{2}(r(D_1)_{d(h_1)}+1) + $$
$$|BR(H'_2)|-1-CR(H'_2) + \frac{1}{2} \sum_{p\in BR(H'_2)}(r(D_2)_{d(p)}+1) +
\frac{1}{2}(r(D_2)_{d(h_2)}+1).$$

The theorem follows by observing that $|BR(C)|\wug |BR(C-\{e,f\})|\wug |BR(H'_1)|+
|BR(H'_2)| - 2$, $CR(C)+1\wug CR(H'_1)+CR(H'_2)$ and
$r(D_1)=r(D_2)=r(D)$.

%, we can state the required equality:

%$$l_D(C)\wug |BR(C)|-1-CR(C)+ \frac{1}{2} \sum_{p\in BR(C)}(r(D)_{d(p)}+1).$$
\hfill {\it (End of Subcase~1.2)}

\hfill {\bf End of Case~1}

\medskip\noindent
{\bf Case~2.} {\it There exists $i$ such that $C$ contains
exactly one edge from both $E^i_1$ and $E^i_2$.}
%, then the theorem holds.}

\smallskip\noindent
Let $e\in E^i_1$ and $f\in E^i_2$ and let $C_1$
and $C_2$ be two paths such that $C=(C_1, e, C_2, f)$.
The endvertices of $e,f$ belong to $C_0$. 
Let us assume that along the boundary of $B_0$ from $a_{4(i-1)+1}$ to 
$a_{4i+1}$, the endvertices of $e,f$ appear in the order 
$v_1,u_1,v_2,u_2$ where $e=u_1u_2$ and $f=v_1v_2$.

Let $R_1,R_2$ be the two disjoint subpaths of the segment of $C_0$ between
$a_{4(i-1)+1}$ and $a_{4i+1}$, which cover the endvertices of $e,f$.
Note that $R_1,R_2$ contain no other vertex of $G$ incident with an 
edge out of $E_0$, by the choice of $i$. Let $R$ denote the cycle $(R_1,e,R_2,f)$
and let $R_3$ denote the segment of $C_0$ between $u_1$ and $v_2$. 

Let us introduce a new edge $h$ (not belonging to $G$),
 between endvertices of $e,f$ such that one of two cycles 
${\bar I_1},{\bar I_2}$ formed by $h$ and $C$ and containing $h$  is 
alternating.

Without loss of generality let $h$ have $u_1$ as an endvertex. 
Hence we have that $h=u_1v_1$ or $h=u_1v_2$.
We may also assume without loss of generality that ${\bar I}_2$ is alternating. 
Hence ${\bar I}_1$ contains both $e,f$. Note that ${\bar I}_1$ consists 
of an even number of edges.

We denote by $h_1,h_2$ the two arcs with the same endvertices as $h$,
directed oppositely. 
 Let $D'=D\cup \{h_1,h_2\}$. Let $I_i$ be the subdigraph of $D'$
which is the orientation of ${\bar I}_i$ using $h_i$, $i=1,2$.
Observe that $l_D(C)=l_{D'}(I_1)+l_{D'}(I_2)$.
 

Again we distinguish two subcases. 
 
\medskip\noindent
{\it Subcase~2.1: $h_1=u_1v_1$.}

In this case $h$ forms a cycle with $R_1$.

As in Subcase~1.1, we extend $B_0$ along $R_1$ and consider $h_1, h_2$ 
as embedded on the extended $B_0$.

Observe that $CR(C)\wug CR(I_1)+CR(I_2)$: attention should be drawn to the 
question of how crossings of $C$ with itself
are manifested as crossings of $I_1$ or $I_2$, when all $E^i_j$ are projected 
outside of $B_0$ (see Definition \ref{proj}). In this case, the arguments are 
identical to those used in the proof of Subcase 1.1, and we omit them.

We construct two digraphs $D_1, D_2$ as follows:
\begin{itemize}
\item[-]
$D_1$ is obtained from $D-\{e,f\}$ 
by adding new vertices $u_1',v'_1$ of degree $2$,
incident with new arcs $e',f',h'_1$. The arcs $e'f',h'_1$ are obtained 
from $e,f,h_1$ by replacing $u_1$ by $u'_1$ and $v_1$ by $v'_1$.
 We extend $B_0$ along $R_2$ and
 we embed the path $(e',f',h'_1)$ on the extended $B_0$.
 Finally we add $h'_1$ to $M_0$. Let $I'_1$ be the cycle of $D_1$ obtained 
 from $I_1$ by replacing $e,f,g_1$ by $e',f',g'_1$.
 We have $l_{D'}(I_1)=l_{D_1}(I'_1)$ and $CR(I_1)-1\wug CR(I'_1)$.

\item[-]$D_2$ is obtained from $D-\{e,f\}$ 
by adding the arc $h_2$. 
We consider $h_2$ embedded on 
 the extended $B_0$ along $R_1$. We let $I'_2=I_2$. Hence, 
$l_{D'}(I_2)=l_{D_2}(I'_2)$ and $CR(I_2)\wug CR(I'_2)$.
\end{itemize}
 
Hence, for $i=1,2$, $D_i$ is an orientation of a proper $g$-graph and
$I'_i$ is an alternating cycle of $D_i$. Moreover $|BR(I'_i)|<|BR(C)|$.
 
Let us assume without loss of generality that $h_2$ is directed so that 
the cycle $l_{D'}(R_1,h_2)=1$. Hence $D_2$ is a relevant orientation
with $r(D_2)=r(D)$.

We show now that $D_1$ is  a relevant orientation with $r(D)=r(D_1)$
if and only if $r(D)_{d(e)}=r(D)_{d(f)}$.
We first prove that if $r(D)_{d(e)}=r(D)_{d(f)}=1$ then $D_1$ is 
a relevant orientation. 

In this case it suffices to show that $l_{D_1}(R_2,f',h'_1,e')\wug 1$.
We have $l_{D_1}(h'_1,f',R_3)\wug l_{D'}(h_1,f,R_3)\wug 
l_{D'}(h_2,f,R_3)+1 \wug l_{D_2}(h_2,f,R_3)+1\wug 0$, 
since $r(D_2)_{d(f)}=r(D){d(f)}=1$, and thus, $l_{D_2}(h_2,f,R_3)=1$. 
%Moreover 
%$l(h'_1,f')=l(f',h'_1)$ since it does not
%matter which way two consecutive arcs are traversed.
%Hence $l(f',g'_1)=l(-R_3)$.

Moreover $l_{D_1}(R_2,R_3,e')=l_{D'}(R_2,R_3,e)=1$, since $r(D)_{d(e)}=1$ 
and $D$ is a relevant orientation. 
Replacing $f'h'_1$ for $R_3$ gives what we claimed. 
 
Similarly, we can prove that if $r(D)_{d(e)}=r(D)_{d(f)}=-1$ then again\\
$l_{D_1}(R_2,f',h'_1,e')=1$, and so, $D_1$ is a relevant orientation. 

On the other hand, if $r(D)_{d(e)}\neq r(D)_{d(f)}$ then $D_1$ is 
obtained from a relevant orientation by reversing one arc, and so, 
it is not relevant. 

Summarizing,  if $r(D)_{d(e)}=r(D)_{d(f)}$ then $D_1$ is  a relevant 
orientation with $r(D)=r(D_1)$, and if $r(D)_{d(e)}\neq r(D)_{d(f)}$
then $D_1$ becomes relevant after reversing the orientation of $h'_1$: 
this digraph, obtained from $D_1$ by reversing the orientation of $h'_1$, 
we denote by $D^*_1$, and its subdigraph corresponding to $H'_1$ we denote 
by $H^*_1$. Then $l_{D_1^*}(I'_1)\wug l_{D_1}(I'_1)+1$.


Using the induction assumption of \ref{sgn1} for $D^*,I^*_1$, $D_1,I'_1$ and
$D_2,I'_2$  we get:
$$l_D(C)\wug l_{D'}(I_1)+l_{D'}(I_2)\wug l_{D_1}(I'_1)+l_{D_2}(I'_2)\wug$$
% $$l(t(I_1),r(D))+l(t(I_2),r(D))+\frac{1}{2}
%(r(D)_{d(e)}-1+r(D)_{d(f)}-1)\wug$$
$$|BR(C)|-4-CR(C)+1 + \frac{1}{2} \sum_{p\in BR(C)-\{e,f\}}(r(D)_{d(p)}+1)+
\frac {1}{2} (r(D)_{d(e)}-1+r(D)_{d(f)}-1)\wug$$
$$|BR(C)|-1-CR(C) + \frac{1}{2} \sum_{p\in BR(C)}(r(D)_{d(p)}+1).$$

\hfill {\it (End of Subcase~2.1)}

\medskip\noindent
{\it Subcase~2.2: $h=u_1v_2$.}

In this case $h$ forms a cycle with $R_3$.
We extend $B_0$ along $R_3$ and consider $h_1, h_2$ embedded on the extended $B_0$.

Observe that $CR(C)\wug CR(I_1)+CR(I_2)$:attention should be drawn to the 
question of how crossings of $C$ with itself
are manifested as crossings of $I_1$ or $I_2$, when all $E^i_j$ are projected 
outside of $B_0$ (see Definition \ref{proj}). In this case, the arguments are 
identical to those used in the proof of Subcase 1.1 and Subcase 2.1, 
and we omit them.

We construct two digraphs $D_1, D_2$ as follows:
\begin{itemize}
\item[-] $D_1$ is obtained from $D-\{e,f\}$ 
by adding new vertices $u_1',v'_2$ of degree $2$,
incident with new arcs $e',f',h'_1$. The arcs $e',f',h'_1$ are obtained 
from $e,f,h_1$ by replacing $u_1$ by $u_1'$ and $v_2$ by $v'_2$.
 We extend $B_0$ along $R_1 R_3 R_2$ and
 we embed $e',f',h'_1$ on the extended $B_0$.
 Finally we add $h'_1$ to $M_0$. Let $I'_1$ be the cycle of $D_1$ 
 obtained from $I_1$ by replacing $e,f,h_1$ by $e',f',h'_1$.
 We have that $l_{D'}(I_1)\wug l_{D_1}(I'_1)$ and $CR(I_1')\wug CR(I_1)-1$.

\item[-] $D_2$ is obtained from $D-\{e,f,\}$ by adding arc $h_2$. 
We again extend $B_0$ along $R_3$ and consider $h_2$ embedded on 
 the extended $B_0$. We let $I'_2=I_2$. Hence, $l_{D'}(I_2)\wug l_{D_2}(I'_2)$ and 
$CR(I_2')\wug CR(I_2)$.
\end{itemize}
 
Hence for $i=1,2$, $D_i$ is an orientation of a proper $g$-graph and
$I'_i$ is an alternating cycle of $D_i$. Moreover $|BR(I'_i)|<|BR(C)|$.

Let us assume without loss of generality that $h_2$ is directed so that
$l(R_3,h_2)=1$. Hence $D_2$ is a relevant orientation with $r(D_2)=r(D)$.

As in Subcase~2.1, we shall show that $D_1$ is  a relevant orientation
if and only if $r(D)_{d(e)}=r(D)_{d(f)}$: 
It again suffices to consider the case that $r(D)_{d(e)}=r(D)_{d(f)}=1$. 
In this case it suffices to show that  $l_{D_1}(R_2,R_3,R_1,f',h'_1,e')=1$.
In fact, we have $l_{D_2}(R_1,f,h_2)=1$ since $r(D_{d(f)})=1$ and $D_2$ is 
a relevant orientation. Hence $l_{D_1}(R_1,f',h'_1)=0$.
Moreover $l_{D_1}(R_2,R_3,e')\wug l_D(R_2,R_3,e)=1$ since 
$r(D)_{d(e)}=1$. Hence $l_{D_1}(R_2,R_3,R_1,f',h'_1,e')=1$. 

Summarizing, if $r(D)_{d(e)}=r(D)_{d(f)}$ then $D_1$ is  a relevant 
orientation with $r(D)=r(D_1)$, and if $r(D)_{d(e)}\neq r(D)_{d(f)}$
then $D_1$ becomes relevant after reversing the orientation of $h'_1$.

The proof then proceeds analogously as in Subcase~2.1.
\hfill {\it (End of Subcase~2.2)}

\hfill {\bf End of Case~2}

\smallskip\noindent
It is not difficult to see that the two cases complete the proof.
\done

\bigskip
Next we show that a statement analogous to that of Theorem~\ref{sgn1} holds
for the set of the alternating cycles of $M_0\Delta P$ as well.

\begin{Theorem}
\label{sgn2}
Let $G$ be a proper $g$-graph and let $D$ be a relevant orientation
of $G$. Let $P$ be a perfect matching of $G$. Then 
$$sgn(D,M_0\Delta P)=(-1)^q,$$  where

$$q\wug |BR(M_0\Delta P)|-CR(M_0\Delta P)+\frac {1}{2} 
\sum_{e\in BR(M_0\Delta P)}(r(D)_{d(e)}+1).$$
\end{Theorem}
\medskip\noindent
{\bf Proof.} Let $C_1,...,C_k$ be the alternating cycles of $M_0\Delta P$.
We have that\\
 $sgn(D,M_0\Delta P)=(-1)^q,$  where $q\wug l(C_1)+...+l(C_k)-k$.

Using Theorem~\ref{sgn1} for $C_1,...,C_k$, it remains to show that:

$$CR(M_0\Delta P)\wug \sum_{j=1}^k CR(C_j),$$ 

but this holds by Lemma~\ref{sgn0} and the theorem follows.
\done

\bigskip

\begin{Corollary}
\label{toro}
Let $G$ be a proper $1$-graph and $D$ a relevant orientation of 
$G$. Let ${\cal C}$ be a set of disjoint alternating cycles
 of $M_0$. Then:
\begin{enumerate}
\item [1.] If $r(D)=(1,1)$ then $sgn(D,{\cal C})=1$ if and only if           
         $t({\cal C}) \in \{ (0,0), (0,1), (1,0)\}$. 
        
 \item [2.] If $r(D)=(1,-1)$ then $sgn(D,{\cal C})=1$  if and only if           
         $t({\cal C}) \in \{ (0,0), (1,1), (1,0)\}$. 
    
           
 \item [3.] If $r(D)=(-1,1)$ then $sgn(D,{\cal C})=1$  if and only if           
         $t({\cal C}) \in \{ (0,0), (0,1), (1,1)\}$. 
   
 
 \item[4.]  If $r(D)=(-1,-1)$ then $sgn(D,{\cal C})=1$ if and only if   
            $t({\cal C})=(0,0)$.
\end{enumerate}
\end{Corollary}

\bigskip

\begin{Definition}
Let $G$ be a proper $g$-graph and $D$ a relevant orientation of $G$.
Let $r(D)=(r_1,...,r_{2g})$. We let $c(r(D))$ equal to the product
of $c_i$, $i=0,...,g-1$, where $c_i=c(r_{2i+1},r_{2i+2})$ and 
$c(1,1)=c(1,-1)=c(-1,1)=1/2$ and $c(-1,-1)=-1/2$.
\end{Definition}

\medskip
Observe that $c(r(D))=(-1)^n 2^{-g}$, where
$n=|\{i;r_{2i+1}=r_{2i+2}=-1\}|$.

\begin{Corollary}
\label{sgn4}
Let $G$ be a proper $1$-graph. Let $D_1,D_2,D_3,D_4$ be the 
relevant orientations of $G$. Then 

$${\cal P}(G,x)= \sum_{i=1}^4 c(r(D_i)){\cal P}(D_i,M_0).$$

\end{Corollary}

\bigskip
A result analogous to Corollary~\ref{sgn4} holds for all proper 
$g$-graphs, $g>1$.
In order to deduce it we start with another corollary of 
Theorem~\ref{sgn2}.

\begin{Corollary}
\label{function}
Let $G$ be a proper $g$-graph and $D$ a relevant orientation of 
$G$. Let $P$ be a perfect matching of $G$. Then 
$sgn(D,M_0\Delta P)$ is a function of $r(D)$ and $t(M_0\Delta P)$ only. 
Let us denote this function by $\sigma (r(D),t(M_0\Delta P))$. 
\end{Corollary}

\begin{Lemma} 
\label{sgn22}
Let $r=(r_1,\dots,r_{2g})$ and $t=(t_1,\dots,t_{2g})$ be $2g$-dimensional
 vectors. 
Let $r(j)=(r_{2j+1},r_{2j+2})$ and 
$t(j)=(t_{2j+1},t_{2j+2})$, $j=0,\dots,g-1$. Then  
$$\sigma(r,t)=\prod_{j=0}^{g-1} \sigma(r(j),t(j)).$$
\end{Lemma}
{\bf Proof.}
By Corollary~\ref{function}, we have that $sgn(D,{\cal C})=sgn(D',{\cal 
C}')$ if and only if $r(D)=r(D')$ and $t({\cal C})=t({\cal C}')$. 
This implies that we can restrict ourselves to consider the following case:
$G=C_0\cup M_0 \cup {\cal C}$ is a proper $g$-graph, $D$ is a relevant
orientation of $G$ such that $r(D)=r$ and ${\cal C}$ consists of a 
set of vertex-disjoint cycles $C_1,\dots,C_k$ satisfying  the 
following properties: 
\begin{enumerate}
\item each $C_i$ is alternating with respect to the perfect matching 
      $M_0$,
\item for each $i,j$ $|E^i_j| \leq 1$, 
\item for each $i$ there is at most one $j$ such 
      that $|C_j \cap (E^i_1 \cup E^i_2)| \geq 1$, 
\item for each $C_j$ there is exactly one $i$ such that $C_j$ intersects 
      $E^i_1\cup E^i_2$,
\item $t({\cal C})=t$.    
\end{enumerate}
Hence, $$\sigma(r,t)=sgn(D,{\cal C})= \prod_{i=1}^k sgn(D,C_i)=
\prod_{i=1}^k sgn(D_i,C_i)$$

where $D_i$ is the restriction of $D$ to $C_0\cup C_i$.
Observe that, by Corollary~\ref{toro}, $\sigma(z_1,z_2)=1$ 
if $z_2=(0,0
)$. Hence, using Corollary~\ref{function}, we have that 
$\prod_{i=1}^k sgn(D_i,C_i)= \prod_{j=0}^{g-1} \sigma(r^j,t^j)$
as claimed.

\done


\begin{Theorem}
\label{pm}
Let $G$ be a proper $g$-graph. Then 

$${\cal P}(G,x)={\cal L}_g(G,x)=\sum _{i=1}^{4^g} c(r(D_i)) {\cal 
P}(D_i,M_0)$$ 

where $D_i$, $i=1,\dots,4^g$, are the relevant orientations of $G$.
\end{Theorem}

\medskip\noindent
{\bf Proof.} Let $P$ be a perfect matching of $G$.
In each term ${\cal P}(D_i,M_0)$, the coefficient of $x(P)$ 
is $sgn(D_i,M_0\Delta P)$. By Corollary~\ref{function}, 
$sgn(D_i,M_0\Delta P)=\sigma(r(D_i),t(M_0\Delta P))$. 

Let 
$${\cal K}_g(t(M_0\Delta P))= \sum _{i=1}^{4^g} c(r(D_i))
\sigma(r(D_i),t(M_0\Delta P))$$

denote the coefficient of $x(P)$ in ${\cal L}_g (G,x)$. 

To prove the theorem it suffices to prove the following claim:

\medskip\noindent
{\bf Claim.} {\it ${\cal K}_g(t(M_0\Delta P))=1$ for each $t(M_0\Delta 
P)$.}

\smallskip\noindent
The proof of the claim is by induction on $g$. 
The basis of the induction when $g=1$ is proved in Corollary~\ref{sgn4}.

To prove the inductive step we introduce the following notation: 
if $z$ is a $2g$-dimensional vector then we let 
$z=(z(0),\dots,z(g-1))$ where $z(i)=(z_{2i+1},z_{2i+2})$.

We call two relevant orientations $D$ and $D'$ of $G$ {\it equivalent} 
if $(r(D)(1),\dots,r(D)(g-1))=(r(D')(1),\dots,r(D')(g-1))$.  
Clearly, the equivalence classes consist of $4$ elements; let 
${\cal R}_1,\dots,{\cal R}_{4^{g-1}}$ be the equivalence classes 
of the relevant orientations of $G$ and let ${\cal 
R}_j=\{D^j_1,D^j_2,D^j_3,D^j_4\}$, $j=1,\dots,4^{g-1}$.

Finally let $r(D^j_i)(k)=r^j_i(k)$, $k=0,\dots,g-1$ and  
let $t=t(M_0\Delta P)$. We have that 

$${\cal K}_g(t)=\sum_{j=1}^{4^{g-1}} \sum_{i=1}^4 
  c(r(D^j_i))\sigma(r(D^j_i),t).$$

Now, by Lemma~\ref{sgn22}, this equals 

$$\sum_{j=1}^{4^{g-1}} \sum_{i=1}^4 
c(r^j_i(0))c(r^j_i(1),\dots,r^j_i(g-1))\prod_{k=0}^{g-1} 
\sigma(r^j_i(k),t(k)).$$

By the definition of the equivalence classes, 
$r^j_1(k)=r^j_2(k)=r^j_3(k)=r^j_4(k)$ for $k\ge 1$ and 
$j=1,\dots,4^{g-1}$. 
Hence, we let $r^j_i(k)=r^j(k)$ and write the above summation as:

$$\sum_{j=1}^{4^{g-1}} c(r^j(1),\dots,r^j(g-1))\prod_{k=1}^{g-1}
\sigma(r^j(k),t(k)) \sum_{i=1}^4 c(r^j_i(0))\sigma(r^j_i(0),t(0))$$.

The internal sum equals to 1 for each $j=1,\dots,4^{g-1}$ by the basis 
step of the induction, and 
hence, using Lemma~\ref{sgn22} in the external sum, we can write the 
above summation as

$$\sum_{j=1}^{4^{g-1}} 
c(r^j(1),\dots,r^j(g-1))\sigma((r^j(1),\dots,r^j(g-1)),(t(1),\dots,t(g-1)))
=$$
$${\cal K}_{g-1}(t(1),\dots,t(g-1))=1,$$

by the inductive hypothesis for $g-1$.
\hfill {\bf End of Claim.}

\done

\bigskip
As a consequence of Theorem~\ref{Kastel} and Theorem~\ref{pm}, we 
have:

\begin{Corollary}
\label{pm1}
Let $G$ be a proper $g$-graph. Then $s(D_i,M_0)=s(D_j,M_0)$  
for each $i,j\in \{1,\dots,4^g\}$ and 

$${\cal P}(G,x)={\cal L}_g(G,x)=s(D_1,M_0)\sum _{i=1}^{4^g} c(r(D_i)) 
Pf(A(D_i))$$ 

where $D_i$, $i=1,\dots,4^g$, are the relevant orientations of $G$.
\end{Corollary}

\bigskip

\begin{Theorem}
\label{genus}
Let $G$ be a graph embeddable on an orientable surface of genus $g$. 
 Then ${\cal P}(G,x)$ may be expressed as a linear combination of $4^g$ 
 Pfaffians of matrices $A(D)$, where each $D$ is an orientation of $G$. 
\end{Theorem}
\medskip\noindent
{\bf Proof.}
As observed in the previous section, any orientable surface ${\cal S}$ of genus 
$g$ may be obtained from its polygonal representation $S_g$
 as follows: for each bridge $B$, glue together the two segments in 
 which $B$ intersects the boundary of $B_0$, and delete $B$. 

If a graph $G$ is embedded on an orientable surface ${\cal S}$ 
 of genus $g$, then without loss of generality no vertex belongs to 
 the boundary of $B_0$. In this way we get an embedding of $G$ on $S_g$ 
such that all vertices of $G$ belong to $B_0$ but the embeddings of some 
edges may use several bridges. 

We construct a graph $G'$ by replacing each edge $e=uv$ which 
uses $k$ bridges, $k\geq 1$, by a path 
$P_e=(u,e_1,v_1,\dots,v_{2k},e_{2k+1},v)$. The new vertices $v_1,...,v_{2k}$ 
are embedded on the embedding of $e$ so that each new edge uses at most
one bridge. 
Moreover, we let $x'_{e_1}=x_e$ and $x'_{e_i}=1$ for each $i>1$. 
We do a similar construction when $G_0$ has no perfect matching.
In fact, take any perfect matching $M$ of $G$ and replace any edge 
$e=uv\in M$ embedded on a bridge by a path $u,e_1,y,e_2,z,e_3,v$ and let 
$x'_{e_1}=x_e$ and $x'_{e_2}=x'_{e_3}=1$. Then leave the only edge $e_2$ 
to be embedded on the bridge $B$.

Finally, we add edges so that the outer face of the planar part is a 
cycle and we let $x'_e=0$ for each such edge $e$. 

It is easy to see that $G'$ is a proper $g$-graph and that 
${\cal P}(G',x')={\cal P}(G,x)$. 

%Let us construct a proper $g$-graph $G'$ as described in Theorem~\ref{Proper}.
Now, by Theorem~\ref{pm}, ${\cal P}(G',x')$ may be written as a linear combination
of $4^g$ terms $Pf(A(D'))$, where each $D'$ is a relevant orientation of $G'$.

It remains to show that for each relevant orientation $D'$ of $G'$ there is an 
orientation $D$ of $G$ such that $Pf(A(D'))=Pf(A(D))$ or 
$Pf(A(D'))=-Pf(A(D))$.

We construct $D$ from $D'$ in two steps:
\begin{enumerate}
\item[1.] delete the edges $e$ of $G'-G$ with $x'_e=0$, 
\item[2.] for each edge $e$ of $G$ which was changed
    into a path $P_e$ of odd length in the construction of $G'$,
    orient $e$ in the direction in which an odd number of edges of $P_e$ 
    is directed in $D'$: this is uniquely determined since $P_e$ has 
    an odd length.
\end{enumerate}

If $P$ is a perfect matching of $G$ then there 
is a unique perfect matching $P'$ of $G'$ such that 
$x(P)=x'(P')$.

Observe that $sgn(D,P\Delta Q)=sgn(D',P'\Delta Q')$ for each 
pair of perfect matchings $P,Q$ of $G$. The claim now follows from 
Theorem~\ref{Kastel}. 

This finishes the proof of the theorem.
\done


\section{Pfaffian Graphs, Exact Matching, and Permanents}

The results of the previous section have interesting algorithmic 
implications. 

\begin{Theorem}
Let $g$ and $k$ be fixed positive integers.
Let ${\cal G}$ be the class of graphs of genus $g$ whose edges are 
partitioned into at most $k$ classes and the variables
$x_e$ have the same value in each class. Then
${\cal P}(G,x)$ may be determined in polynomial time for $G\in {\cal G}$. 
\end{Theorem}

\medskip\noindent
{\bf Proof.} It follows from Theorems~\ref{pm} and \ref{genus} 
that ${\cal P}(G,x)$ may be expressed as a linear combination of a finite 
number of Pfaffians. 

We show now that if the set of 
 the edges of graph $G$ is partitioned into a bounded number of classes 
and the variables $x_e$ are equal in each class, then 
${\cal P}(D,M)$ and $Pf(A(D))$ may be determined efficiently. 
Let $M=\{\{i_1j_1\},\dots,\{i_nj_n\}\}$, $i_k<j_k$, be a perfect 
matching of $G$. Let $x'$ be defined as follows: $x'_e=x_e$ 
if $e\notin M$ and $x'_f=x_fz$ if $f\in M$, where $z$ is a new 
variable. 
Let $A'$ be the matrix obtained from $A(D)$ by replacing each 
$x_e$ by $x'_e$. Then $det(A')$ may be viewed as a polynomial 
 $det(A')(x,z)$ in the variables $x$ and $z$ and its coefficients 
can be determined efficiently.

By Theorem~\ref{Cayley}, $Pf(A')(x,z)=\pm \sqrt{det(A')(x,z)}$. Hence we can 
determine efficiently a polynomial $Q(x,z)$ such that $Pf(A')(x,z)=\pm 
Q(x,z))$. Note that ${\cal P}(D,M)=\pm Q(x,1)$. 

There is exactly one monomial in $Q(x,z)$ containing $z^n$ and its 
coefficient is $+1$ or $-1$. Let $Q'(x,z)$ be the unique polynomial 
such that $Q'(x,z)=Q(x,z)$ or $Q'(x,z)=-Q(x,z)$ and the coefficient of 
$Q'(x,z)$ of the term containing $z^n$ equals $+1$. 
We have ${\cal P}(D,M)=+Q'(x,1)$. Moreover, $Pf(A(D))=s(D,M){\cal 
P}(D,M)$ and $s(D,M)=s^*(M)t^*(M)$ where $t^*(M)$ equals the 
product of the signs of the elements $a_{i_kj_k}$ of the matrix 
$A(D)$ such that $i_kj_k\in M$. 
Hence ${\cal P}(D,M)$ and $Pf(A(D))$ may be determined efficiently.
\done 


\bigskip
As a consequence, if we are in the hypothesis stated by the theorem, the 
following problems may be solved efficiently.

\bigskip\noindent
{\bf 1. Recognition of Pfaffian graphs:} {\it given a graph $G\in {\cal G}$,
 decide whether $G$ admits a Pfaffian orientation.}

\medskip 
It was proved by Vazirani and Yannakakis 
(see the proof of Theorem $3.1$ in \cite{VY}) that, given a graph 
$G$, it is possible to construct efficiently an orientation
 $D$ of $G$ such that $G$ is Pfaffian if and only if $D$ is
 its Pfaffian orientation. Hence $Pf(A(D))$ equals to the number 
 of the perfect
 matchings of $G$ if and only if $G$ is Pfaffian, and it means
 that we can decide efficiently whether a graph is Pfaffian once 
 we can compute efficiently its number of perfect matchings.


%In particular the following well-known problem may be solved 
%efficiently for the graphs embeddable on an arbitrary fixed orientable 
%surface:

\bigskip\noindent
{\bf 2. Exact Matching Problem:} {\it given a graph $G\in {\cal G}$ with some edges 
coloured red, and a number $h$, decide whether $G$ has a perfect 
matching with exactly $h$ red edges.} 

\medskip
It suffices to assign an $x$ variable to red edges and a $y$ variable to the 
remaining edges and compute ${\cal P}(G;x,y)$. If the coefficient of the 
monomial $x^hy^{t-h}$, where $t$ is the cardinality of a perfect matching 
of $G$, is nonzero then the answer to the problem is yes, otherwise no 
such a matching exists.


\bigskip\noindent
{\bf 3. Computing permanents of square matrices.}

In $1913$, P\'{o}lya \cite{Polya} suggested computing the permanent of a 
matrix $A$ by changing the signs of some entries of $A$ so that the 
determinant of the resulting matrix equals the permanent of $A$.
Let us call a $(0,1)$-matrix $A$ {\it convertible} if such a change is possible.

Szeg\"{o} \cite{Szego} pointed out in the same year that not all matrices 
are convertible.

This may be explained nowadays using a complexity argument. 
There is an efficient algorithm to compute the determinant, while
Valiant proved that the problem of computing the permanent 
of a $(0,1)$-matrix is $\#P$-complete \cite{Val}.

The computational problem of 
recognition of convertible matrices has been proved recently
to admit a polynomial algorithm by McCuaig, Robertson, Seymour and Thomas
\cite{RST}. An earlier paper of Galluccio and Loebl
\cite{GL5} contains a related algorithmic result, as well as 
a history of the problem. 

The problem of recognizing convertible matrices
 is equivalent to the problem of recognizing bipartite
 Pfaffian graphs, and to the {\it Even Cycle Problem}: given a directed
 graph, decide whether it contains a directed cycle of even length. 


Let $A$ be a square matrix. Denote by $G(A)$ the bipartite graph
 whose two bipartition classes are indexed 
by the rows and the columns of $A$, and for each edge $ij$, 
$a_{ij}=x_{ij}$. Then $per(A)={\cal P}(G(A),x)$.

Hence, Theorem~\ref{genus} provides a new combinatorial way
 to compute permanents of square matrices: $per(A)$ may be written
 as a linear combination of $4^g$ terms of form $Pf(A(D))$,
 where $D$ is an orientation of $G(A)$ and $g$ is the 
 genus of $G(A)$.

Since $G(A)$ is a bipartite graph, the non-zero entries of  
$A(D)$ belong to two blocks $A_1,A_2$,
 where $A_1$ is obtained from $A$ by
 changing the sign of some entries and $A_2=-A_1$.
 Moreover $|Pf(A(D)|=|det(A_1)|=|det(A_2)|$ by 
 Theorem~\ref{Cayley}.

This means that the method of P\'olya may be completed as follows:

\begin{Corollary}
Let $A$ be a square matrix. Then $per(A)$ may be expressed
 as a linear combination of terms of the form $det(A^i)$, $i=1,...,4^g$,
 where each $A^i$ is obtained from $A$ by changing the sign
 of some entries.
\end{Corollary}

 

\bigskip
\noindent{\bf Acknowledgements.} The authors are grateful to 
Chris Godsil, Robin Thomas and Dominic Welsh for fruitful discussions, and to 
the referee for the comments which highly improved the quality of the paper.

\bibliographystyle{plain}
 
\bibliography{pfaffian}

\end{document}





@book{GareyJohnson,
 author = "Michael R. Garey and David S. Johnson",
 title = "Computers and Intractability",
 publisher = "W. H. Freeman and Company",
 year = "1979",
 address = "New York"
}

@book{algalg,
 author = "Chee Keng Yap",
 title = "Fundamental Problems in Algorithmic Algebra",
 publisher = "Princeton University Press",
 year = "1993",
 address = "Princeton"
}


@book{Schr2,
 author={A. Schrijver},
 title={Theory of Linear Programming and Integer Programming},
 publisher={John Wiley \& Sons},
 year={1986},
 address={New York}
}


@book{Tru, 
 author = {K. Truemper}, 
 title = {Matroid Decomposition},
 publisher ={Academic Press},
 year = {1992},
 address = {San Diego, CA}
}

@book{Welsh, 
 author = {D. J. A. Welsh}, 
 title = {Matroid Theory}, 
 publisher ={Academic Press},
 year = {1976},
 address = {London} 
}


@inproceedings{BS,
 author= {R. A. Brualdi and  B. L. Shader}, 
 title= {On sign-nonsingular matrices and the conversion of the 
        permanent into the determinant},
 booktitle={Applied Geometry and Discrete Mathematics}, 
 year={1991},
 publisher={American Math. Society},
 address={Providence},
 pages={117-134}
} 
 
 @book{algophys,
 author= {M. Junger, G. Reinelt, H. Rieger, G. Rinaldi}, 
 title= {Algorithmic Techniques in Physics}, 
 publisher={Dagstuhl-Seminar-Report 197},
 year={1997},
address={Dagstuhl}
}

@inproceedings{LI1,
 author = {C. H. C. Little},
 title = {An extension of {K}asteleyn's method of enumerating the 1-factors
          of planar graphs},
 booktitle = {Combinatorial Mathematics, Proceedings 2nd Australian Conference},
 year = {1974},
 publisher = {Springer},
 address = {Berlin},
 series = {Lecture Notes in Mathematics},
 volume = {403}
}

@inproceedings{Kast,
 author = {P.W. Kasteleyn},
 title = {Graph theory and crystal physics}, 
 booktitle = {Graph theory and theoretical physics },
 year = {1967},
 publisher = {Academic Press},
 address = {New York}
}


@inproceedings{LO2,
 author = {L. Lov\'asz},
 title = {Problem 2},
 booktitle = {Recent advances in graph theory, Proceedings Symposium Prague},
 year = {1975},
 publisher = {Academia},
 address = {Praha}
}
 

@article{AL,
 author={N. Alon and N. Linial},
 title={Cycles of length 0 mod k in directed graphs},
 journal={J. Combin. Theory B},
 volume={47},
 year={1989},
 pages={114-119}
}
 
@article{Wh1,
 author={H. Whitney},
 title={A Logical Expansion in Mathematics},
 journal={Bull. Amer. Math. Soc.},
 volume={38},
 year={1932},
 pages={572-579}
}

@article{Bir,
 author={Birkhoff},
 title={A determinant formula for the number of ways of colouring a map},
 journal={Annals of Mathematics},
 volume={14},
 year={1912},
 pages={42-46}
}

@article{Gr,
 author={C. Greene},
 title={Weight Enumeration and the Geometry of Linear Codes},
 journal={Studies in Applied Mathematics},
 volume={55},
 year={1976},
 pages={119-128}
}

@article{vdW,
 author={B.L. van der Waerden},
 title={Die lange Reichweite der regelmassigen Atomanordnung in Mischkristallen},
 journal={Z. Physik},
 volume={118},
 year={1941},
 pages={473}
}

@article{Tu1,
 author={W.T. Tutte},
 title={ A ring in graph theory},
 journal={Proc. Camb. Phil. Soc.},
 volume={43},
 year={1947},
 pages={26-40}
}

@article{Tu2,
 author={W.T. Tutte},
 title={ A contribution to the theory of chromatic polynomials},
 journal={Canad. J. Math.},
 volume={6},
 year={1954},
 pages={80-91}
}

@article{mac,
 author={J. MacWilliams},
 title={A theorem on the distribution of weights in a systematic code},
 journal={Bell Syst. Tech. J.},
 volume={42},
 year={1962},
 pages={654}
}

@article{APY,
 author={E. M. Arkin and C. H. Papadimitriou and M. Yannakakis},
 title ={Modularity of cycles and paths in graphs}, 
 journal = {J. ACM}, 
 volume = {38},
 year = {1980},
 pages = {255-274}
}

@article{B1,
 author= {F. Barahona},
 title= { On the Computational Complexity of Ising Spin Glass Models},
 journal={J. Phys. A},
 volume={15}, 
 year= {1982},
 pages={   }
}

@article{B2,
 author= {F. Barahona},
 title= { Balancing Signed Toroidal Graphs in Polynomial Time},
 journal={Preprint University of Chile},
 volume={}, 
 year= {1983},
 pages={   },
 note= {Unpublished manuscript}
}


@article{BGJR,
 author= {F. Barahona and M. Gr\"otschel and M. J\"unger and G. Reinelt},
 title= {An application of combinatorial optimization to statistical physics 
         and circuit layout design},
 journal={Operations Research},
 volume={36}, 
 year= {1988},
 pages={493-513}
}


@article{DJRR,
 author= {M. J\"unger and G. Reinelt and G. Rinaldi},
 title= {An application of combinatorial optimization to statistical physics 
         and circuit layout design},
 journal={Operations Research},
 volume={36}, 
 year= {1988},
 pages={493-513}
}


@article{godsil,
 author= {C. Godsil},
 title= {Matroids, Codes and Physics},
 journal={Manuscript},
 volume={}, 
 year= {1997},
 pages={   }
}

@article{GW,
 author= {M. X. Goemans and D. P. Williamson}, 
 title= {Improved approximation algorithms for maximum cut and 
         satisfiability problems using semidefinite programming}, 
 journal={J. of ACM}, 
 volume= {42},
 year= {1995}, 
 pages={1115-1145}
}


@article{Cayley,
 author= {A. Cayley}, 
 title= {Sur les determinants gauches}, 
 journal={Crelle's J.}, 
 volume= {38},
 year= {1847}, 
 pages={93-96}
}

@article{CGK,
 title={Even cycles in directed graphs},
 author={F.~R.~.K. Chung and W. Goddard and D. J. Kleitman},
 journal={Siam J. Discrete Math.},
 volume={7},
 year={1994},
 pages={474-483}
}

@article{Cunn, 
 author={W. Cunningham}, 
 title={ Chords and disjoint paths in matroids}, 
 journal={Discr. Math.},
 volume={19},
 year={1977},
 pages={7-15} 
}


@article{DP,
 author= {C. Delorme and S. Poljak},
 title= {Laplacian eigenvalues and the maximum cut problem},
 journal={Math. Prog.},
 volume={62}, 
 year= {1993},
 pages={557-574}
}

 
@article{FHW, 
 author = {S. Fortune and J. E. Hopcroft and J. Wyllie}, 
 title = {The directed subgraph homeomorphism}, 
 journal = {Theor. Comput. Sci.}, 
 volume = {10},
 year = {1980},
 pages = {111-121}
}
 
@article{Fried,
 author= {S. Friedland},
 title= {Every 7-regular digraph contains an even cycle},
 journal = {J. Comb. Th. B},
 volume={46},
 year={1989},
 pages={249-252}
}

@article{JS1, 
 author={M. Jerrum and A. Sinclair}, 
 title = {Approximating the permanent}, 
 journal = {SIAM J. Comp.}, 
 volume = {18},
 year = {1989},
 pages = {1149-1178}
}

@article{JS2, 
 author={M. Jerrum and A. Sinclair}, 
 title = {Polynomial-time Approximation Algorithms for the Ising Model},
 journal = {SIAM J. Comp.}, 
 volume = {22},
 year = {1993},
 pages = {1087-1116}
}

@article{GL1,
 author= {A. Galluccio and M. Loebl}, 
 title= {Even/odd dipaths in planar digraphs}, 
 journal={Optimization Methods and Software},
 volume={3},
 year={1994},
 pages={225-236}
}

@article{GL2,
 author= {A. Galluccio and M. Loebl}, 
 title= {Cycles of prescribed modularity in planar digraphs}, 
 journal= {Jour. of Algorithms},
 volume={21}, 
 year= {1996},
 pages={51-70}
}

@article{GL3,
 author= {A. Galluccio and M. Loebl}, 
 title= {(p,q)-odd digraphs}, 
 journal={Jour. of Graph Theory},
 volume={23},
 year= {1996},
 pages = {175-184}
}

@article{GL4,
 author= {A. Galluccio and M. Loebl}, 
 title= {Even Directed Cycles in {H}-free Digraphs}, 
 journal={Technical Report 410, IASI-CNR}, 
 year= {1995},
 note= {In publication on J. of Algorithms} 
}

@article{GL5,
 author= {A. Galluccio and M. Loebl}, 
 title= {Even Cycles and {H}-homeomorphisms}, 
 journal={Technical Report 424, IASI-CNR}, 
 year= {1995},
 note= {Submitted for publication.} 
}

@article{GL6,
 author= {A. Galluccio and M. Loebl}, 
 title= {A Theory of Pfaffian Orientations {I}: Perfect Matchings 
         and Permanents}, 
 journal={Technical Report 452, IASI-CNR}, 
 year= {1997},
}

@article{GL7,
 author= {A. Galluccio and M. Loebl}, 
 title= {A Theory of Pfaffian Orientations {II}: 
         {T}-joins, $k$-cuts, and {D}uality of enumeration}, 
 journal={Technical Report 97-361, Charles University, Prague}, 
 year= {1997},
}
 

@article{Hall,
 author={D. W. Hall},
 title={A note on primitive skew curves},
 journal={Bull. Amer. Math. Soc.},
 volume={49},
 year={1943},
 pages={935-937}
}

@Techreport{HL,
 author= {W. Hochstaettler and M. Loebl}, 
 title={On bases of circuit lattices}, 
 institution={University of Waterloo},
 number={CORR 96-02},
 month={January},
 year={1996}
}

@article{KLM,
 author={V. Klee and R. Ladner and R. Manber}, 
 title= {Signsolvability revisited}, 
 journal={Linear Algebra Appl.}, 
 volume= {59},
 year= {1984}, 
 pages={131-157}
}

@article{Khu,
 author={S. Khuller},
 title={Extending planar algorithms to ${K}_{3,3}$-free graphs},
 journal={Inform. and Comput.},
 volume={84},
 year={1990},
 pages={13-25}
}

@article{Lanc,
 author= {K. Lancaster}, 
 title= {The scope of qualitative economics}, 
 journal={Rev. Econom. Studies }, 
 volume= {29},
 year= {1962}, 
 pages={99-132}
}


@article{LI2,
 author={C. H. C. Little},
 title = {A characterization of convertible (0,1)-matrices}, 
 journal = {JCT(B)},
 volume = {18},
 year = {1975},
 pages = {187-208},
}

@article{LiP,
 author={C.H.C. Little and J.M. Pla},
 title={Sur l'utilisation d'un pfaffien dans l'etude des couplages 
        parfaits d'un graphe},
 journal={C.R.Acad.Sci.Paris Ser.I Math.},
 volume={274},
 year={1972}
}


@article{LO1,
 author={L. Lov\'asz},
 title ={Matching structure and the matching lattice}, 
 journal = {JCT(B)}, 
 volume = {43},
 year = {1987},
 pages = {187-222}
}



@article{LS,
 author={L. Lov\'asz and A. Seres},
 title ={The cocycle lattice of binary matroids},
 journal = {Europ. J. Comb.},
 volume = {14},
 year = {1993},
 pages = {241-250} 
}

@inproceedings{Moh,
 author= {B. Mohar}, 
 title= {Embedding graphs in an arbitrary surface in linear time}, 
 booktitle = {Proc. of ACM Symposium on Theory of Computing},
 year = {1996},
 publisher = {ACM}
}
 
 journal={Crelle's J.}, 
 volume= {38},
 year= {1847}, 
 pages={93-96}
}



@Techreport{NuPe,
 author={Z. Nutov and M.~Penn},
 title={Minimum feedback arc set and maximum integral dicycle 
        packing algorithms in $K_{3,3}$-free digraphs},
 institution={Technion},
 month={June},
 year={1994}
}

@article{Pla,
 author={J.M. Pla},
 title={Sur l'utilisation d'un pfaffien dans l'etude des couplages 
        parfaits d'un graphe},
 journal={C.R.Acad.Sci.Paris Ser.I Math.},
 volume={260},
 year={1965}
}


@article{PR,
 author= {S. Poljak and F. Rendl},
 title= {Solving the max-cut problem using eigenvalues},
 journal={Discr. Appl. Math.},
 volume={62}, 
 year= {1995},
 pages={249-278}
}


@article{Robb,
author={H.E. Robbins},
title={A theorem on graphs, with an application to a problem of 
       traffic control},
journal={Americ. Mathem. Monthly},
volume={46},
year={1939},
pages={281-283}
}

@article{SCH,
author={A. Schrijver},
title={Finding $k$-disjoint paths in a directed planar graph},
journal={SIAM J. Comput.},
volume={23},
year={1994},
pages={780-788}
}

@article{Sey1, 
 author= {P.~D. Seymour}, 
 title= {On the two coloring of hypergraphs}, 
 journal= {Quart. J. Math. Oxford}, 
 volume= {25},
 year= {1974},
 pages={303-312}
}
 
@article{Sey2, 
 author= {P.~D. Seymour}, 
 title ={Directed circuits on a torus},
 journal={Combinatorica},
 volume={11},
 year={1991},
 pages={261-273}
}

@article{Sey3, 
 author= {P.~D. Seymour}, 
 title ={Decomposition of regular matroids}, 
 journal={J. Comb. Th. B}, 
 volume={28},
 year={1980},
 pages={305-359} 
}


@article{ST,
 author={P.~D. Seymour and C. Thomassen}, 
 title={Characterization of even directed graphs},
 journal={J. Comb. Th. B},
 volume={42},
 year={1987},
 pages={36-45}
}

@article{RST,
 author={W.~McCuaig and N.~Robertson and P.~D.~Seymour and R.~Thomas}, 
 title={Permanents, Pfaffian Orientations, and Even Directed 
        Circuits}, 
 journal={},
 volume={},
 year={1996},
 pages={},
 note={Preprint}
}
 


@article{TH1,
 author= {C. Thomassen}, 
 title= {Even cycles in directed graphs}, 
 journal= {European J. Combin.}, 
 volume= {6},
 year= {1985},
 pages={72-87}
}
 
@article{TH2,
 author= {C. Thomassen}, 
 title= {Sign-nonsingular matrices and even cycles in directed graphs}, 
 journal= {Linear Algebra and Appl.},
 volume= {75},
 year= {1986},
 pages={27-41}
}
 
@article{TH3,
 author= {C. Thomassen}, 
 title= {The even cycle problem for planar digraphs}, 
 journal={J. Algorithms},
 volume= {15},
 year= {1993}, 
 pages={61-75}
}
 
@article{TH4,
 author= {C. Thomassen}, 
 title= {The even cycle problem for directed graphs}, 
 journal={J. Am. Math. Soc.}, 
 volume= {5},
 year= {1992}, 
 pages={217-229}
}

@article{TH5,
 author= {C. Thomassen}, 
 title= {On the presence of disjoint subgraphs of a specified type}, 
 journal={J. Graph Theory}, 
 volume= {12},
 year= {1988}, 
 pages={101-111}
}

@article{Val,
 author= {L. G. Valiant}, 
 title= {The complexity of computing the permanent}, 
 journal= {Theoret. Comput. Sci.}, 
 volume= {8},
 year= {1979},
 pages={189-201}
}

@article{Vaz,
 author={V.~V.~Vazirani},
 title={{NC} algorithms for computing the number of perfect 
         matchings in ${K}_{3,3}$-free graphs and related problems},
 journal={Inform. and Comput.},
 volume={80},
 year={1989},
 pages={152-164}
}

@article{VY,
 author={V. V. Vazirani and M. Yannakakis}, 
 title= {Pfaffian orientations, 0-1 permanents and even cycles in directed 
         graphs}, 
 journal={Discr. Appl. Math.},
 volume= {25},
 year= {1989}, 
 pages={179-190}
}
 

@article{Polya,
 author={G. P\'olya},
 title = {Aufgabe 424}, 
 journal = {Arch. Math. Phys.},
 volume = {20},
 year = {1913},
 pages = {271}
}


@article{Szego,
 author={G. Szeg\"o},
 title = {Lozung zu 424}, 
 journal = {Arch. Math. Phys.},
 volume = {21},
 year = {1913},
 pages = {291-292}
} 


@article{KAST1,
 author={P. W. Kasteleyn},
 title = {Dimer Statistics and Phase Transitions},
 journal = {Jour. Math. Physics},
 volume = {4},
 year = {1963},
 pages = {287-293}
}

@article{KAST2,
 author={P. W. Kasteleyn},
 title = {The Statistics of Dimers on a Lattice}, 
 journal = {Physica},
 volume = {27},
 year = {1961},
 pages = {1209-1225}
}

@article{Wag1, 
 author={K. Wagner}, 
 title = {Beweis einer Abschwachung der {H}adwiger-Vermutung},
 journal = {Math. Ann.}, 
 volume = {153},
 year = {1964},
 pages = {139-141}
}


@book{LP,
 author={L.Lov\'asz and M. Plummer},
 title={Matching Theory},
 publisher= {Academic Press},
 year={1986}
}
 


@article{kw,
author={M. Kac and J.C. Ward},
title={A Combinatorial Solution of the Two-Dimensional {I}sing 
Model},
journal={Physical Review}, 
volume={88},
year={1952}
}

@article{pw,
author={R.B. Potts and  J.C. Ward},
title={The Combinatorial Method and the Two-Dimensional {I}sing Model},
journal={Progress of Theoretical Physics},
volume={ 13},
year={1955}
}

@book{w2,
author={D.J.A. Welsh},
title={Complexity: Knots, Colourings and Counting},
note={London Mathematical Society Lecture Note Series 186},
publisher={   Cambridge University Press},
year= {1993}
}

@article{W4,
author={ D.J.A.Welsh},
title={Counting Colourings And Flows In Random Graphs},
journal={Bolyai Society Mathematical Studies}, 
volume={2}, 
year={1996}
}

@article{Fish,
author={ M.E. Fisher},
title={On the Dimer Solution of Planar {I}sing Models},
journal={Journal of Mathematical Physics 7}, 
volume={10}, 
year={1966}
}

\bibitem{o}
{\sc J.~Oxley}. {\em Matroid Theory}.
Oxford University Press, 1992.

\bibitem{jvw}
{\sc F. Jaeger, D. L. Vertigan, D.J.A. Welsh.}
{\em On the Computational Complexity of Jones and Tutte Polynomials.}
Math. Proc. Camb. Phil. Soc. 108, 1990, 35-53.




\bibitem{GH}
{\sc O. Goldschmidt, D. S. Hochbaum.}
{\em A Polynomial Algorithm For the $k$-Cut Problem For Fixed $k$.}
Mathematics of Operations Research 19, 1, 1994, 24-37.

\bibitem{DJPSY}
{\sc Dalhaus et.al.}
{\em The Complexity of the Multiway Cuts. Extended Abstract.}
Proc. 1992 ACM Symposium on Theory of Computing, 241-251.





\begin{Lemma}
\label{Crossings}
Let $C$ be an alternating cycle with respect to a perfect matching $M$ 
containing two edges $e=u_1u_2$ and $f=v_1v_2$ not belonging to $M$. 
Let $h_1$ and $h_2$ be two new parallel edges inserted between $u_1$ and 
one endvertex of $f$, so that $C\cup \{h_1,h_2\}$ is the union of two 
cycles: $H_1$ containing $h_1$ and $H_2$ containing $h_2$, and, moreover, 
$H_2$ is alternating. 

\begin{itemize}
\item [1.] If $C$ is drawn in the plane so that the edges $e$ and $f$ do not 
 cross, then either $CR(C)\wug CR(H_1)+CR(H_2)$ when $h_1=u_1v_1$, 
             or $CR(C)\wug CR(H_1)+CR(H_2) +1$ when $h_1=u_1v_2;$
\item [2.] If $C$ is drawn in the plane so that the edges $e$ and $f$ cross, 
             then $CR(C)\wug CR(H_1)+CR(H_2)$.
\end{itemize}
\end{Lemma}

{\bf Proof.} 

The remaining case needs more attention. Let $A$ be a subset of arcs of $H_1$ and 
$B$ a subset of arcs of $H_2$. We denote by $CR(A\times B)$ the number of 
crossings between arcs of $A$ and $B$, mod $2$. We also denote by $cr(i,j)$ 
the number of crossings of arcs of $H_i\cap C$ with $h_j$. Hence, we have:

$$CR(H_1)\wug CR(H_1\cap C) + cr (1,1),$$ 
$$CR(H_2)\wug CR(H_2\cap C) + cr (2,2),$$
$$CR(C)\wug CR(H_1 \cap C) + CR(H_2 \cap C) + CR(H_1 \cap C\times H_2 \cap C),$$
$$CR(H_1\times H_2)=0,$$
and 
$$\sum_{i,j=1}^2 cr(i,j)\wug 0$$
since each arc which crosses $h_1$ crosses also $h_2$.

Hence it remains to show that 
$$CR(H_1\times H_2)\wug CR(H_1 \cap C\times H_2 \cap C) + cr(1,2) + cr(2,1) + 1:$$
this follows since in this case one additional crossing between $H_1$ and 
$H_2$ must occur at an endvertex of $h_1$. The required congruence  
follows.  

\done

