\documentstyle[12pt,psfig]{article}
\input{macros-course-lectures.tex}
\begin{document}

\lecture{notes14}{Notes 14}{April 3, 1997}

%\begin{center}
%\Large \bf 
%Notes 14
%\end{center}

\def\implies{\rightarrow}


Those who joined the class late and didn't do psets: come tell me.

Graphs in this lecture are undirected unless explicitly stated otherwise.

Note: Although we have defined a path to be a sequence of edges, it is
equivalent to consider the sequence of vertices (in order).  We shift
back and forth between these notations as convenient.

\section{Cheap Connectivity}

Suppose we want to wire $n$ dorms together.  What is the smallest number of
wires that will do the job?

Ie, what graph is connected but has the fewest edges?


When is an edge unnecessary?  When it is in a cycle.


\begin{lemma}
A set of $n$ vertices can be put into a connected graph of $n-1$
edges ($n-1$ edges are sufficient).
\end{lemma}
\begin{proof}
Induction.  Clear for 1.  Assume the lemma for $n$.  Consider $n+1$ vertices.
Remove 1 vertex $u$, and hook up the rest using $n-1$ edges.  Add an edge from
$v$ to $u$ for $n$ edges.  Claim: this gives a connected graph.

Proof of connectivity: need to show all vertex pairs have a path.
True by inductive hypothesis for all vertex pairs not including $u$.
So consider a pair $(v,w)$.  By the IH, there is a path
$v,x_1,\ldots,x_k,w$ in the smaller graph.  Then $u,v,x_1,\ldots,x_k,w$
is a $v$-$w$ path in the larger graph.
\end{proof}

\begin{lemma}
Any $n$ vertex connected graph has at least $n-1$ edges ($n-1$ edges
are necessary).
\end{lemma}
\begin{proof}
  Well ordering.  Consider a smallest counterexample, with $n$ vertices
  and $m<n-1$ edges and $n+m$ minimum.  Can't have a degree 0 vertex
  (disconnected).  Suppose all vertices have degree at least $2$.
  Then by the handshaking lemma, the number of edges is at least $n$.  

  So there is a degree 1 vertex $u$ with (unique) neighbor $v$.  Claim:
  deleting vertex $u$ and edge $(u,v)$ gives a smaller counterexample.
  The resulting graph has $n-1$ vertices, $m-1 < (n-1)-1$ edges.
  It remains to prove that it is connected.
  Consider vertex pair $x$,$y$ with $x,y\ne u$.  These were originally connected
  by a path, thus by a simple path.  Is vertex $u$ on this simple path?
  No, because passing through $u$ requires using $(u,v)$ twice in
  succession, which would mean the path wasn't simple.
  The fact that $u$ isn't on the path implies that the edge $(u,v)$ also
  isn't on the path.  So that path is still present
  after deleting $u$.  So the smaller graph is connected. (A contradiction.)
\end{proof}

(We actually implicitly proved a fact we'll use later: deleting a
degree 1 vertex preserves connectivity.)

So, we can do $n-1$ edges and $n-1$ edges is the best we can do.

What kinds of graphs have this property (ie, connected with $n-1$
edges)? 

Trees.

\section{Trees}

Important special type of graph for CS applications. 

\subsection{Definitions}

{\em Tree}: Minimal Connected graph.
\\

Trees can actually be defined 3 different ways:
\begin{enumerate}
\item A connected graph with no cycles (equivalently, a connected forest)
\item A connected graph that is disconnected by the removal of any
  edge, ie, a ``minimal'' connected graph.
\item A graph with a unique simple path between every pair of vertices
\end{enumerate}


{\em Forest}: No cycles, but not necessarily connected. \\
\\
In nontrivial trees (with more than one node), use terminology: \\
{\em Leaf} -- node with only one neighbor. \\
{\em Internal node} -- non-leaf \\
\\
\\



We will prove these 3 definition are equivalent.

