Professor: Kevin Hare | Term: Winter 2024
Basic Principles
Combinatorics
The study of combinatorics is the study of counting things.
- How many possible poker hands are there?
- How many ways can we choose a 3 topping pizza with 10 toppings?
- How many ways can we split 8 slices of pizza between 3 people?
- How many ways can we make change for a dollar?
Notation
is an n-element set.
-
All terms are different
-
Order of terms does not matter,
Example
Let be the set of primes less than 10, .
Let be the set of odd numbers less than 10, .
We denote the size of a set by .
Example
From above, , .
Example
Choose a prime less than 10 and an odd number less than 10. I.e. .
For this, we use the notation of
We have
In this case,
Example
Choose a prime less than 10 or choose an odd number less than 10.
Choices are 1,2,3,5,7,9. This is denoted by or (or is in both).
Example
Choose a number less than 10 that is prime and an odd number
We denote this by and
Fact
Definition
Let A be a set. We define a list of A as the set of elements of A where the order matters
Example
Let be the set of primes less than 10.
The possible lists of A include In this case there are 24 lists of
Note, all elements in A will occur exactly once in each list. That is, lists are length .
Question
Let A be a set with . How many lists of A are there?
Let be the number of lists of where . We can partition the set of lists based upon the first element of the list.
There are choices for this first element. Let be the first element of a list. The remainder of the list will be chosen from the list of .
Note that
Hence there are choices for the last elements of the list. As there were choices for , we get .
Note (the only list from is ).
Hence
Theorem
Let be a set with . Then the number of lists of is
Definition
A subset of a set is a collection of elements from without repetition. Note a subset may be empty, or all of . Order does not matter.
Example
Let . The set of all subsets includes
We see that for each a subset either contains , or doesn’t contain . This gives us two choices for all . Either it is in the subset or it is not.
This allows us to observe that the number of subsets of where , is .
Theorem
The number of subsets of with , is (include or not; 2 options times).
Definition
Let be a set of size . A partial list of size is an ordered list with and no repeats.
Example
Let . Let . The partial lists of length of are
(2,3),(3,2),(2,5),(5,2)
(2,7),(7,2),(3,5),(5,3)
(3,7),(7,3),(5,7),(7,5)
Question
For every and , how many partial lists of length are there of
Notice
In the previous example, there are choices for the first element of the list. After we have chosen the first element, we have only 3 choices for the second. After, we are done.
This gives us the number of partial lists is
In general, for , and , we have
choices or the first element
choices or the second
k. choices for the element
this gives
Theorem
The number of partial lists of length of is
Example
Find all of the subsets of size of
For every subset of length there are orderings of the elements to get a partial list of length . This is true for every subset.
This gives us that (# of subsets of size of ) # of partial lists of length of
Theorem
Let be a set , and . Then the number of subsets of subsets of size is
See STAT230 for more on permutations and sets.
Meaning vs Algebra
There are many examples in combinatorics where we can manipulate the algebra to get a result or relationship.
This will tell you that something is true, but not why it is true.
We wish to find relationships between things we know how to count and things we want to count.
Example
Show
We see that is the number of subsets of size of .
Let be a subset of size of .
Notice
is a subset of size .
(I.e if , then ).
We see every , a subset of size corresponds to a unique , a subset of size . Further every subset of size can be constructed in this way.
This tells us that the number of subsets of size is the same as the number of subsets of size .
Bijections
Definition
Let and be sets.
A map is said to be surjective (onto) if there exists (at least one) with (all ‘s are covered).
Example by
A map is said to be injective if every maps to a unique (Sometimes called one-to-one).
Example by
A map is called bijective (or one-to-one & onto) if it is both surjective and injective.
Example by
Note, bijections can be reversed.
See
Observation
-
If there is a surjection , then
-
If there is an injection , then
-
If there is a bijection , then
Notation If there is a bijection , we say B.
Example
Show Let be the set of subsets of of size .
Notice
Example
all subsets of size of numbers from .
Our goal is to get a bijection from to
Notice and are disjoint (since they have different sizes). This gives,
We will construct a map with
by
If we see
If then is size and uses numbers .
This gives
Question: Is this a bijection?
Notice if this map is injective and surjective. The inverse map is .
If , say
and
This gives us that is a bijection. Hence
as required.
Definition
Let , and . A multiset of size with types is a list where
Example
A person has pets, (fish, cats, and dogs)
Here . We can have the list .
We could have types (last type being birds). Then we have fish, cats, dogs, and birds respectively.
Theorem
The number of multisets of with types is
Proof
We will do this by a bijective method. Let be the set of subsets of size of .
Clearly
Let be our set of multisets of size with types.
For example, we could have .
Consider the subject given by
Here there are circles, of which are erased off.
This (admittedly non-rigorously defined) map is a bijection from to .
This gives us
Generating Series
Formal Power Series
In Math138 we considered power series/Taylor series, etc. Key difference in Math239 is we don’t care about convergence.
What we care about are the coefficients and the information they carry.
Definition
A formal power series
Note: Often the are positive integers, and typically represent the size of some set we are interested in.
Example: Let be the number of lists of . In this case
We create the power series
Note: This only converges at . We don’t care.
We can (and do) add and multiply formal power series in the obvious way.
Example
Example
Note
We often call an indeterminate, not a variable. A variable is a placeholder that we occasionally evaluate at. We (almost never) evaluate at . Hence we call it an indeterminate.
We often manipulate formal power series algebraically disregarding convergences.
Example
Let
Notice
This gives
Or equivalently,
Or
Theorem
Let be fixed. Let be the number of subsets of of size .
Show
Note if , then . Hence the first equality (everything after is 0)
Second equality comes from previous work
Let be the set of all subsets of
Let set of all with
Let where
Let
We see
We have
Example
Show
Notice
Further,
This gives us
By looking at the coefficient in front of we get that left hand side right hand side.
Notation, coefficient in front of .
Generating Series
Let be a sequence of numbers that we care about and encode some information.
Example
of binary strings of length
of partial lists of length of
Definition
We define the generating series as
We often generate these series using a weight function.
Definition
Let be a set. We say is a weight function where . We further require that is a finite set .
Example
Let = the set of all binary strings of any length.
I.e.
Good choices for
- The length of the string (in this case )
Bad choice for
- The number of ‘s in the string
I.e.
Here is infinite.
Example
Let be the set of all subsets of
Define by
Definition
We define the generating series for with respect to as
In this case,
Note of subsets of size taken from
Theorem
Let be a set and a weight function. Then
Theorem
Let of multisets of with types
Use generating series to show
Question
What is and what is ?
We want to be all the multisets of with types.
That is
We can define
We can use
This gives
Recall from Math138 that
We don’t care about convergence.
We notice from this that
Both and are formal power series.
Definition
Let and be formal power series. If , then we say is an inverse of and similarly is an inverse of .
Example
Let
Find (if it exists) such that
Write
This gives
Notice . Hence
coefficient in front of the power series .
. Hence
Next
Hence
For general we have.
Notice
This is the Fibonacci sequence.
I.e
We found the inverse.
Example
Show does not have an inverse.
Assume it does, say
As before we will consider , and match coefficients for for various . I.e. consider
For
For
Note , hence there are no solutions, and there is no inverse.
Theorem
Let be a formal power series. Then there exists an inverse
Let and be formal power series. We define the composition as
(assuming it exists)
Example
Let Let
So
Note: This series is the same as the inverse of . Why?
Example
Let be as before, and
The composition is not well defined.
Theorem
Let and be formal power series.
If then is well defined.
Proof
Assume . We can write
Notice
This sum is finite, hence all coefficients are finite.
Definition
We say that a power series is rational if there exists polynomials and such that or
Example
Let
Notice , hence is rational.
Example
Let such that
Exercise show is not rational.
Sum Lemma
Let and be sets.
Let and
Let be a weight function defined on (and hence and )
Then
Proof
Note
here,
Example
Let be the subsets of that contain , and is all the subsets from that do not contain .
Further, is all the subsets of
Let be the size of the subset.
Then
Here is all subsets of of size .
Hence,
This gives
subsets of that contain .
subsets of that contain and are of size .
There is a natural bijection from to subsets of size .
This is given by
The inverse is
This gives us
the subsets of size from that do not contain . We can equivalently think of as the subsets of size from .
This gives
By the Sum Lemma, we have:
Considering of both sides we get:
Product Lemma
Theorem
Let be a set with weight function, , and be a set with weight function , we define:
We define a weight function on as:
Then
Proof
Example
Let be the possibilities of a die. Let .
So
Let
In this case:
Recall
Theorem
Let and be sets with weight and . We define and by Then
We can apply this theorem to higher products.
Infinite Sum Lemma
Notation
We similarly define
, by
Define
Example
Let
We define by the property if then
Example
Let and by .
Then
There will be situations where is not a weight function. For example, if there exists with .
Then ,
Hence
Theorem
Let be a set and a weight function such that . Then,
Example
Let and as before with , .
We notice in this case that
These correspond to
These are the lists in of any length using and that add to .
Compositions
Definition
A composition is a list of positive integers.
The entries are the parts.
The length of a composition is .
The size is
Examples
The compositions of include
from the last example.
The last three examples are
.
Let be the set of all compositions. What is
We know that there are compositions of size , for example.
Let be all the compositions of length . of length , etc.
Then
We have
We note that and in general,
This allows us to write
From this we conclude that the number of compositions of size k is,
Example
Let be the number of compositions of into or more parts using only the numbers or . Find an expression for .
For example,
Weight
Weight
Weight
Let be the set We will only be looking at
We see
The generating series we are interested in is
Note
This allows us to find the generating series we want as
Note
Example
Find the number of partitions of , using only odd numbers, into an odd number of parts. Find the generating series.
Examples
As before it is useful to determine the generating series into exactly part.
In this case,
So
Note
This gives us that
To find the generating series into an odd number of parts.
This last step is just to double check you didn’t make a mistake. If any coefficients are negative, you made a mistake. If any of the small coefficients do not match up with an exhaustive set, you made a mistake.
From the series there should be compositions of into an odd number of odd parts.
Binary Strings
Define
A binary string is of the form where
The length of is . We often use this as our weight function.
We use to represent the empty string. (i.e. the string of length ).
If is the binary strings of length , we use
(This is the same as from before but is easier to write).
As before
set of all binary strings including .
Example Let be the set of all binary strings. Then
Here,
This gives,
Regular Expressions & Rational Languages
(Note: This is also discussed in CS360, CS365)
Definition
are all regular expressions.
If and are regular expressions, then so is . This can be read as “or”.
If and are regular expressions, then so is .
Example
are regular expressions. Hence is a regular expression as is . Hence so is . This represents the binary strings .
Hence so is
This gives as the words represented.
If is a regular expression, so is for . This is
If is a regular expression, so is
Here
Recall
Definition
Let and be regular expressions.
are regular expressions
is a regular expression
is a regular expression
is a regular expression
is a regular expression
Example Consider
This is a regular expression, but what does it mean?
We see is a word described by this regular expression
are all words given by the regular expression , and hence given by this regular expression
Notice
We also have words of length given by this expression. This comes from
Note
This includes
etc.
There are more that are not listed.
Often for regular expressions, we wish to count the number of binary strings represented by this expression of a particular length.
In this case there is one word of length , (namely )
There are words of length
There are words of length
In this case we can create a generating series where of binary strings of length given by the regular expression.
We have in this case that
Definition
Let and be sets of binary strings. We denote
Example
all non-empty binary strings with only
Definition
Let be a regular expression representing the words .
Let be a regular expression representing the binary strings .
The are regular expressions representing the set respectively.
Then is a regular expression representing the strings .
Then is a regular expression representing the strings .
Then is a regular expression representing the language
is a regular expression for the set of strings
Definition
Let be a regular expression. Then , the set of binary strings represented by is called a rational language (or a regular language).
Note
Not all subsets of binary strings are rational languages. For example, is not a rational language.
Example
is not a rational language.
Example
Any finite set is a rational language.
Ambiguous vs Unambiguous
Consider the two regular expressions.
and . These both give the rational language
We see that represents in three different ways. We have
or ,
We see has only one way to do this. Namely .
Ambiguous & Unambiguous Expressions
Definition
We say a regular expression is unambiguous if every string in the rational language is uniquely given by a unique representation. We say a regular expression is ambiguous if it is not ambiguous. Equivalently, there is at least one word in the language with at least two representations.
Example
This is ambiguous. Notice
Example
We see that a word starts with some number of s, that is described uniquely by , and ends with or , which again is unique.
This example is unambiguous.
Lemma
Let and be regular expressions which are unambiguous.
Let their rational languages be and
Then are all unambiguous
The regular expression is unambiguous if and only if
The regular expression is unambiguous if and only if there is a bijection from to
I.e. for every , there is a unique and such that
is unambiguous if and only if is unambiguous for all and for all
Example
Notice is unambiguous as . This has language
Similarly, is an unambiguous expression for
Consider
In this case is size and is size .
Hence there does not exist a bijection, and is ambiguous.
Theorem
Let and be unambiguous expressions with languages and and generating series (with weight function length of binary string). are unambiguous regular expressions with languages and generating series
Sum Lemma
Assume is unambiguous, and is associated to the language . Further
Product Lemma
Assume is an unambiguous expression for (which has a bijection to ). Further
String Lemma
Assume is unambiguous with language . Then
Example
The regular expression is unambiguous.
Let be the language represented by this expression. Find
has generating series
has generating series
Next
This gives the generating series associated to as
Lastly Hence
Note
We can do this on ambiguous expressions, but the coefficients can include over-counts and be too high.
Block & Prefix Decomposition
We see that having an unambiguous regular expression allows us to construct a generating series for the language with respect to the length.
One way to do this is to decompose the strings in an unambiguous way, and construct the regular expression for this.
Block Decomposition
We will decompose a string into alternating “blocks” of 0’s and 1’s.
Example
A non-empty block of ‘s can be represented by . A non-empty block of ‘s can be represented by .
If we alternate these, we could have, for example,
We can represent all binary strings by the unambiguous block decompositions
or
Example
Find a regular expression (unambiguous) where all blocks of 0 even length can be represented.
Notice a non-empty block of ‘s of even length can be represented by . If we also wanted to allow an empty block, we can use
Binary Strings
New Set
Example
All blocks are odd length
Blocks of 1’s, possibly empty, of odd length
Blocks of 0’s, non-empty, odd length
Blocks of 1’s, non-empty, odd length
Block of 0’s, possibly empty, odd length
All binary strings
New expression
Another common type of decomposition is called prefix decomposition.
Prefix Decomposition
The idea is every part starts with 1 and every 1 starts a part.
Example
Every part looks like . We need to allow the word to start with some number of 0’s.
This gives us a decomposition of
(Note, we could decompose based on 0’s, or based on suffixes).
Example
Find an unambiguous regular expression where every 1 is followed by at least two 0’s.
Here is a 1 followed by any number of 0’s. We can modify this to give , where every 1 is followed by at least two 0’s.
All binary strings
New expression
Aside
There are multiple ways to represent all binary strings. The easiest, but least useful is .
Example
We have an unambiguous regular expression for all words where 1 is followed by at least two 0’s. Let this language by . Find .
Here the regular expression is
Notice the generating series for the part coming from is
The generating series corresponding to is .
Putting this together gives
This can be simplified to the form .
Recursive Decomposition
Recursive Decomposition
Another way we can describe a language is recursively. It is possible that such a language is not a rational language. Despite this, we can often still use this decomposition to say something meaningful about the language via generating series.
We need this decomposition to be unambiguous for this to work.
Example
Let be the set of binary strings where all blocks of 1’s are even, and all blocks of 0’s are of length divisible by 3.
For any word in , either it is , or it starts with 0, or it starts with 1. As all blocks of 0 have length divisible by 3, if it starts with 0, then it has to start with . Similarly, if it starts with 1, it in fact starts with .
Here if is the “regular expression”, then we have
This allows us to say something about the generating series.
Hence
Note
This language is in fact rational, and has block decomposition
Example
Let
We see is either empty, , or it starts with a 0 and ends with a 1, and the middle part (after removing the first and last term) is in .
This gives us
Hence the generating series looks like
Example
Let be the language that does not contain . It is useful to define as the language that contains exactly once, at the very end. Let and be their expressions.
Notice
Consider .
This is either , or ends in 0, or ends in 1.
If it ends in 0, and we remove the final 0, then it will still not contain (i.e. it is in
If it ends in 1, and we remove the final 1, then it will not contain and hence is in .
This gives
Consider a word represented by . This cannot contain a anywhere in by assumption.
As at the end cannot create a , we see does not contain a if and only if does not contain a .
This gives us
Hence
Combining the two equations gives
Example
Same as before, except use instead of .
As before we have
The problem occurs when we try to do something like .
Consider
We see
We see has multiple occurrences of , two of them not at the end.
If
Then
If
This gives
Excluded Substrings
Theorem
Let be a non-empty binary string of length . Let be the collection of non-empty suffixes of such that there exists a .
Let
Then the generating series for the language of binary strings not containing is
Example
Let
Notice the suffixes of are and . In this case
.
In this case
This gives
This gives
Why does this work?
In the original method we always have
(-language avoiding . -language containing exactly one at the end).
The second relationship depends on . Let
We get a new relation
From these two relations we get the generating series
and
So
After this it is just algebraic manipulation to solve for .
Example
Let
- avoid
- occurs exactly once at the end
What happens if we append to the end of a word in .
If the word in ended with , then
This is in .
In this case the corresponds to a as
If the word does not end in , then we are fine, and
Notice, the suffixes of are
From here we get
Recurrence Relations
Recurrences
Example
Let and
Questions
What can we say about
Can we find a closed form for it? What can we do with this closed form?
First, find a closed form for
This is our desired closed form expression.
Example
Let , and
Last class we showed
Consider . I want to write this as for reasons that will make sense later.
Find the roots of .
(This is where )
By the quadratic formula, the roots of are .
This gives .
Equiv:
This gives us
We can now do a partial fraction decomposition (Math ).
That is, we can find an & such that
Multiplying both sides by the denominator gives
With a bit of trial and error, we see and .
This gives us,
We notice in this case that . This means that as .
This means for large that
Further, as are all integers, we see is very close to an integer for large .
Homogeneous Linear Recurrence Relations
Let be a set of complex numbers (typically integers).
Let be a set of initial conditions. Here .
Then the sequence is a homogeneous linear recurrence relation if for all we have
Example
Our previous example is an example of such a relation. Here , and
Here . In the previous example, we had
Theorem
Let be the recurrence relation. Then
where here if .
Example
Let
Find a closed form for
Find initial conditions
Find recurrence relations
We know from partial fraction decomposition that there exists and such that
Multiply by denominator
Evaluate at gives,
Evaluate at gives .
Knowing and we can simplify and get .
Hence
This gives
Hence
Notice
Linear Homogeneous Recurrence Equations
Version 1
Initial conditions
Recurrence Equation
Version 2
Here,
Version 3
Assume
Then there exists polynomials with such that
Introduction to Graph Theory
Note, embedded graphs are not complete yet. For the full graph theory notes (including the graphs) check the pdf
Definitions
Definition
A graph is a collection of vertices, (), say and a collection of unordered pairs (edges) between the vertices, .
For now, we assume the number of vertices is finite. We will assume that there is at most one edge between two vertices. We will assume the edges are undirected (i.e. pairs are unordered). We will assume that there are no edges from a vertex to itself.
Graph
Example
Let be a graph with
and
We often draw graphs with circles around each vertex, and lines between two vertices indicating an edge.
We say two vertices are adjacent if there is an edge between them. For example & are adjacent, & are not.
We define the neighbours of a vertex to be all the vertices that it is adjacent to.
Example
The neighbours of are &
If we can draw the graph in such a way that no edges cross each other, then that graph is called planar. The previous example is planar.
Example
The graph on five vertices, and an edge between every pair of vertices is not planar.
In this case, if we remove any edge, the new graph is planar.
There are a huge number of applications to graph theory.
- Networks
- Traveling Salesperson Problem
- Colouring countries on a map
There are a lot of variations (which are all interesting)
- Multiple edges
- Loops
- Directions
- Weights
- Infinite graphs
- We could allow unordered types (instead of pairs)
Definition
We say that the degree of a vertex is the number of edges touching the vertex.
Fact
The degree of is equal to the number of neighbours of .
Proof
At the other edge of an edge touching is a neighbour of .
Theorem
Proof
We see each edge is connected to two vertices, say & . Hence each edge contributes to the degree of and to the degree of . This gives the equation.
Corollary
The number of vertices with odd degree is even.
Recall that we showed
The right hand side is an even number.
Hence must be even.
If we had an odd number of vertices of odd degree, then would be odd.
Hence we have an even number of vertices of odd degree.
Corollary
The average degree of a vertex is
Proof
Average degree
Isomorphism
Definition
Let and be graphs. We say is isomorphic to () if there exists a bijection with the additional property that
Example
To see these are isomorphic, consider the bijection
This is easy to see there is a bijection from to
We can check the edges
Fact
Let and be isomorphic with bijection .
Then
- They have the same number of vertices
- Same number of edges
Which are isomorphic? Which are not?
Edges | |||||
Vertices | |||||
# of vertices with | |||||
Based on this information, the only two graphs that might be isomorphic are and . |
Example
These are not isomorphic despite having the same number of edges, vertices, and all vertices having the same degree ().
Definition
We say a graph is regular if for all . We say a graph is regular if it is regular for some .
Example
The graph with vertex and no edges is regular.
The graph with vertices and no edges is regular.
Example
What do the regular graphs look like?
-regular graph with vertices.
As the number of vertices of odd degree is even, and is odd, we have that -regular graphs have an even number of vertices.
regular graph with vertices.
In general, a regular graph looks like
Example
What do -regular graphs look like?
regular graphs are a collection of disjoint cycles.
Example
What is the smallest regular graph (i.e. minimal vertices)? ()
Let and put an edge between every pair of vertices.
Definition
A complete graph is a graph with vertices and an edge between every vertex.
Note is regular
Question
How many edges does have?
We know there are vertices, and every vertex has degree .
This gives
Bipartite Graphs
Definition
We say is a bipartite graph if we can divide the vertices into two disjoint sets and such that all edges have one end in and one end in .
Example
Which of the following are bipartite (, , respectively)?
is bipartite. To see this, let and
is not bipartite. To see this, assume it is, and hope for a contradiction. Assume without loss of generality that . As there is an edge from to and to , as there are no edges from to , we see . There is an edge from to , hence . Similarly, there is an edge between and . Hence, . But there is an edge from to , both in .
This gives us a contradiction. Hence is not bipartite.
For we can assume a vertex is in , and see what we derive.
Example
Let be a -regular graph on vertices.
This is bipartite. To see this, we could set
OR
Example
Let be a graph on vertices,
We say if and only if or
The first couple vertices of this graph are
We see that odd numbers are not connected to each other, and even numbers are not connected to each other. We can take
Note
Technically “connected” has meaning in graph theory. It is better to say there is no edge between two odd vertices.
Definition
We say is a complete bipartite graph if it is bipartite, and every vertex in has an edge to every vertex in .
This is typically denoted where .
respectively.
Question
How many vertices does have?
We see and is a disjoint union of and . So .
The number of edges is . To see this, note that there are vertices in . Further, every vertex has an edge to all vertices in . There are no other edges. Hence there are edges.
Theorem
Let be isomorphic to . Then is bipartite is bipartite.
Proof
To see this, let be an edge-preserving bijection. Then if demonstrate is bipartite, will demonstrate is bipartite.
Example
Consider the 3-regular graphs on 6-vertices.
We see is bipartite (and is isomorphic to using ).
is not bipartite. To see this, assume . Then . But there is an edge from to . A contradiction.
Example
Let be a regular bipartite graph. Show or .
If is regular, we see every vertex in has degree .
So there are edges.
Similarly, looking at , we have edges.
This gives , hence or .
Specifying Graphs
1) Draw a picture
2) Specify the vertices and edges.
3) Giving the vertices, and a rule for the edges.
Example
Let be the set of all subsets of
We say if
Adjacency Matrix
This is a matrix, with columns/rows induced by .
We set if and 0 otherwise.
Example
As there are no loops, all terms on the diagonal are . As the graph is undirected, . As we do not allow multiple edges, entries are bounded by .
Powers of these matrices tell us information about walks.
This is annoying if is large.
Adjacency List
Vertex | Neighbours |
---|---|
Paths and Cycles
Definition
Let be a graph. We define a walk from to as a sequence of vertices such that for . This is a walk of length (as there are edges).
Example
Find all walks of length starting at of
Definition
A path is a walk where all vertices are distinct.
Example
For the previous graph, there are paths of length starting at .
They are
Fact
The longest path in a graph has at most length
Example
The longest path is length , even though we have
Theorem
If there exists a walk from to then there exists a path from to .
Proof
If , we are done. Take the path of length starting/ending at .
Let be a walk from to . If all vertices are distinct, we are done. Hence assume for (with . Assume .
Consider the new walk
Either this new walk has all vertices distinct, or we repeat.
Note, the initial walk is a finite length. Every time we apply this process we get something shorter. This process will eventually terminate.
Example
Alternatively
Theorem
If there is a path from to and from to then there is a path from to .
We can use the previous result to get a path.
Definition
Let and be graphs. We say is a subgraph of if and .
Example
Which of these graphs are subgraphs of another graph?
and are subgraphs of .
is a subgraph of both and .
Everything is a subgraph of itself.
Note
Let be a subgraph of (not example above)
-
-
-
If is bipartite, then is (probably) bipartite. This won’t work if we remove all of or all of from .
-
Every graph is a subgraph of the complete graph on vertices .
Definition
If is a subgraph of and , then we say is a spanning subgraph of .
If in addition, then is a proper spanning subgraph.
Fact
A spanning subgraph of a bipartite graph is bipartite.
Definition
A connected 2-regular subgraph is called a cycle.
Example
Find some cycles in
Theorem
Let be a graph such that for all
Then contains a cycle.
Proof
Let be a path of maximal length. Notice, .
Say . If for all , then is a longer path (which contradicts the fact that we took the longest path).
Hence for some
We have by assumption that .
This gives us a cycle
(Technically a walk contains more information than a cycle, as there is a concept of direction and start and end. By this we can mean the image of the walk).
Example
Step 1
Find a longest path ().
Step 2
is connected to something. Say .
Connect to and remove everything from the path before .
Walk
Definition
We say the girth of a graph is the size of the smallest cycle.
Definition
We say a cycle is a Hamiltonian cycle if it contains every vertex.
Definition
A path is a Hamiltonian path if it visits every vertex.
Example
The girth is (given by )
is a Hamiltonian path
is a Hamiltonian cycle
Exercise
Let be a complete graph on vertices. How many cycles of size does contain? Size ? Any size?
Fact
Let be isomorphic to . Then
- has a Hamiltonian path/cycle if and only if does.
Connectedness
Definition
Let be a graph. We say is connected if for all , there exists a path from to .
Example
is the only -regular connected graph.
-regular connected graphs include
These are the only examples.
A complete graph is always a connected graph.
This is true because there is always a path (of length ) between two vertices.
Theorem
Let be a graph. Let be such that there is a walk from to for all . Then is connected.
Proof
Let . We know there exists a walk . There also exists a walk .
Hence there is a walk.
Hence there exists a path between and by previous result. Hence is connected.
Theorem
Let be isomorphic to . Then is connected if and only if is connected.
Definition
Let be a graph. We say is disconnected if it is not connected.
Example -regular graph on vertices
Notice, both of the two graphs below are disconnected. But one is more disconnected than the other.
Definition
We say a subgraph is a component of if
-
is connected
-
is a subgraph of
-
If contains as a proper subgraph, then is disconnected.
Example
Consider
is not a component as it is not connected.
is not a component because it is a proper subgraph of the connected subgraph.
In this case the two components are
The number of components measures how disconnected a graph is.
Theorem
Let be isomorphic to . Then has the same number of components as .
Recall
is a proper subgraph of if is a subgraph and either or .
Definition
Let . We define a cut induced by as the set of edges with one end in and one end outside of .
Example
Let for the graph
The edges in pink are those induced by the cut
Example
Find a non-empty, proper set such that the cut induced by is empty.
Notice the cut induced by is empty. We could have alternatively used to get a similar result.
Example
Can we find a proper non-empty set such that the cut induced by is empty?
Assume . (If , a similar argument holds). As , and we want the cut to be empty, we must have .
Similarly, as . Similarly, and are all in . Hence is not a proper subset of .
If we instead assumed , we could show and are not in , hence would be empty.
Recall
Definition
Let . We say that the cut induced by is the set of edges such that and .
Theorem
A graph is disconnected if and only if there exists a non-empty proper such that the cut induced by is empty.
Note: Proper means and (strict subset).
Proof
Assume is disconnected.
Hence there exists such that there is no path between and .
Let be the set of vertices connected to by a path. We see , hence is non-empty. Further, , hence it is proper.
Consider in the cut induced by . Assume , . Assume , . There is a path from to and from to , hence from to , a contradiction. The cut induced by is empty.
Assume for the other direction there exists a non-empty proper such that the cut induced by is empty.
There exists and . We want to show there is no path between and . Assume for contradiction that is such a path.
Let be the maximal term such that , . (Let ). Then () is an edge in the cut induced by , which is supposed to be empty.
Euler Tours
Eulerian Circuits
Example (Königsberg, century)
Question
Can we take a walk from your house, crossing every bridge exactly once, and end up back at your house?
We can translate this question to a graph, and walk on a graph.
Question (Revised)
Does there exist a walk starting and ending at the same vertex that goes through every edge exactly once.
This is not possible (for this graph).
We see every time such a walk goes through a vertex, it must enter and exit via different edges. Hence if it is visited times, the vertex has degree .
That is, every vertex has even degree.
In this case, and . None of these have even degree.
Hence such a walk does not exist for this graph.
Definition
An Eulerian Circuit is a walk that starts and ends at the same vertex and goes through every edge exactly once.
Definition
An Eulerian walk is a walk that goes through every edge exactly once. This means start and end at different locations.
Example: Modern day Kaliningrad
is an Eulerian walk.
Question
Is it always possible to find an Eulerian circuit if all vertices have even degree?
Answer
If is disconnected, no. If is connected, then yes. We prove this by induction.
Theorem
Let be a connected graph such that every vertex has even degree. Then has an Eulerian Circuit.
Note: This proof also works for multiedges and loops.
Proof
We will do this by induction on the number of edges in the graph
Cases
Assume the statement is true for every connected graph with ( or fewer)edges.
Notice, every vertex has degree at least .
Hence will have a cycle
We remove this cycle from the edge set of the graph.
Every vertex will have even degree. Every component will have or fewer edges. Hence every component has an Eulerian circuit. Further, every component shares a vertex with the cycle. We now glue things together.
I.e. component with circuit
We stick this in as
Eulerian Circuits
Recall
An Eulerian circuit is a walk starting and ending at the same vertex and using every edge exactly once.
We showed that if was connected and all vertices had an even degree, then had an Eulerian circuit
Example
Step 1
Find a cycle.
For example
Step 2
Remove this cycle from the graph to get a number of components.
Repeat arguments on components to get the two cycles.
Note
A similar proof works for Eulerian Paths. A bridge version exists in Bristol.
Bridges / Cut-edges
Definition
An edge is a bridge (or cut edge) if removing this edge produces a graph with moire components.
Example
The edge is a bridge. After removing this edge we get two components.
The edge is also a bridge.
Theorem
If is a bridge of a connected graph , then has two components.
The two components will be the set of vertices in connected to , say . Similarly for , say .
(Here “connected to” means there exists a path from to this vertex).
If then there is no path from to in .
There is a path from to in .
This means the path goes through the edge . Hence there is a path from to .
Hence for any vertex , if , then , and if , then .
Hence has two components.
Example
Notice that an edge in the previous graph is either contained in a cycle, or a bridge, but not both.
Theorem
An edge is a bridge if and only if it is not in a cycle.
Equivalently
Theorem
An edge is not a bridge if and only if it is not contained in a cycle.
Proof
Let be in a cycle, say
removing leaves a graph where has a path to .
This gives, the set of vertices with a path to is the same set as the set of vertices with a path to . Hence we have the same number of components.
Assume next that is not a bridge. If we remove this edge, we still have a path from to , say
This gives that
is a cycle in .
Theorem
If there exists two distinct paths from to , then the graph contains a cycle.
Example
This has two distinct paths from to . Namely,
Notice if we remove the edge that there exists a walk from to . We go
Hence there exists a path from to without the edge . This is .
Adding the edge back in gives a cycle
How could we prove this in general?
Theorem
If there exists two different paths from to , then has a cycle.
Proof
Take an edge that is in one path but not in the other.
If we remove this edge, then we still have the same number of components. Hence this edge is not a bridge. Hence this graph has a cycle.
Trees
Trees and Minimally Connected Graphs
Definition
A graph is a tree if it contains no cycle and it is connected.
Example
Definition
We call this graph a forest if every component is a tree.
Definition
Let be a tree. A vertex is a leaf if it has degree .
Example
A regular graph is a forest, and every vertex is a leaf.
Theorem
Let be a tree. Then there is a unique path from to for all .
Proof
Our tree is connected, hence there is a path. If there existed two distinct paths, then would have a cycle. Trees have no cycles. Hence the path is unique.
Theorem
Let be a tree. Then every edge is a bridge.
Proof
If we had an edge that was not a bridge, then it is in a cycle. Trees have no cycles. Hence every edge is a bridge.
Note This is also true for forests.
Question: What is the relationship between and
Example ( respectively).
Theorem
Let be a tree. Then
Proof
We will use induction on the number of vertices.
Base Case
vertex edges
vertices edge
Inductive Hypothesis
Assume this is true for all trees with or fewer vertices.
Inductive Step
Let be a tree with vertices. As is connected, there is a path from every to , and hence there is an edge. This edge is a bridge.
If we remove this bridge, we have two components, each a tree, and each with or fewer vertices.
Let the first component be a tree with vertices, and the seconds have vertices. We have and
By induction, the first tree has edges. The second has edges. This gives us that the original tree with vertices has
Example
This gives vertices in total and edges.
How many leaves does a tree have?
Question
Can a tree with vertices have fewer than 2 leaves, or more than leaves?
Theorem
Let be a tree. Then has at least 2 leaves. (We assume ).
Proof
By induction
Base Case
vertices leaves
Both vertices are leaves. has leaves.
Inductive Hypothesis
Assume this is true for every tree with or fewer vertices.
Inductive Step
Let be a tree with vertices. This tree will have an edge and this edge is a bridge.
Call this edge . Let the two trees that result from removing this bridge be and .
We have two cases.
We could have is a leaf, and is not (or equivalently, is a leaf, is not) or both vertices are not leaves of .
Case 1:
is a leaf of , is not. Hence by induction will have two leaves. It is possible one of these is . One of these is not , call it .
We can check that and are leaves of .
Case 2:
Neither and are leaves.
As before, and will have two leaves. At least on of the leaves of is not , call this .
At least one of the leaves of is not , call this . Then and are leaves of .
Spanning Trees
Recall
Definition
We say a subgraph of is a spanning subgraph if .
Definition
We say is a tree if it contains no cycles and is connected.
Definition
We say is a spanning tree of if is a spanning subgraph of and it is a tree.
Example
Find a spanning tree of
Example
Does a regular graph on vertices have a spanning tree?
No We cannot find an edge from the left two vertices to the right two vertices. There are no spanning subgraphs, hence no spanning trees.
Theorem
A graph has a spanning tree if and only if is connected.
Proof
Assume first that has a spanning tree, say .
Take any two vertices in , say and . Then as is a spanning subgraph.
As is a tree, there exists a (unique) path from to . This path uses edges in . Hence there exists a path from to in . This proves is connected.
Assume for the other direction that is connected.
will contain some edges that are bridges, and some that are not. We will construct our spanning tree by removing non-bridge edges.
Create a subgraph of by removing an edge that is not a bridge. If no such edge exists, we have a tree. Repeat this process on this new subgraph as needed.
-
We never remove a vertex, so all of these subgraphs are spanning.
-
We never remove a bridge, hence all of these subgraphs are connected.
-
At some point this process will step (I.e. when )
The result after repeating this will be a spanning connected subgraph where every edge is a bridge. I.e., a spanning tree.
Example
Find a spanning tree of the graph
Method 2 - Grow the tree
Start with any vertex. This will be our starting (non-spanning) tree.
Find any edge from inside this tree to outside this tree. Add this edge to get a larger tree. Repeat as necessary until you have every vertex.
Example Same as before
Characterizing Bipartite Graphs
Recall a graph is bipartite if there exists where
-
-
-
Every edge () has one end in and one end in .
Theorem
A cycle of odd length is not bipartite.
Proof
Assume the graph is bipartite.
Let be a vertex. Assume without loss of generality that .
The two adjacent vertices to are in .
The vertices adjacent to the vertices adjacent to are in . (I.e. the vertices with a path of length 2 from ).
Continue this process. Vertices with a path of length are in and length are in .
This is where the problem occurs, as there is a path of odd length from to , hence it is in both and .
Hence the cycle is not bipartite.
Corollary
If contains a cycle of odd length, then it is not bipartite.
Example
Proof
The subgraph of a bipartite graph is bipartite. A cycle of odd length is not bipartite.
Theorem
A graph is bipartite if and only if it does not contain a cycle of odd length.
Equivalently
Theorem
A graph is not bipartite if and only if it contains a cycle of odd length.
Proof
Assume without loss of generality that is connected. We have already shown that if has a cycle of odd length, then it is not bipartite or equivalently, if it is bipartite, then it will not contain a cycle of odd length.
We will show that if is not bipartite then it will contain a cycle of odd length.
Let be a connected graph that is not bipartite. As is connected it has a spanning tree . All trees are bipartite. Hence we can divide the vertices of into two sets and such that all edges in have one end in and one end in .
As is not bipartite, there exists some edge such that either or .
We see , (as is bipartite). There is a path from to in , because is a tree. Further this path is even length.
Connecting to this path gives a cycle of odd length, which proves this result.
To see the path is even length, we see the path is of the form
Assume (same argument works if they are in ).
Distance from A’s is even.
Example
Step 1- Find spanning tree
Step 2 - Make spanning tree bipartite
Find an edge in that has both ends in or both ends in .
At this point we construct an odd length cycle.
Planar Graphs
Planarity
Definition
We say a graph is planar if we can draw the graph such that no edges cross.
Example
- complete graph on 4 vertices.
This gives us two planar embedding of . Hence is planar.
Example
(Not proven yet) does not have a planar embedding.
Definition
A planar embedding is a diagram where none of the edges cross.
Definition
Let have a planar embedding. Then we say a face of the embedding is a region “contained” by the graph.
Example
Consider the embedding of
This embedding has vertices, edges and faces.
Example
Let be a tree.
Then is planar and has a planar embedding
face, vertices, edges
Example
Let be a connected -regular graph. is planar and has two faces.
Fact
If is isomorphic to , then is planar if and only if is planar.
Fact
If is a subgraph of a planar graph , then is planar.
Definition
We say two faces are adjacent if they share an edge.
Definition
Let be a minimal walk containing a face and which visits every vertex touching the face. The length of this walk is the degree of the face.
Example -
given by
Similarly,
Example
given by the walk
The walk for is . That gives .
For ,
Notice has edges.
For
This had edges.
Theorem
Proof
When we add the degree of the faces, we count every edge twice. One for each side of the edge.
This is known as the handshaking lemma for faces. It is very similar to the formula for the degree of each vertex.
Euler’s Formula
Consider a connected graph with vertices. What is the relation between the number of faces and number of edges.
vertices, edges, face
Case 2
vertices, edges, face
Case 3
vertices, edges, face
Case 4
Observation: When we increase the number of edges, we increase the number of faces.
Consider instead what happens if we leave the number of edges the same, and increase the number of vertices.
# edges | ||||
# vertices | ||||
# faces |
Observation: If we increase the number of vertices, we decrease the number of faces.
Guess
Let faces. We can guess
Test
Euler’s Formula
Theorem (Euler)
Let be a planar connected graph with vertices, edges and faces. Then
Proof
We will prove this by induction on the number of edges.
Let have vertices. The graph with a minimal number of edges that is connected is a tree. A tree has edges. The only face of this planar graph is the outside face, hence .
This gives
Hence Euler’s Formula holds for a tree.
Assume Euler’s formula holds for all , and a graph with edges is planar.
Notice is not a tree. Hence there will contain an edge that is not a bridge.
The face on either side of this not bridge will be different faces. Remove this edge to get a new graph with edges, vertices and faces in this new graph. By induction
This implies
Example
Question
Is the # of cycles in a graph related to the number of faces?
Answer: Not in an obvious way, so probably no.
Question
Can we find a planar graph where for all , and for all ? If so, what does it look like?
We know
Let
First equation gives:
Second equation gives:
Using this information in Euler’s formula gives
If such a graph exists, it has edges, vertices and faces.
Every face and vertex has degree .
This is an example of a platonic solid.
Platonic Solids
Definition
A graph is a platonic solid if
-
It is connected and planar
-
All vertices have the same degree
-
All faces have the same degree
Example
We showed is a platonic solid where all vertices have degree and all faces have degree .
Theorem
There are only platonic solids.
Proof
Assume and for every vertex and face .
Let the platonic solid have vertices, edges and faces.
By the Handshake Lemma for vertices we have
Using Handshake Lemma for faces gives
This gives , .
By Euler’s formula we have .
This gives
We must have
We notice , and similarly (see note).
Note: We should have added the assumption that for every vertex in the definition of a platonic solid.
Case 1
We see that if , and , then
Hence we may assume .
Similarly we may assume .
dodecahedron
icosahedron
Fact
The planar dual of a Platonic solid is a platonic solid.
Non-Planar Graphs
Theorem
is not a planar graph.
Proof
Assume that it is planar and derive a contradiction.
We see
If is planar, then it would have vertices, edges, and faces.
We see for all faces.
Hence by the handshaking lemma for faces, we have
This gives , which is a contradiction.
Hence is not planar.
Theorem
, the complete bipartite graph with , is not planar.
Proof
Assume that is planar. This graph has vertices and edges. By Euler’s formula, , this gives us faces.
Because is bipartite, all cycles (and hence all faces) have an even length (degree). Hence we have for
By the handshaking lemma for faces,
This is a contradiction. Hence is not planar.
Theorem
Let be a connected planar graph with vertices and edges. Then
Proof
Assume is a connected planar graph. We know . We further know that for all faces.
By Handshake Lemma
This gives
What about a face of degree 2?
It is worth noting that the only connected planar graph (without loops or multiple edges) that has a face of degree is.
”I always ignore this special case because I forget it exists” - Kevin.
This has .
So the theorem doesn’t hold for the degenerate case.
Theorem
Let be a planar graph. Then there exists a vertex such that .
Proof
Assume is a non-degenerate planar graph. If every vertex had , then
Hence , a contradiction.
Kuratowski’s Theorem
Definition
An edge subdivision of a graph is done by replacing an edge with a path of length .
Example
Fact
Let be an edge subdivision of . Then is planar if and only if is planar.
Fact
Let be a subgraph of . If is planar, then is planar. If is non-planar then is non-planar.
Warning
If is planar, we can assume nothing about .
Let
Theorem (Kuratowski)
A connected graph is not planar if and only if it contains a subgraph that is an edge subdivision of or .
Proof
We see an edge subdivision of and are non-planar. Hence if this is a subgraph, the original graph is non-planar.
The other direction is beyond the scope of the course.
Example
is not planar.
To see this, if we remove a single vertex and all edges attached to it, we get the subgraph .
Example
Consider the graph on vertices .
This is non-planar.
This has a as a subgraph.
Hence this is non-planar.
Colouring and Planar Graphs
Definition
Let be a graph. A colouring (of the vertices) is a map from to a set of size such that adjacent vertices are assigned different values.
Example
This graph does not have colouring.
Fact
A graph is colourable if and only if it is regular (i.e. no edges).
Fact
A graph is colourable if and only if it is bipartite.
(Colour one colour, and everything in another colour).
Example
A cycle of odd length is colourable
Example
Consider a planar graph.
In general, every planar graph can be coloured.
One way to think of this problem is to colour different countries different colours such that if two countries share a border, they are different colours.
The world map is (probably not) a planar map.
Borders of France
Country | Border Length |
---|---|
Brazil | km |
Spain | km |
Belgium | km |
Suriname | km |
Switzerland | km |
Italy | km |
Germany | km |
Theorem
Let be a planar graph. Then is colourable.
Proof
We prove this by induction.
This is clearly true if has less than or equal to vertices. Assume this is true for up to vertices, and let be the planar map with vertices.
As is a planar graph, there exists a vertex of degree at most , say .
Let be the graph where we remove and all edges to .
Then is a planar graph with vertices. By induction it is colourable. Colour it.
Apply this colouring to the original graph. We have choices to colour , and neighbours that restrict this choice.
Colour anything that its neighbours are not.
This gives a colouring of .
Theorem
Let be a planar graph. Then is colourable.
Proof
As before, we prove by induction. This is true for all with or fewer vertices. Assume true for graphs with vertices, and let be a planar graph with vertices.
As is a planar graph, there exists a vertex with . Choose this vertex.
Case 1
As before, we remove and all edges to , colour the new graph. Then use this colouring for , choosing any colour for that it is not adjacent to (we have options).
Case 2
Let its neighbours be labeled .
Consider the subgraph on and all edges from .
This subgraph is not (As is not planar). This gives that at least two vertices do not have an edge between them. Say and .
Construct a new graph where we remove and , and add a new vertex . If with or then .
This new graph is a planar graph. Hence by induction it has a colouring. Colour it.
Take this colouring to colour the original graph.
We colour both and the colour assigned to (there is no edge between them).
We colour to be anything is not (of which there are at most restrictions).
Theorem
Every planar graph is colourable.
Step 1
Assume every face is a triangle.
Step 2
Break this into cases.
Step 3
Ask a computer for help.
Step 4
Defend yourself from mathematicians that hate computers.
Matchings
Matching
Definition
Let be a graph. A matching is a regular subgraph of . Alternatively, is a collection of edges such that every vertex is incident to at most one edge.
Example
The matching is given by . Every vertex is saturated.
Example
(again)
The single edge is a (non-maximal) matching
and are saturated, are unsaturated.
Definition
We say a vertex is saturated by a matching if it is incident to an edge in . Otherwise it is unsaturated.
Recall
For an edge , we say both and are incident to .
Definition
We say a matching is perfect if every vertex is structured.
The first example is perfect, the second example is not.
Example
does not have a perfect matching. We see this because has an odd number of vertices.
Example
The graph below does not have a perfect matching.
Example
Let be a bipartite graph with partition and . If has a perfect matching then .
Proof
To see this, we see that every edge in is incident to one vertex in and one in . So,
Definition
Let be a graph with a matching . We say a path in is an alternating path if adjacent edges in the path have one edge in and one edge not in .
Example
This matching is not a perfect matching (as both and are unsaturated). Some alternating paths include
These paths could be odd or even length, starting or ending with edges in or not in .
Definition
We say an alternating path is augmenting if it starts and ends at an unsaturated vertex.
Example
This has a (non-perfect) matching .
It has an augmenting path . We can construct a new (larger) matching by removing from every edge in and in the path, and add every edge not in and in the path.
This gives a larger matching.
Definition
We say a matching is maximal if there are no larger matchings.
Example
This matching is maximal, but not perfect.
Fact
If there exists a perfect matching, then the perfect matching is maximal.
Theorem
A matching is maximal if and only if there is no augmenting path.
Equivalently,
A matching is not maximal if and only if there exists an augmenting path.
Algorithm to find maximal matching
-
Find an augmented path
-
Augment matching and repeat until we can’t find an augmenting path.
Example
This is a maximal matching.
Proof
Assume there exists an augmenting path. This allows us to create a larger matching using the augmenting path. Hence was not maximal.
Assume is a matching that is not maximal. Let be a larger matching. Consider .
In this case, the path corresponds to an augmenting path in .
This construction creates a number of paths that are all alternating paths. At least one of these paths will be augmenting (Not advice, but worth thinking about).
Covers
Definition
A cover is a set of vertices such that every edges has at least one end in .
Example
Both and are covers.
Lemma
Let be a matching of and be a cover of . Then .
Proof
For each edge we must have either or . As matchings are disjoint, each edge must contribute to a different . Hence .
Example
In the above, , , , is a matching of size , and and are covers of size .
This proves is a maximal matching and is a minimal cover.
Lemma
If , then is a maximal matching and is a minimal cover.
Example
We need not have equality. Consider
Here for all covers and all matchings.
It turns out (next topic), that if is bipartite then we can achieve equality.
König’s Theorem
Theorem
Let be a bipartite graph, then the size of a maximal matching is equal to the minimal size of a cover.
Before proving this result we will first recall how to find a maximal matching.
Step 1 Find any matching
Step 2 Find an augmenting path and augment
Step 3 Repeat Step as necessary
Step 4 If we cannot find an augmenting path we are done.
Note
-
Augmenting paths go from unsaturated vertices to unsaturated vertices
-
Augmenting paths are odd length
-
Odd length paths in bipartite graphs have one end in and one end in .
Example
unsaturated vertices in .
unsaturated vertices in .
vertices in connected to by an alternating path
vertices in connected to by an alternating path
Notice hence there exists an augmenting path (say ). We can use this to construct a better matching.
Repeat this process on the new graph
Notice , the empty set.
This tells us that is a maximal matching.
Theorem
Let be a maximal matching as before.
Let . Then is a cover and .
Looking at the graph from previous example.
Notice we can rearrange the graph in the following way
Observations
-
There are no edges from to (proved before)
-
There are no edges in from to
-
-
Proof of 2
Assume there is a matching from to . Every vertex in has an alternating path to .
This path starts with an edge not in the matching. Hence any vertex connected to a vertex in by a matching has an alternating path to . Hence it is in . Hence not in .
Proof of 3
Every vertex in is connected to a matching (since assuming maximal matching). All of this matching must go to (as they can’t go to ). Hence .
Proof of 4
A similar argument shows is less than or equal to .
Every vertex in is connected to (otherwise in )
Hence
Last Part
We can partition the matching into two parts. Those from to which has size and those from to with size .
Hence, this has the same size as the cover.
Example
path .
path
Note on König’s Theorem
-
The process of creating and is called the construction
-
The course notes and other sections used unsaturated vertices.
-
We use and for the unsaturated vertices in and .
I.e.
Applications of König’s Theorem
Theorem (Hall's)
Let be bipartite, with partitions and . If is a matching, then
(Every edge in the matching has one end in and one end in ).
For some graphs, this is a strict inequality.
Question
When do we get equality?
Notation
Let . We define
Example
Theorem
Let be bipartite (with respect to and ). There exists a matching that saturates every vertex in if and only if for all .
Example
Notice if
Then
We have
As there exists a with , there does not exist a matching saturating .
Proof
Assume there exists a matching which saturates .
Take to be any subset.
Every vertex is connected to some edge in the matching.
Every one of these edges is connected to a different vertex in .
Every vertex in connected to by a matching in is in . Hence .
Example
Proof
Assume that there does not exist a matching which saturates all of . We wish to find a such that .
Let be a matching of maximal size. There will be unsaturated vertices in . I.e. .
Construct and as before. We have , have .
Take .
From Monday, there are no matchings from to .
Further, there are no edges from to .
Perfect Matchings in Bipartite Graphs
Theorem
Let be a regular bipartite graph with . Then has a perfect matching.
Recall
A perfect matching is a matching which saturates every vertex.
Observation 1
We see the number of edges in and . Hence .
Proof
We will show for all that , which will prove the result.
Assume for a contradiction that there exists a with . We count the edges from to in two different ways.
We see there are edges from to (as every vertex has edges).
We see that we have at most edges from to (as every vertex has edges some of which go to ).
Hence
This is a contradiction. Hence there is a perfect matching.
Example regular
Edge-Colouring
Definition
Let be a graph. We say it has a -edge colouring if there is an assignment of colours to the edges such that edges of the same colour never touch.
I.e. each colour is a matching.
Example
This is a edge colouring of
Exercise
Let be a graph that is edge-colourable. Then for all .
Note
For any colour, the set of edges of that colour is matching (regular graph).
Theorem
Let be bipartite, and let . Then has a edge colouring.
Method
-
Find a matching of maximal size that saturates all of with .
-
Colour this matching, remote it and repeat.
This includes
Find a matching of maximal size that saturates .
Remove and repeat.
includes .
Remove and repeat.
includes
Thus we have,
If we can do step , then it is easy to see how step can be used to find the edge-colouring.
Proof
Let and . Let be a matching that is maximal and saturates the maximal amount of . If this matching saturates we are done. Assume that there is some vertex in left unsaturated. We can assume that it is in .
Construct
unsaturated vertices in . Non-empty by assumption.
vertices with alternating paths to starting in .
vertices with alternating paths to starting in .
Fact
All have .
Assume that it is not true. We have an alternating vertex from , starting with an edge in and ending in .
We replace edges in this path so that those in are not in and those not in are now in .
This saturates more things in . A contradiction.
Fact
If , then there exists with .
As this is a maximal matching, all vertices in are not unsaturated. Hence they are connected to a matching. Further, there are no matchings from to (proved earlier). Hence they connect to .
This tells us in size.
Consider the set of edges from to .
Hence
Hence
As everything in has a matching to connecting in , we get everything in has a matching. Hence is saturated.