% This is a TeX file
% It is essentially a programming language for mathematics documents
% You can ignore this first portion of the file, as it is essentially a bunch of "include" statements.
\documentclass[10pt]{article}
\usepackage{etex}
\usepackage{pictex, latexsym, graphicx,amsmath,amssymb,amsbsy,amsfonts,amsthm,verbatim}
\usepackage{graphics}
\usepackage{hyperref}
\usepackage{fullpage}
\usepackage{fancyhdr}
\usepackage{array}
\usepackage{algorithm,algorithmic}
\usepackage{multirow}
%\usepackage{multicol}

\usepackage{tikz}
\usetikzlibrary{shapes,arrows,spy,positioning,decorations,calc}%,snakes}
\tikzset{
insep/.style={inner sep=2pt, outer sep=0pt, circle,fill}, 
free/.style={inner sep=2pt, outer sep=0pt, circle,fill=gray,draw}, 
extra/.style={inner sep=2pt, outer sep=0pt, circle,fill=white,draw}, 
}

\setlength{\parskip}{0.5em}
\setlength{\parindent}{0em}
\setlength{\voffset}{-0.5in}
\setlength{\headsep}{0.25in}

% The following denotes a counter for the problems.
\newcounter{problem}
\newcommand{\problem}{\textbf{Problem \refstepcounter{problem}.}}

% These are macro shortcuts! Helpful!
\def\vu{\mathbf{u}}
\def\vx{\mathbf{x}}
\def\vy{\mathbf{y}}
\def\vz{\mathbf{z}}
\def\vb{\mathbf{b}}
\def\vv{\mathbf{v}}
\def\vw{\mathbf{w}}

\renewcommand{\implies}{\rightarrow}
%\newcommand{\lnot}{\neg}
\renewcommand{\lor}{\vee}
\renewcommand{\land}{\wedge}
\newcommand{\xor}{\oplus}
\newcommand{\symmdiff}{\triangle}
\renewcommand{\iff}{\leftrightarrow}
\newcommand{\TRUE}{\mathbf{T}}
\newcommand{\FALSE}{\mathbf{F}}
\newcommand{\universe}{\mathcal{U}}


\def\N{\mathbb{N}}
\def\Q{\mathbb{Q}}
\def\C{\mathbb{C}}
\def\Z{\mathbb{Z}}
\def\R{\mathbb{R}}
\def\cP{\mathcal{P}}



\begin{document}
\pagestyle{fancyplain}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% NOW you can start typing your text that will appear in the PDF!!!

% Note that anything after a '%' is a comment!

% Anything immediately after a '\' is a command. 
% Some denote formatting, some are for special characters.
% The '$' symbol starts and ends "math mode". Use this only for mathematical statements
% In math mode, any sequence of letters is meant to be a list of variables, so use "\sin x" for the sine of x, which will look much different from "sin x"

\lhead{}
\rhead{}
\chead{COM S 330 --- Lecture Notes --- Week of Mar 30--April 3}

\renewcommand{\arraystretch}{1.25}



\section{Monday, March 30}

\subsection{Rosen 10.2: Graph Terminology and Types of Graphs}

\textbf{Reading:} Rosen 10.2,  Ducks  3.5, LLM 


\textbf{Def:} Let $G$ and $H$ be graphs.
We say $H$ is a \emph{subgraph} of $G$ if $V(H) \subseteq V(G)$ and $E(H) \subseteq E(G)$.

\textbf{Ex:} $\overline{K_n} \subseteq C_n \subseteq K_n$.

\textbf{Ex:} Using the set definitions, $V(W_{n}) = \{0,1,\dots,n\}$, so $W_n \not\subseteq K_{n+1}$. However, a graph that \emph{looks like} $W_n$ does exist inside $K_{n+1}$ (let $n+1$ take the place of $0$). We will later talk about \emph{isomorphism} that deals with this.