To do so, prove $1\implies 2 \implies 3 \implies 1$.  Equivalence
follows by transitivity of implication.

\begin{lemma}
  $(1\implies 2)$ A connected graph with no cycles is disconnected by
  the removal of any edge.
\end{lemma}
\begin{proof}
By contradiction.  Suppose we can delete edge $(u,v)$ without
disconnecting the graph.  This means there is a path from $u$ to $v$
that doesn't use $(u,v)$, and thus a simple path.  Adding edge $(u,v)$
to a simple path that doesn't use $(u,v)$ creates a cycle.
Contradicts claim of no cycles.
\end{proof}

\begin{lemma}
$(3 \implies 1)$ A graph with a unique simple path between any pair of
nodes is connected and has no cycles.
\end{lemma}
\begin{proof}
Connected obvious.  No cycles by contradiction.  Suppose we have a
cycle $v_1,\ldots,v_k,v_1$.  Then there are 2 simple paths from $v_1$
to $v_k$, namely $v_1,\ldots,v_k$ and the edge $(v_1,v_k)$.
\end{proof}

\begin{lemma} 
$(2 \implies 3)$
A connected graph that is disconnected by the removal of any edge has
a unique simple path between any pair of vertices.
\end{lemma}
\begin{proof}
Suppose there are two different simple $u$-$v$ paths.  Call one
$P_1$: $u=x_0,x_1,\ldots,x_k=v$.  Call the other $P_2$: $u=y_0,\ldots,y_l=v$.  Let
$i$ be the smallest such that $x_i \ne y_i$ (why does this have to
exist?).  Claim:  we can remove $(y_{i-1},y_i)$ without disconnecting
$G$.  To see this, consider a pair of vertices $z$ and $w$.  There's a
simple path between them at the start.  It remains to show there's still a path
(doesn't need to be simple) after removing $(y_{i-1},y_i)$.  We use
proof by cases.

Case 1:  $(y_{i-1},y_i)$ wasn't on the path.  Then the path remains
after removing $(y_{i-1},y_i)$.

Case 2:  $(y_{i-1},y_i)$ was on the path.  WOLOG, $y_{i-1}$ is encountered
first. So the path
looked like $z,\ldots,y_{i-1},y_i,\ldots,w$.  So there's a different
path: go from $z$ to $y_{i-1}$ on the first part of $z$-$w$ path, then from
$y_{i-1}$ to $u$ on the first part of $P_2$, then from $u$ to $v$ on $P_1$,
then from $v$ to $y_i$ on the second part of $P_2$, then from $y_i$ to $w$
on the second part of the $z$-$w$ path.
\end{proof}

\subsection{Spanning Trees and Forests}

We've just argued that the ``minimal'' (poset, under edge containment)
connected graphs are trees.  It turns out that every connected graph actually
contains one:

\begin{defin}
A {\em spanning tree} of a graph is a subset of the graph edges that
forms a tree on all the graph nodes.
\end{defin}

Notice that the notion ``tree'' is an intrinsic concept (cares only about the
nodes adjacent to the edges of the tree), while ``spanning tree'' is extrinsic
(cares about whether you have all the graph's nodes).


\begin{lemma}
Every connected graph contains a spanning tree.
\end{lemma}
\begin{proof}
  Well ordering.  Consider smallest counterexample.  If cannot delete
  any edge and stay connected, it is a tree (3rd definition of tree).
  So delete an edge, get smaller counterexample.  Contradiction.
\end{proof}

How to find a spanning tree?  Graph search.


Some graphs aren't connected; don't have spanning trees.  Instead,
have spanning {\em forests}:

\begin{defin}
A {\em forest} is any acyclic graph.
\end{defin}

\begin{lemma}
Each connected component of a forest is a tree.
\end{lemma}
\begin{proof}
Each connected component of a forest is connected and acyclic.
\end{proof}

\begin{defin} 
A {\em spanning forest} for a graph $G$ is a forest that connects
every pair of vertices that were connected in $G$,
\end{defin}

People take some liberties with ``tree:'' call a set of edges a tree
if it connects its vertices and is acyclic.  So we talk about a forest
as being ``a collection of trees'' even though each tree is only on
vertices of a connected component, not on all graph vertices.

In particular, a spanning forest $G$ is just a collection of trees,
one spanning each connected component of $G$.


\subsection{Counting Tree Edges.  Induction off Leaves}


\begin{defin}
A {\em leaf} is a node of degree 1.
\end{defin}

\begin{lemma}
Any non-trivial tree has a leaf.
\end{lemma}
\begin{proof}
  Consider a longest simple path $v_1,\ldots,v_k$ (why does such
  exist?).  Claim $v_1$ is a leaf.  Proof: suppose not.  Then has a
  second neighbor $x$.  Is $x=v_i$?  No, that would give a cycle.  Thus
  $x,v_1,\ldots,v_k$ is a longer simple path, a contradiction.
\end{proof}

\begin{lemma}
If we remove a leaf and its edge from a tree, we get a tree.
\end{lemma}

Note: many of you tried this on the exam.  But didn't prove these lemmas.
(That approach would have required proving other lemmas as well).

\begin{proof}
As shown earlier (in the proof of Lemma 1.2), deleting a degree one
vertex (and its incident edge) preserves connectivity.  It also
doesn't create cycles.  So what we get still has the properties of
definition 1 of a tree.
\end{proof}

\begin{lemma}
Any tree on $n$ vertices has $n-1$ edges.
\end{lemma}
\begin{proof}
(Trivial base case).  Inductive step:
Start with an arbitrary tree with $n+1$ nodes.
Remove one node and its incident edge.
By the previous lemma, the result is a tree (with $n$ nodes).
By the IH, this tree has $n-1$ edges.
So the original tree has $n$ edges.
\end{proof}


\begin{lemma}
Any tree is 2-colorable.
\end{lemma}
\begin{proof}
(Trivial base case).  Inductive step:
Start with an arbitrary non-trivial tree.
Remove one node and its incident edge.
By Lemma 2.11, the result is a tree.
2-color it (possible by the IH).
Replace the leaf and its edge.
Color the replaced node the color different from its neighbor.
All nodes are then colored.
The coloring is valid because all adjacent pairs except across the
replaced edge are still validly colored from when the smaller tree
was 2-colored, and that pair is OK because of the way we chose
the color for the node after we replaced it.
\end{proof}


\section{Euler Tours}

Konigsberg bridge problem: can we cross every bridge exactly once,
without repeats, returning to start?


This problem has a graph representation.

Euler, 1736, proved NO.  So we call such tours ``Euler Tours.''

\begin{theorem}
  If undirected $G$ has Euler tour, then $G$ is connected and every
  vertex has even degree.
\end{theorem}
\begin{proof}
Direct every edge according to tour.  We enter a vertex as many times
as we leave it.  So every vertex must have indegree
equal to outdegree.  So total even.
\end{proof}

100 years later, Hierholzer proved consequence (trouble with coming
second---no one remembers your name!)

\begin{theorem}
If $G$ is connected and has even degree, then it has an Euler tour.
\end{theorem}

\begin{lemma}
If $G$ has even degree and at least one edge, then it has a circuit.
\end{lemma}
\begin{proof}

If connected, handshaking proves $n$ edges, so not a tree, so cycle.
But this also applies to unconnected:  consider a component that
contains at least one edge and apply the above.  (There must be such
a component because every edge of the graph must be in one such component).
\end{proof}




\begin{proof} (Of main result)
By contradiction.

  Idea: Let $C$ be the longest circuit without any repeated edges.
  Delete it.  Delete all isolated vertices.  Since $C$ is not an
  Euler tour, some vertices remain.
  Some vertex $u$ that remains is on $C$.  Why?  Because $G$ is
  connected. Take any remaining vertex $v$, it has a path to a vertex in
  $C$.  The first time we reach an edge of $C$, we stop.  This gives
  $u$. Now, by the lemma, find a circuit containing $u$.  Attach to
  $C$, giving a bigger circuit.  (A contradiction.)
\end{proof}

\long\def\comment#1{}
\section{Hamiltonian Paths}

A slightly different question: is there a tour that traverses every
{\em vertex} exactly once?

Such a cycle is called a {\em Hamiltonian Cycle.}  

In a small variant, a simple path that traverses every vertex exactly
once is a {\em Hamiltonian Path}.

Small change, but suddenly, instead of answer being trivial, becomes
very complicated.  It is believed that no computer program can answer
this question efficiently (it is NP-complete).

\comment{

\begin{lemma}
Any graph with minimum degree exceeding $n/2$ has a Hamiltonian Cycle.
\end{lemma}
\begin{proof}
Consider longest simple path $v_1,\ldots,v_k$.  Suppose not
 everything.  Consider cases.  If $v_1$ or $v_k$ is adjacent to a
 vertex not on the path, then we can add that vertex at an end of the
 path and get a longer path, a contradiction.  So every neighbor of
 $v_1$ and $v_n$ is on the path.  Claim $G$ has a cycle on these
 vertices.  

 Let $v$ be a vertex
not in cycle.  It has degree $n/2$, we'll show can splice into cycle,
get longer cycle, Contra.

How can we splice?  Find two vertices adjacent on cycle, both neighbors
of $v$.

How?  Pigeonhole.  What pigeons?  neighbors of $v$.  What holes?
Adjacent pairs of nodes on cycle.  Cycle has (at most) $n-1$ nodes, so
can break into (at most) $\lceil (n-1)/2 \rceil \le n/2$ buckets.  So
two neighbors in one bucket, means 2 adjacent neighbors.
\end{proof}


This gives a special class of graphs with Hamiltonian Cycles.  In
general, noone knows how to find these well.  I helped publish what is
the currently theoretically best algorithm for finding long cycles.
In an $n$-vertex Hamiltonian graph, it will find one of length at
least $\log n$.  Not very good, is it?
}

\end{document}

DONT ERASE---USE FUTURE YEARS

\subsection{Oriented Trees}

Trees in CS (and elsewhere) are often drawn in a particular
orientation, one node at the top, called the {\em root}, and the
others on paths moving downward. \\
(Of course, {\em real} trees, like maples, etc., have the root at the
bottom, but no one in CS seems to have noticed this.) \\
\\
Depends on distinguishing one node, any node, as root. \\
Level $0$ node. \\
Then all its neighbors drawn just below it, level $1$. \\
Then all their neighbors, level $2$, etc. \\
{\em Rooted tree} = undirected tree + root. \\
Maximum level number $=$ {\em height} of rooted tree. \\
\\
Sometimes ``orient'' (direct) all the edges downward, producing a
directed tree. \\
Prove can do?


(Undirected) tree + root yields directed tree. \\
Note different roots yield different directed trees (can even have
different heights). \\
Draw example, Fig. 5. \\
\\
Could also change the order of siblings, same tree. \\
\\
With rooted tree, use terminology {\em parent}, {\em sibling}, {\em
ancestor}, {\em descendent}. \\
From genealogy trees (but neglecting spouse edges). \\
Draw one. \\
\\
Def: {\em subtree}. \\
\\
Definition:
A rooted tree is an $m$-ary tree, $m \geq 1$, if every internal vertex
has no more than $m$ children. \\
\\
Special case of $m = 2$ is binary tree. \\
Almost the same as we defined earlier in term (as an example to
illustrate recursive definitions); \\
there is a slight difference in that now we're not distinguishing left
and right. \\
Sometimes we do this, but then, if we're being careful, we call the
tree an {\em ordered rooted tree} instead of just a rooted tree. \\
Sometimes I'll be sloppy and not explicitly say ``ordered'',  although
I mean it. \\
\\
\\
Examples of uses of trees: \\
\\
Representing organization structure (who reports to whom). \\
Representing computer file systems (UNIX, almost) \\
\\
Will see more in a few minutes. 

\subsection{Counting on Trees}

What can we say about number of vertices, edges, internal vertices,
leaves, etc., in $m$-ary tree? \\
\\
First consider special case: full trees. \\
Define {\em full} $m$-ary tree -- each internal node has $m$ children. \\
(However, needn't have all leaves at same level -- draw examples. \\

\begin{theorem}
Suppose that a full $m$-ary tree ($m \geq 2$) has 
$l$ leaves,
$i$ internal nodes,
$e$ edges,
$n$ total nodes.
Then:
\begin{enumerate}
\item
(A basic relationship for full $m$-ary trees, $n$ in terms of $i$.)
$n = mi + 1$.
\item
(First consequence, $i$ in terms of $n$.)
$i = {n - 1 \over m}$.
\item
($l$ in terms of $n$)
$l = {(m-1)n + 1 \over m}$.
\item
($n$ in terms of $l$)
$n = {ml - 1 \over m - 1}$.
\item
($l$ in terms of $i$)
$l = (m-1)i + 1$.
\item
($i$ in terms of $l$)
$i = {l - 1 \over m - 1}$.
\end{enumerate}
\end{theorem}

\begin{proof}
\begin{enumerate}
\item
Every vertex except root is child of an internal vertex. \\
So $n$ is equal to $1$ plus the number of children vertices. \\
Claim there are exactly $mi$ children vertices, since there are $i$
internal vertices and each has exactly $m$ children. \\
\item
Just solve the previous for $i$.
\item
Combine obvious fact $l = n - i$ and previous part.
\item
Solve previous for $n$.
\item
Combine obvious fact and part 1, solve for $l$.
\item
Solve previous for $i$.
\end{enumerate}
\end{proof}

Can say more for the further restricted case:  complete trees. \\
And {\em complete} $m$-ary tree (full and all leaves at same level). \\

\begin{theorem}
Suppose that a complete $m$-ary tree ($m \geq 2$) has 
$h$ height,
$l$ leaves,
$i$ internal nodes,
$e$ edges,
$n$ total nodes.
Then:
\begin{enumerate}
\item
$l = m^h$.
\item
$i = {m^h - 1 \over m - 1}$
\item
$n = {m^{h+1} - 1 \over {m - 1}}$
\item
$e = {m^{h+1} - 1 \over m - 1} - 1$
\end{enumerate}
\end{theorem}

\begin{proof}
\begin{enumerate}
\item
$l = m^h$ \\
\\
By induction on $h$. \\
BASE:  $h = 0$: $1 = m^0$ leaves. \\
INDUCTIVE: Assume for $h$, prove for $h+1$.  \\
Given tree $T$ of height $h+1$, children subtrees have height $h$, so
by inductive hypothesis, each has $m^h$ leaves. \\
Leaves of whole tree are exactly the leaves of the subtrees. \\
So $m \times m^h$, which $= m^{h+1}$, as needed. \\
\item
Have $i = {l - 1 \over m - 1}$, substitute previous part.
\item
Have $n = {ml - 1 \over m - 1}$, substitute expression for $l$.
\item
By subtracting $1$ from the previous.
\end{enumerate}
\end{proof}

The preceding theorem gives $l$, $i$, $n$, $e$ in terms of $h$ and $m$. \\
\\
Can use these counting results to get {\em upper bounds} for
non-complete, in fact, non-full $m$-ary trees, e.g.: \\
\begin{enumerate}
\item
$n \leq mi + 1$.
\item
$i \geq {n - 1 \over m}$.
\item
$l \leq {(m-1)n + 1 \over m}$.
\item
$n \geq {ml - 1 \over m - 1}$.
\item
$l \leq (m-1)i + 1$.
\item
$i \geq {l-1 \over m - 1}$.
\item
$l \leq m^h$.
\item
$i \leq {m^h - 1 \over m - 1}$
\item
$n \leq {m^{h+1} - 1 \over m - 1}$
\item
$e \leq {m^{h+1} - 1 \over m - 1} - 1$
\end{enumerate}

LTTR to prove these.

\subsection{Applications of Trees}

\subsubsection{Binary Search Trees}

To aid in storing and searching for data. \\
\\
Store data with {\em keys} from totally ordered set, at nodes of
ordered binary tree. \\
Do this to make it fast to insert and look up items using their keys. \\
\\
Invariant property to maintain: \\
Any value occurring in left subtree of node is $<$ value at node. \\
Any value in right subtree of node is $>$ value at node. \\
\\
Example: Fig. 6 \\
\\
Fast for searching. \\
E.g. to see if $t$ is in tree, compare from top,
go left if less, go right if greater, etc. \\
Trace and reach it. \\
E.g., to see if $n$ is in tree, trace -- not there. \\
The beauty is that the whole tree need not be searched, just one path. \\ 
Usually faster, unless tree is very skewed. \\
\\
Fast also for insertion of new data. \\
Trace. \\
\\
Deletion may leave empty nodes, needs special reorganization methods. \\
See in algorithms class 6.046.

\subsubsection{Compiling}

Very important use of trees is to represent programs, and pieces of
programs, internally during the compilation process.  \\
Trees give the structure of the program, which is not made explicit in
a linear text representation. \\
\\
Example: Arithmetic expressions \\
\\
E.g., (2 + x) - (3 - (x + y)) written as ...Fig. 7
Ordered tree. \\
\\
\\
Example: More interesting program structure: \\
\begin{verbatim}
if x > y then while x <= 5 do x := x+1; a:= a^2 
\end{verbatim}
Draw, Fig. 8 \\
\\
This kind of tree is called a {\em parse tree}.  \\
It is produced during the compilation process, by a compiler program. \\
\\
Besides containing the given information, it gets decorated with other
info, like the types of the variables. \\
It is then used as the basis for generating machine code. 

\subsubsection{Decision Trees}

Can represent the decision structure of a program. \\
Unwind loops, represent as tree. \\
\\
Example: Sorting a list of $4$ numbers $a,b,c,d$ (assume unequal): \\
Fig 9: \\
\\
Answers at bottom. \\
Height of tree corresponds closely to worst-case running time.

How many edges in a tree?  To answer this, we'll show two things: on
an $n$ vertex graph:
\begin{itemize}
\item more than $n-1$ edges implies cycle
\item less than $n-1$ edges implies disconnected.
\end{itemize}
So a tree has $n-1$ edges.

\begin{lemma} Any graph with finitely many vertices and minimum
  degree 2 or more has a cycle. 
\end{lemma}
\begin{proof}
  Start at some vertex $v_0$.  It has at least one neighbor $v_1$.
  Now define $v_k$ to be some neighbor of $v_{k-1}$ that is {\em not}
  $v_{k-2}$.  Always exists by minimum degree 2, so well defined.
  Suppose $n$ vertices.  By pigeonholing, two of $v_0,\ldots,v_n$, say
  $v_i$ and $v_j$, are same vertex.  Then $v_i,\ldots,v_j$ is a
  circuit, can turn to cycle.
\end{proof}

Not true for infinite graph.  Counterexample?

\begin{corollary}
Any $n$ vertex graph with $n$ (or more) edges has a cycle.
\end{corollary}
\begin{proof}
Well ordering.  Let smallest counterexample have $n$ vertices and $m
\ge n$ edges and no cycle.  Suppose has degree 0 node.  Deleting it
reduces $n$ but not $m$, doesn't create a cycle.  Contradicts choice
of $n$.  Suppose has degree 1 node $v$ with incident edge $e$.   Then
deleting $v$ and $e$ gives a graph with $n$ and $m$ reduced by $1$,
contradicts choice of $n$
(technical point: why is this still a graph?  Because we deleted every
edge that uses $v$).  So minimum node degree is 2.  But this must have
cycle by previous lemma.
\end{proof}

\begin{corollary}
Any tree has at most $n-1$ edges.
\end{corollary}

\begin{lemma}
Any nontrivial tree has a leaf.
\end{lemma}
\begin{proof}
First, note every tree has a node of degree less than 2.  Proof by
handshaking.  If $n$ degree two nodes, have $n$ edges.  

Now, suppose degree 0.  Then not connected.  So degree 1.
\end{proof}

\begin{lemma}
Every tree has a leaf.  
\end{lemma}
\begin{proof}
Degree 0 impossible (not connected).   So if no leaf, min degree is
2.  Implies cycle.
\end{proof}

\begin{lemma}
Any tree has $n-1$ edges.
\end{lemma}
\begin{proof}
  Induction.  Base case $n=2$ easy.  So consider $n$ vertex tree $T$.  It has
  a leaf $v$ with neighbor $w$.  Delete $v$ and edge $(v,w)$.  Claim
  remainder is $n-1$ vertex tree.  So has $n-2$ edges.  Now adding 1
  edge and 1 vertex.  

  Remains to show result is tree.  Is there a cycle?  No, because
  wasn't before.  So only trick is to show connected.  So consider
  vertices $x,y$.  Had simple $x$-$y$ path in original tree $T$.  Only
  problem: might have used $v$ and edge $(v,w)$.  But if reached $v$,
  then traversed $(w,v)$.  But then must have traversed $(v,w)$ right
  after.  So isn't simple path.  Contra.  So connected.
\end{proof}

\subsection{Paths in Trees}

Alternative definition often given for tree: \\

\begin{defin}
A tree is a graph with a unique simple path between every pair of
vertices.
\end{defin}

\begin{lemma}
This definition is equivalent to old.
\end{lemma}
\begin{proof}
  Suppose we have a connected graph with no cycles.  Consider vertices
  $x$ and $y$.  Have a path, since connected.  Why unique?  Because
  concatenation of two distinct paths (one $x$-$y$, other reversed
  $y$-$x$) form a circuit (slightly tricky to prove; need to rule out
  taking a path and its reversal, which is a circuit but contains no
  cycle).  So first def implies second.

  Suppose have a unique simple path between every pair.  Then
  connected.  Now suppose have cycle.  Then have two simple paths
  between any pair of vertices on the cycles (one in each direction).
\end{proof}


This yields a third equivalent definition:

\begin{defin}
  A tree is any minimal connected graph. That is, it is a graph that
  is connected but removing any edge makes it disconnected.
\end{defin}

Explain minimal: poset, under containment of edges.

\begin{lemma}
Equivalent.
\end{lemma}
\begin{proof}
Suppose unique simple path between every pair.  Then connected.
Suppose $(u,v)$ is an edge.  Then it is unique simple path from $u$ to
$v$.  So if remove, $u$ and $v$ are disconnected.

Suppose removing any edge disconnects.  Claim no cycle.  Proof:
suppose $v_1,\ldots,v_k,v_1$ is a cycle.  Then if graph is connected,
can remove edge $(v_1,v_2)$ and stay connected.  Why?  Take vertices
$x$ and $y$.  Connected before, so path between them.  If use edge
$(v_1,v_2)$, can replace with path $v_2,v_3,\ldots,v_k,v_1$ to get new
path.
\end{proof}
  


Equivalent definition -- same set of graphs defined in both cases. \\
LTTR, in book p. 533. \\
\\
% LocalWords:  CS ie Def ary LTTR Konigsberg