One way to think about subgraphs is that we can delete some number of vertices and edges from $G$ in order to find the graph $H$.

\textbf{Def:} Let $G$ be a graph and $S \subseteq V(G)$. 
The \emph{subgraph of $G$ induced by $S$}, denoted $G[S]$, is the graph $H$ with $V(H) = S$ and $E(H) = \{ uv : uv \in E(G), u, v \in S\}$.
That is, $G[S]$ has vertices in $S$ and all edges that are in $G$ with both endpoints in $S$.
A graph $H$ is an \emph{induced subgraph} of $G$ (sometimes denoted $H \leq G$) if $H = G[S]$ for some $S \subseteq V(G)$.

\textbf{Ex:} Let $1 \leq n \leq m$. Then $K_n = K_m[\{1,\dots,n\}]$ and hence $K_n \leq K_m$.

\textbf{Ex:} $C_n$ is not an induced subgraph of $K_n$.

\textbf{Ex:} $C_n = W_n[ \{1,\dots,n\}]$, so $C_n$ is an induced subgraph of $W_n$.

One way to think about induced subgraphs is that we can delete some number of vertices (and only the edges incident to those vertices) to find $H$.

\textbf{Thm:} If $G$ is a bipartite graph and $H$ is a subgraph of $G$, then $H$ is bipartite.

\vspace{-1em}
\begin{proof}
Since $G$ is bipartite, there is a bipartition $V(G) = X \cup Y$ such that $X \cap Y = \varnothing$ and for every edge $e \in E(G)$, exactly one endpoint of $e$ is in each $X$ and $Y$.
Since $H$ is a subgraph of $G$, $V(H) \subseteq V(G) = X \cup Y$.
Let $A = X \cap V(H)$ and $B = Y \cap V(H)$.
Then $V(H) = A \cup B$.
Let $e$ be an edge in $E(H)$.
Then since $E(H) \subseteq E(G)$, exactly one endpoint of $e$ is in $X \cap V(H) = A$; exactly one endpoint is in $Y \cap V(H) = B$.
Thus, $A \cup B$ is a bipartition of $H$ and $H$ is bipartite.
\end{proof}

\textbf{Def:} Let $G_1$ and $G_2$ be graphs. The \emph{union} of $G_1$ and $G_2$, denoted $G_1 \cup G_2$, is the graph $G'$ where $V(G') = V(G_1) \cup V(G_2)$ and $E(G') = E(G_1) \cup E(G_2)$.

\textbf{Def:} Let $G_1$ and $G_2$ be graphs. The \emph{disjoint union} of $G_1$ and $G_2$, denoted $G_1 + G_2$, is the graph $G'$ where $V(G') = \{ (i,v) : i \in \{1,2\}, v \in V(G_i) \}$ and $E(G') = \{ \{ (i,u), (i,v) \} : i \in \{1,2\}, uv \in E(G_i) \}$.


\textbf{Ex:} Consider a class of students. Every pair of students could work together on a homework assignment. In the first homework, pairs $a_1b_1, a_2b_2, \dots, a_kb_k$ work together (and $c_1,\dots, c_\ell$ work by themselves). A restriction on the later homeworks is that no pair can work together a second time. Thus, the graph of possible pairings is given by all possible edges, minus the pairs that have been completed. What possible pairings are possible?

\textbf{Def:} Let $G$ be a graph. A \emph{matching} is a set $M \subseteq E(G)$ such that for any two edges $e_1, e_2 \in M$ with $e_1 \neq e_2$, the edges $e_1$ and $e_2$ do not share a common endpoint.

\textbf{Def:} Let $G$ be a graph with a matching $M$.
A vertex $v$ is \emph{matched} if there is an edge $e$ that is both in $M$ and is incident to $v$ (and $v$ is \emph{matched to} the other endpoint of $e$); otherwise $v$ is \emph{unmatched}.
A \emph{maximum matching} is a matching of maximum size (among all matchings in $G$).



\clearpage
\section{Wednesday, April 1}

\textbf{Def:} Let $G$ be a bipartite graph with bipartition $V(G) = X \cup Y$.
Note that a matching $M \subseteq E(G)$ consists of edges with one endpoint in $X$ and another endpoint in $Y$.
The matching $M$ is called a \emph{complete matching from $X$ to $Y$} if every vertex in $X$ is matched. 

\textbf{Ex:} $K_{n,n}$ has a complete matching. $K_{4,5}$ has a complete matching from left to right, but not right to left.

\textbf{Ex:} $C_{2n}$ has a complete matching.

(Note: A matching is NOT a subgraph, as it is only a set of edges. However, there is an associated subgraph where we include the matched vertices. Sometimes it is helpful to think about that.)

\textbf{Def:} Recall $N(v)$ is the neighborhood of a vertex.
Thus, if $S \subseteq V(G)$, then $N(S) = \cup_{v\in S}N(v)$ (recall that we may use the notation $N_G(S) = \cup_{v\in S}N_G(v)$ when two graphs are in the discussion.)

\textbf{Hall's Theorem:} Let $G$ be a bipartite graph with bipartition $V(G) = X \cup Y$.
$G$ has a complete matching from $X$ to $Y$ if and only if for all $S \subseteq X$ we have $|S| \leq |N(S)|$.

\vspace{-1em}
\begin{proof}
We shall prove both directions of the ``if and only if''. 

We first prove that if $G$ has a complete matching from $X$ to $Y$, then $|S| \leq |N(S)|$ for all $S \subseteq X$.
We prove by contradiction: Suppose there exists a complete matching $M$ from $X$ to $Y$ and there also exists a set $S \subseteq X$ where $|S| > |N(S)|$.
Let $S = \{ s_1,\dots, s_k\}$.
Since $M$ is a complete matching, every element $s_i \in S$ is matched to an element $y_i \in Y$.
However, since $M \subseteq E(G)$, $y_i \in N(s_i)$.
Hence, $\{y_1,\dots,y_k\} \subseteq N(S)$.
However, $|N(S)| < |S| = k$ so not all of the elements $y_i$ are distinct and hence $M$ is not a matching, a contradiction!

We now prove the other direction: If $|S| \leq |N(S)|$ for all $S \subseteq X$ then $G$ has a complete matching from $X$ to $Y$.
We will prove this using induction on $|X| \geq 0$.

Base Case 1: If $|X| = 0$, then let $M = \varnothing$.

Base Case 2: If $|X| = 1$, then there exists a single vertex $x \in X$.
Since $N(x) = N(\{x\})$, we have $|N(x)| \geq 1$ and thus there is an edge $xy \in E(G)$ and we let $M = \{xy\}$.

(Strong Induction Hypothesis) Let $n \geq 1$ and suppose that if $G$ is a bipartite graph with bipartition $V(G) = X \cup Y$ and $|X| \leq n$, the statement holds.

Case $n+1$: Suppose $G$ is a bipartite graph with bipartition $V(G) = X \cup Y$ where $|X| = n + 1 \geq 2$.
We will use two sub-cases.

Subcase 1: Suppose that for all sets $S \subseteq X$ with $1 \leq |S| \leq n$ we have $|N(S)| \geq |S| + 1$.
In this case, let $x \in X$ and let $y \in N(x)$ (which exists, since $|N(x)| \geq |\{x\}| + 1$).
Let $G' = G - x - y$ (the graph given by removing the vertices $x$ and $y$ from $G$).
Then $G'$ is bipartite with bipartition $V(G') = (X \setminus \{x\}) \cup (Y \setminus \{y\})$.
Also, for all $S \subseteq X \setminus \{x\}$, $|N_{G'}(S)|  \geq |N_G(S)|-1 \geq |S|$.
Thus, by the induction hypothesis, $G'$ has a complete matching $M'$ from $X\setminus \{x\}$ to $Y\setminus \{y\}$.
Let $M = M' \cup \{xy\}$ and observe that $M$ is a complete matching of $G$ from $X$ to $Y$.

Subcase 2: Now suppose that there exists a set $S \subseteq X$ with $1 \leq |S| \leq n$ and $|S| = |N(S)|$.
Let $H$ be the subgraph of $G$ induced by $S \cup N(S)$.
$H$ has bipartition $V(H) = S \cup N(S)$ and $H$ has the property that for all $T \subseteq S$ that $|N_H(T)| \geq |T|$ (since $T \subseteq S \subseteq V(G)$ and $N_H(T) = N_G(T)$).
Thus, by the strong induction hypothesis, $H$ has a complete matching $M$ from $S$ to $N(S)$.

Let $X' = X\setminus S$ and $Y' = Y\setminus N(S)$.
Let $G'$ be the subgraph of $G$ induced by $X' \cup Y'$ and observe that $G'$ has bipartition $X' \cup Y'$.
We need to verify that for all $T \subseteq X'$ we have $|N_{G'}(T)| \geq |T|$.
For the sake of contradiction, suppose that there exists a set $T \subseteq X'$ where $|N_{G'}(T)| < |T|$.
Now consider $S\cup T \subseteq X$.
We have $N_G(S\cup T) = N_G(S) \cup (N_G(T)\setminus N_G(S)) = N_G(S) \cup N_{G'}(T)$.
Since $N_G(S) \cap N_{G'}(T) = \varnothing$, we have $|N_G(S\cup T)| = |N_G(S)| + |N_{G'}(T)| < |S| + |T| = |S\cup T|$, contradicting the condition on $G$!

Thus, no such set $T$ exists, and by the strong induction hypothesis there exists a complete matching $M'$ from $X'$ to $Y'$ in $G'$.
Therefore, $M \cup M'$ is a complete matching of $G$ from $X$ to $Y$.
\end{proof}

\subsection{Rosen 10.3: Representing Graphs and Graph Isomorphism}

\textbf{Reading:} Rosen 10.3,  Ducks , LLM 

\textbf{Def:} Let $G$ be a graph with vertex set $V(G) = \{ v_1, \dots, v_n\}$.
The \emph{adjacency matrix} of $G$ is the $n \times n$ matrix $A = A(G)$ where the $i,j$-entry is 1 if $v_iv_j$ is an edge of $G$, and 0 otherwise.

\textbf{Ex:} Create the adjacency matrices for $C_4, C_5, C_6, K_3, K_4, K_5, K_{2,2}, K_{2,3}, K_{4,4}, Q_3, Q_4$.

\textbf{Note:} $A(G)$ is \emph{symmetric}, as $v_iv_j$ is an edge of $G$ if and only if $v_jv_i$ is an edge of $G$.

\textbf{Def:} Given an $n \times n$ symmetric matrix $A$ with entries in $\{0,1\}$ and all diagonal entries 0, the graph $G = G(A)$ is the graph with vertex set $\{1,\dots, n\}$ where the edge $ij$ is in $E(G)$ if and only if the $i,j$-entry of $A$ is 1.

\textbf{Ex:} Draw the graphs $G(A_i)$ associated with the adjacency matrices $A_i$ below:
\[
A_1 = \begin{bmatrix}
0 & 1 & 1 & 0 \\
1 & 0 & 0 & 1 \\
1 & 0 & 0 & 1 \\
0 & 1 & 1 & 0\end{bmatrix}
\qquad
A_2 = \begin{bmatrix}
0 & 1 & 1 & 1 & 1 \\
1 & 0 & 1 & 1& 1 \\
1 & 1 & 0 & 1 & 1\\
1 & 1 & 1 & 0 & 1\\
1 & 1 & 1 & 1 & 0\end{bmatrix}
\qquad
A_3 = \begin{bmatrix}
0 & 0 & 0 & 1 & 1 \\
0 & 0 & 0 & 1 & 1 \\
0 & 0 & 0 & 1 & 1 \\
1 & 1 & 1& 0 & 0\\
1 & 1 & 1 & 0 & 0
\end{bmatrix}
\]


\textbf{Note:} When encoding $A$ as a doubly-indexed array in C, Java, or almost any programming language that is 0-indexed, we treat $A$ as having $i,j$-entries with $0 \leq i < n$ and $0 \leq j < n$. Thus we order $V(G) = \{v_0,\dots,v_{n-1}\}$ and then we can use the following type of code:

\begin{verbatim}
int** A = (int**)malloc( n * sizeof(int*) );
for ( int i = 0; i < n; i++ )
{
    A[i] = (int*)malloc( n * sizeof(int) );
    for ( int j = 0; j < n; j++ )
    {
        A[i][j] = 0;
    }
}
// We now have an adjacency matrix for the empty graph on n vertices
\end{verbatim}

We can add edges to the graph as follows:
\begin{verbatim}
void addEdge(int** A, int i, int j)
{
    A[i][j] = 1;
    A[j][i] = 1; // Stay symmetric!
}
\end{verbatim}

\textbf{Note:} Since $A$ is symmetric and has 0's on the diagonal, we only need to know the $i,j$-entries when $1 \leq i < j \leq n$ (i.e. the upper triangle, minus the diagonal). There are $\binom{n}{2} = \frac{1}{2}n^2 - \frac{1}{2}n$ such entries, so if you have $\frac{1}{2}n^2$ bits, you can ``pack'' the information of an adjacency matrix into that small of a container! This is hard to do, so you should only do it when your memory footprint needs to be REALLY small!

\textbf{Def:} Let $G$ be a graph with vertex set $V(G) = \{v_0,\dots,v_{n-1}\}$.
An \emph{adjacency list} representation of $G$ is a data structure that stores $N(v_i)$ for every vertex $v_i \in V(G)$.

Here is an example in C:

\begin{verbatim}
int** adjacency_list = (int**)malloc( n * sizeof(int*) );

for ( int i = 0; i < n; i++ )
{
    int degree = 0;
    for ( int j = 0; j < n; j++ )
    {
        degree += A[i][j];
    }
    
    adjacency_list[i] = (int*)malloc( (degree+1) * sizeof(int*) );
    
    int cur_pos = 1;
    for ( int j = 0; j < n; j++ )
    {
        if ( A[i][j] == 1 )
        {
            adjacency_list[i][cur_pos] = j;
            cur_pos++;
        }
    }
    adjacency_list[i][cur_pos] = -1; // "null" terminated.
}
\end{verbatim}

There are many ways to store an adjacency list or an adjacency matrix. 
Bit-packing can decrease the size of an adjacency list to be essentially $Cn + Dm\log n$ for some constants $C, D > 1$ where $n$ is the number of vertices and $m$ is the number of edges.
You could also use linked lists, (self-balancing) binary trees, or hash tables to store the lists of adjacent vertices.
You may also want to store a few things in addition, such as number of vertices, number of edges, the degree sequence, labels on the vertices, etc. 

\newcommand*\rot{\rotatebox{0}}

\begin{table}[htp]
\centering
\begin{tabular}[h]{|p{0.8in}|p{2in}|p{2in}|}
\hline
&\textbf{Pros}& \textbf{Cons} \\
\hline
Adjacency Matrix & Random-Access Lookups & $\frac{1}{2}n^2-\frac{1}{2}n$ bits required for $n$ vertices. \\
 & Matrix algebra encodes more information & \\
   \hline
 Adjacency List  & $\approx m\log n$ bits required for $n$ vertices and $m$ edges (good if $m \ll n^2$). & Linear-Time Lookups \\
   \hline
\end{tabular}
\end{table}

\clearpage
\section{Friday, April 3}

\subsubsection{Isomorphism}

Consider the following adjacency matrices:

\[
A_1 = \begin{bmatrix}
0 & 1 & 0 & 1\\
1 & 0 & 1 & 0\\
0 & 1 & 0 & 1\\
1 & 0 & 1 & 0\end{bmatrix}
\qquad
A_2 = \begin{bmatrix}
0 & 0 & 1 & 1\\
0 & 0 & 1 & 1\\
1 & 1 & 0 & 0\\
1 & 1 & 0 & 0\end{bmatrix}.
\]
You may notice that $A_1 = A(C_4)$ and $A_2 = A(K_{2,2})$ (if you did the earlier exercises!)

\begin{center}
\begin{tikzpicture}[scale=1]

\draw (0,0)--(0,1)
(0,1)--(1,1)
(1,1)--(1,0)
(1,0)--(0,0);


\draw
(0,0) node[insep]{}
(1,0) node[insep]{}
(1,1) node[insep]{}
(0,1) node[insep]{};

\node[above right] at (1,1) {$v_1$};
\node[below right] at (1,0) {$v_2$};
\node[below left] at (0,0) {$v_3$};
\node[above left] at (0,1) {$v_4$};


\draw (3,0)--(4,0)
(3,0)--(4,1)
(3,1)--(4,1)
(3,1)--(4,0);

\draw
(3,0) node[insep]{}
(4,0) node[insep]{}
(4,1) node[insep]{}
(3,1) node[insep]{};


\node[above right] at (4,1) {$y_1$};
\node[below right] at (4,0) {$y_2$};
\node[below left] at (3,0) {$x_2$};
\node[above left] at (3,1) {$x_1$};


\end{tikzpicture}
\end{center}
However, if we "redraw" $K_{2,2}$ we will get a different picture:

\begin{center}
\begin{tikzpicture}[scale=1]

\draw (0,0)--(0,1)
(0,1)--(1,1)
(1,1)--(1,0)
(1,0)--(0,0);


\draw
(0,0) node[insep]{}
(1,0) node[insep]{}
(1,1) node[insep]{}
(0,1) node[insep]{};

\node[above right] at (1,1) {$v_1$};
\node[below right] at (1,0) {$v_2$};
\node[below left] at (0,0) {$v_3$};
\node[above left] at (0,1) {$v_4$};


\draw (3,0)--(4,0)
(3,0)--(3,1)
(3,1)--(4,1)
(4,1)--(4,0);

\draw
(3,0) node[insep]{}
(4,0) node[insep]{}
(4,1) node[insep]{}
(3,1) node[insep]{};


\node[above right] at (4,1) {$x_1$};
\node[below right] at (4,0) {$y_2$};
\node[below left] at (3,0) {$x_2$};
\node[above left] at (3,1) {$y_1$};
\end{tikzpicture}
\end{center}
By these pictures, these graphs look the same! In fact, if we erased the vertex labels, we could not tell them apart!

When I say we ``redraw" the graphs, what we are really doing is pairing the vertices of $C_4$ with the vertices of $K_{2,2}$ with the following map:
\[
\begin{array}{rcl}
v_1 &\mapsto& x_1\\
v_2 &\mapsto& y_2\\
v_3 &\mapsto& x_2\\
v_4 &\mapsto& y_1
\end{array}
\hspace{1in}
\begin{array}{l@{\quad}rcl}
&v_1v_2 &\mapsto& x_1y_2\\
&v_2v_3 &\mapsto& y_2x_2\\
&v_3v_4 &\mapsto& x_2y_1\\
\text{edges}& v_4v_1 &\mapsto& y_1x_1\\
\hline
\text{nonedges} & v_1v_3 &\mapsto& x_1x_2\\
&v_2v_4 &\mapsto& y_2y_1
\end{array}
\]
In the above two lists, we define a bijection from $V(C_4)$ to $V(K_{2,2})$ on the left.
On the right, we see how that bijection sends pairs of vertices from $V(C_4)$ to pairs of vertices in $V(K_{2,2})$.
Observe that the edges of $C_4$ are sent to edges of $K_{2,2}$ and the nonedges of $C_4$ are sent to nonedges of $K_{2,2}$.

There is something \emph{fundamental} happening here, given by the following definition.


\textbf{Def:} Let $G$ and $H$ be graphs.
An \emph{isomorphism from $G$ to $H$} is a function $f : V(G) \to V(H)$ such that (a) $f$ is a bijection and (b) for every pair $u, v\in V(G)$, the edge $uv$ is in $E(G)$ if and only if $f(u)f(v)$ is in $E(H)$.
(That is, the function $f$ sends edges in $G$ to edges in $H$ \emph{and} nonedges in $G$ to nonedges in $H$; informally, the bijection $f : V(G) \to V(H)$ induces a bijection from $E(G)$ to $E(H)$.)
If there exists an isomorphism from $G$ to $H$, then $G$ and $H$ are \emph{isomorphic}, denoted $G \cong H$.

\textbf{Note:} The bijection $f : V(G) \to V(H)$ can be though as a way to \emph{relabel} the vertices of $G$ to match the vertices of $H$ and end up with the same edge set as $H$!

\textbf{To demonstrate $G \cong H$:} Define a bijection $\pi : V(G) \to V(H)$ then demonstrate why $uv \in E(G)$ if and only if $\pi(u)\pi(v) \in E(H)$.
For small graphs (such as those below), we only need to check each pair on a case-by-case basis.

\textbf{Ex:} $C_4 \cong K_{2,2}$.

\textbf{Ex:} $W_3\cong K_4$.

\textbf{Ex:} 

Thus, when I draw a graph on the board or on a piece of paper, I'm not just talking about one graph, but talking about all of the graphs isomorphic to that graph!
This is why we do not need to list the labels of our vertices (unless it is helpful).

\textbf{Def:} Let $G$ be a graph.
The \emph{class of graphs isomorphic to $G$} is the set of all graphs $H$ such that $H \cong G$ (this is infinite, as we could select $V(H)$ to be ANY set of $n$ elements, but typically we think of $V(H) = V(G) = \{1,\dots,n\}$.)
In general, an \emph{isomorphism class} is a family of graphs that are isomorphic to each other.


The most wonderful thing about isomorphism is that most graph properties that we care about are \emph{invariant under isomorphism}. 
That is, if $G \cong H$, then $G$ has a property $P$ if and only if $H$ has a property $P$.
Here are some examples (proofs are omitted so you can try to prove them!):

\textbf{Prop:} Let $G$ and $H$ be graphs. If $G \cong H$, then $|V(G)| = |V(H)|$ and $|E(G)| = |E(H)|$.

\textbf{Thm:} Let $G$ and $H$ be graphs.  If $G \cong H$, then the degree sequence of $G$ equals the degree sequence of $H$.

\textbf{Thm:} Let $G$ and $H$ be graphs. If $G\cong H$, then $G$ is bipartite if and only if $H$ is bipartite. 

\textbf{Thm:} Let $G$ and $H$ be graphs with $|V(G)| = |V(H)| = n$. Let $m$ be an integer with $1 \leq m \leq \lfloor \frac{n}{2}\rfloor$. If $G \cong H$, then $G$ contains a matching of size $m$ if and only if $H$ contains a matching of size $m$.

\textbf{Thm:} Let $G$, $H$, and $C$ be graphs.  If $G \cong H$ and $C \subseteq G$, then there is a subgraph $C' \subseteq H$ such that $C' \cong C$.

With the above theorem, we want to relax our definition of subgraph a little bit.

\textbf{Def:} Let $G$ and $H$ be graphs. We say $G$ \emph{contains a copy of $H$} if there is a subgraph $H' \subseteq G$ such that $H' \cong H$.
Frequently, we will simply say that $H$ \emph{is a subgraph} of $G$, even if the set-inclusion is not true, but we mean that $G$ contains a copy of $H$.

\textbf{Thm:} Let $G$, $H$, and $C$ be graphs.  If $G \cong H$, then $G$ contains a copy of $C$ if and only if $H$ contains a copy of $C$.

\textbf{To demonstrate $G \not\cong H$:} To show \emph{nonisomorphism}, we are saying that no isomorphism exists! Non-existence is always a harder statement (in general) but can frequently be made easier by using results such as the above! If $P$ is a property that is invariant under isomorphism and $P(G) \neq P(H)$, then $G \not\cong H$!

\textbf{Ex:} $C_4 \not\cong C_5$ since $|V(C_4)| = 4 \neq 5 = |V(C_5)|$.

\textbf{Ex:} $W_4 \not\cong K_5$ since $|E(W_4)| = 8 \neq 10 = |E(K_5)|$.

\textbf{Ex:} Prove that the two graphs below are not isomorphic:

\begin{center}
\begin{tikzpicture}[scale=1]
\node[below] at (0,-1) {$G$};
\node[shape=coordinate] (a) at (0:1) {};
\node[shape=coordinate] (b) at (60:1) {};
\node[shape=coordinate] (c) at (120:1) {};
\node[shape=coordinate] (d) at (180:1) {};
\node[shape=coordinate] (e) at (240:1) {};
\node[shape=coordinate] (f) at (300:1) {};


\draw (a)--(b)--(c)--(d)--(e)--(f)--(a);
\draw (a)--(d)
(b)--(f)
(c)--(e);

\foreach \p in {a,b,c,d,e,f}
{
	\draw (\p) node[insep]{};
}
\end{tikzpicture}
\qquad
\begin{tikzpicture}[scale=1]

\node[below] at (0,-1) {$H$};
\node[shape=coordinate] (a) at (0:1) {};
\node[shape=coordinate] (b) at (60:1) {};
\node[shape=coordinate] (c) at (120:1) {};
\node[shape=coordinate] (d) at (180:1) {};
\node[shape=coordinate] (e) at (240:1) {};
\node[shape=coordinate] (f) at (300:1) {};


\draw (a)--(b)--(c)--(d)--(e)--(f)--(a);
\draw (a)--(d)
(b)--(e)
(c)--(f);

\foreach \p in {a,b,c,d,e,f}
{
	\draw (\p) node[insep]{};
}
\end{tikzpicture}
\end{center}

Before we prove $G \not\cong H$, let's first note some things: $|V(G)| = 6 = |V(H)|$, $|E(G)| = 9 = |E(H)|$, and every vertex has degree 3 in each graph!

\begin{proof}
Note that $G$ contains $K_3$ as a subgraph.
Thus, $G$ is not bipartite (as $K_3$ is not bipartite).

However, $H$ is bipartite as we can take every other vertex around the outer cycle to form a bipartition.

Since $G$ is not bipartite and $H$ is bipartite, $G \not\cong H$.
\end{proof}


There is no tried and true method to easily determine if two graphs are isomorphic or not. 
This is mostly due to the fact that there is no ``easy proof'' that two graphs are not isomorphic.
(Contrast this with the fact that we have a short proof of a bipartite graph not having a complete matching, by Hall's Thm.)
This is part of why the ``GraphIsomorphism'' problem (take two graphs, decide if they are isomorphic) is thought to be a so-called \emph{intermediate problem}: No known polynomial-time algorithm exists, but also no proof of being NP-complete exists! 
GraphIsomorphism is one of the few intermediate problems that occur ``naturally'' (that is, it was not first defined for the sake of being intermediate).

HOWEVER: a good strategy for showing $G \not\cong H$ is to go through your list of graph properties: do they have the same number of vertices? do they have the same number of edges? Do they have the same degree sequence? Are they both bipartite or both not bipartite? Does one contain a subgraph the other does not?

As we discover more graph properties, you will have more questions to add to your arsenal!


\end{document} 
