Section 3: Graphs

3.1 - 3.3: Intro to Graphs, Graph Classes, and Vertex Degree

A simple graph is an ordered pair , where is a set of vertices, and is a set of edges, which are 2-size subsets of .

  • The number of vertices in the graph, , is the order.
  • The number of edges of the graph, , is the size.

We say two vertices are adjacent if (sometimes denoted ). We say an edge is incident to a vertex if is one of the endpoints of the edge.

A graph us a subgraph of if , and .

  • is said to be a spanning subgraph of if .
  • is a vertex induced subgraph of if whenever, , and , then . If , the subgraph induced by is denoted .

A -walk of a graph is a sequence of vertices beginning at , ending at , such that consecutive vertices are adjacent. We say the walk is closed if . The total (non-unique) edges traversed is the length of the walk.

  • A trail is a walk with no edge traversed more than once.
  • A path is a walk with no vertex traverse more than once.

A circuit is a closed trail of length 3 or more. A cycle is a circuit with only the first and last vertex repeated.


We say is connected if for any distinct vertices , there exists a path between them. Otherwise, is disconnected. A component of is a connected subgraph that is not a proper subgraph of any other connected subgraph (basically, each disconnected section of ).

The complement of , denoted , has vertex set and edge set

The graph with edges that are not present in !

The degree of a vertex , denoted , is the number of edges incident to . The minimum degree of is denoted , and the maximum degree is denoted .

Theorem

For any simple graph with size ,

The sum of the degrees must equal .


A graph is bipartite if vertex set can be partitioned into 2 subsets (partite sets) and such that every edge in has 1 endpoint in and 1 endpoint in .

Theorem: Properties of Bipartite Graphs

Graph is bipartite if and only if has no odd cycles.

A bipartite graph with partite sets , , is called a complete bipartite graph, denoted , if every vertex in is adjacent to every vertex in .

graph LR

subgraph A
1;
2;
3;
end

subgraph B
4;
5;
end

1 o--o 4 & 5;
2 o--o 4 & 5;
3 o--o 4 & 5;

A graph is d-regular if every vertex has degree , where is the minimum degree and is the maximum degree. In other words, all vertices have the same degree.

Theorem: D-Regular Graphs

There exists a d-regular graph on “n” vertices if and only if at least 1 or n$ is even.

Theorem:

For any graph , there exists a -regular graph , such that is an induced subgraph of .

An induced subgraph is a graph such that you can remove vertices (and all their edges) from and get the subgraph ! In other words, for any two vertices in , if they have an edge, then that edge must also be present in .

We do this as follows. For any graph, make a copy of it, and connect the respective vertices whose degree are less than . Continue making copies of that graph and connecting until all vertices have degree .

Given a graph on vertices, its degree sequence is a non-increasing sequence of length whose term is the degree of vertex .

We ask, given an arbitrary degree sequence, when does such a graph exist?

Theorem: Existence of Degree Sequences

Let be a non-increasing sequence. Then, there is a simple graph (no loops, no multiple edges) with this degree sequence (we call the sequence graphical) if and only if the sequence is graphical.

The second sequence we form is smaller! So, we can just keep repeating this algorithm down (and resorting) until our sequence is small enough that we can explicitly make a graph!

Example: Existence of a Graph with Degree Sequences

Such a degree sequence has a graph if and only if the following sequence also has a graph. Remove the first term, and subtract 1 from the remaining terms up to the th term. The rest are kept the same.

Repeat this.

It’s possible to make a graph here! So, our degree sequence does has a graph.

graph LR
1 o--o 2;
3;

3.4: Properties of Trees

A tree is a connected, acyclic (no cycles) graph. A leaf of a tree is a vertex of degree 1. A forest is an acyclic graph (a union of trees)

Theorem: Leaves of Trees

A tree on at least 2 vertices has at least 2 leaves.

Theorem: Properties of Trees

The following are equivalent:

  1. is a tree on vertices.

  2. is connected with edges.

  3. is acyclic with edges.

  4. There is a unique -path for any 2 distinct vertices and .

Theorem

The minimum edges in a connected graph on vertices is .

Proof (By Minimum Counterexample)

The idea of this is that if we could find a counterexample, then we can use it to find an even smaller counterexample— repeating the argument, we find it’s not possible to find a minimum counterexample.

Let be the smallest order graph that is connected on edges. It is easy to check .

We claim that has a leaf. If not, then there are no vertices of degree 1, so every vertex must have at least degree 2.

But that means , which violates our assumption of !

If is the leaf, then is connected on vertices with at most edges. This contradicts the minimality of of .

An edge is a bridge of a connected graph if (removing ) becomes disconnected.

denotes the graph without the edge .

Theorem

An edge is a bridge if and only if the edge is not in a cycle.

Corollary: By this, all edges in a tree are bridges.

Example

Let be a tree of order 13.

Suppose only has vertices of degree . If has 3 vertices of degree 2, how many leaves does it have?

Let be the number of leaves we have. Then,

3.5: Spanning Trees and Enumeration

In this section, we look at many types of trees and try to determine the closed form count of them.

A spanning tree of is a tree such that

In other words, all vertices are in the tree, but only enough edges are needed (to form a tree).

One question that we may ask is, how many spanning trees exist on vertices? In other words, how many spanning trees does have?

This depends on if we label our tree or not!

Example

Say . Then, for an unlabeled graph, we only have 1 tree.

The first question is generally unsolved.

graph LR
1[ ] o--o 2[ ] o--o 3[ ];

But for a labeled graph, we have 3 trees!

graph LR
1[1] o--o 2[2] o--o 3[3];
4[2] o--o 5[1] o--o 6[3];
7[1] o--o 8[3] o--o 9[2];

We say that two labeled trees are different if their edge set is different.

We construct a sequence of length where each value is an element of . Each sequence, called a Prufer Code, will correspond to a labeled tree on vertices

Tree to Prufer Code

  1. Delete the leaf of lowest index. Write down the index of the vertex adjacent to the leaf as part of the Prufer Code.
  2. Repeat until the graph reduces to an edge.

Prufer Code to Tree

  1. Let be our code. Let be the smallest index not in the code.
  2. Create the edge with and .
  3. Delete from the sequence and append to the end of the sequence.
  4. Let be the smallest number not in the sequence .
  5. Create the edge with and .
  6. Repeat the above until we’ve deleted all of the orginal sequence’s terms so that our final sequence is .
  7. Two values, and , will not be in the list . Create an edge joining to .

Cayley’s Formula

Lemma

If vertex has degree , then index will appear exactly times.

Theorem: Cayley's Formula

Each Prufer Code corresponds to a unique tree. Thus, there are labeled trees on vertices positions, choices for each).

Proof

It can easily be shown that a tree corresponds to one unique code, as the algorithm given is unambiguous.

We must now show that each code corresponds to one tree, unambiguously. This establishes a bijection and proves our result.

By induction on , the statement clearly holds for . Assume the statement holds up to some . Consider the sequence (). We show this corresponds to a unique tree.

Let be the first deleted leaf, so . Now consider the tree from deleting . This must correspond to sequence , and as this is of length , we apply our inductive hypothesis to conclude that this tree is unique. Thus, our tree with must also be unique as there is only one place to put it.

Corollary

It follows from this that because we know each vertex is in the sequence times, we can find the number of trees by performing permutations by repetition on the sequence with a given vertex repeated times.

Example

Let . What is the number of trees with degrees ?

Note that the labeling of the graph forces the vertices to have specific degrees.

graph LR
1;2;3[ ];4[ ];5[ ];6[ ];

1 o--o 2 & 3 & 4;
2 o--o 5 & 6;

Note that once we choose the indices adjacent to vertex 1, it determines the tree! So, we choose any 2 indices from , to get trees.

A plane-rooted tree is a rooted tree (1 vertex is the root, often drawn at the top) with a left-right ordering of the children.

graph TD
1[ ] o--o 2[ ] & 3[ ];
2 o--o 4[ ] & 5[ ];
3 o--o 6[ ] & 7[ ] & 8[ ];
graph TD
1[ ] o--o 2[ ] & 3[ ];
2 o--o 4[ ] & 5[ ] & 6[ ];
3 o--o 7[ ] & 8[ ];

The following two rooted trees are different!

Example

For , we have the number of rooted trees

graph TD
1[ ] o--o 2[ ] o--o 3[ ] o--o 4[ ];
5[ ] o--o 6[ ] o--o 7[ ] & 8[ ];
9[ ] o--o 10[ ] & 11[ ]; 10 o--o 12[ ];
13[ ] o--o 14[ ] & 15[ ]; 15 o--o 16[ ];
17[ ] o--o 18[ ] & 19[ ] & 20[ ];

What are the total plane rooted trees on vertices?

Consider a “walk” on the border of the tree, starting at the root, so that every edge is covered exactly twice, in a clockwise fashion. We are traversing the tree up or down such that the total times you move up can never exceed the times you move down! This is the same setup as the Catalan Number (discussed previously)!

So, the total plane rooted trees on vertices is the Catalan number!

Example

How many binary trees have internal vertices and leaves, with a left-right ordering?

For any , note that the number of trees is equivalent to

graph TD
1[ ] o--o 2[a i] & 3[a n-i];

So,

This is the recursive formula for Catalan Numbers!

A rooted forest is a forest where each component is a rooted tree, meaning one vertex is labeled as the root, and all vertices are labeled.

Example: Rooted Forest

For ,

graph TD
subgraph Graph1
1[1]; 2[2];
end

subgraph Graph2
3[1] o--o 4[2];
end

subgraph Graph3
5[2] o--o 6[1];
end

Note that 2 and 3 are repeats, because we could choose 1 as the root, or 2 as the root.

Consider a rooted forest on .

  • Take a new vertex, and for any rooted forest, join the vertex to all of the roots, to get a single labeled tree on .
  • For a labeled tree on , delete vertex . Then, the vertices adjacent to give us a rooted forest.

This is a bijection!

Theorem

The number of rooted forests on is equal to the number of labeled trees on . So,


Suppose there are cars driving on a 1 way street. Each car has a favorite parking spot (n total spots). Some cars may share the same favorite parking spot.

Each car first drives to its favorite spot. It parks in the spot if possible. If not, it drives to the next open spot. For the parking preferences, how many preferences are good: every car can park?

As an example, consider 3 cars. If they all prefer 2, then this is not good, since no car will park in spot 1.

Note that we have total cases.

We interpret each -tuple as a function . A function that parks all of the cars is a parking function.

Consider a circular parking lot with spots (and still cars). The cars park in the same manner, but now each continues looking for a spot even if they do not find one after spot . Now, among the preferences for each car, we have a parking function from the original problem exactly when spot is empty!

Consider an n-tuple which has spot open.

Will leave spot open! So, every spot has an equal chance of being empty! So the total parking functions (successful parking jobs) is

Interestingly, this is the number of rooted forests on vertices!

Theorem:

The total parking functions with cars and spots is which equals the total rooted forests on vertices.

Brief Intuition

How are these related?

Well, the total parking functions with cars, spots

Which is the number of rooted forests on .

Now, consider partitions forests into the component that vertex lies in. Pick with “i” indices will be in the component, in ways. Then, construct all of the forests with the vertices we’ve chosen. Connect the roots of these forests to , and pick a vertex in ways to be the root. Then, create all possible forests of the remaining elements.

3.6: Matchings

A matching is a set of edges such that there are no shared points (vertices).

The vertices incident to edges of a matching are said to be saturated. Otherwise, they are unsaturated. If every vertex is saturated, we have a perfect matching.

The size of matching , is equal to the number of edges. A matching is maximal if no more edges can be added to . It is maximum if it is the largest cardinality among all matchings in the graph.

Example: Maximal and Maximum Sets

graph LR
1 o--o 2 o--o 3 o--o 4;

The matching is maximal, but not maximum.

The matching is maximal and maximum!

Let be bipartite, with partite sets and . For non-empty set , the neighborhood of , denoted , is the union of all neighborhoods of the vertices in .

Neighborhoods in non-bipartite sets exist too, but they may include the original set.

Hall's Marriage Theorem

Suppose there are “r” women, “s” men, . There are “r” man-woman marriages if and only if for , , any subset of women are compatible with at least men.

Alternatively, let be partite sets, . Then, has a matching that saturates if and only if for all .

Example

graph LR

subgraph A 
1;2;3;
end

subgraph B;
4;5;6;
end

1 & 2 & 3 o--o 4;
3 o--o 5 & 6;

Note that , so . But , so . So, no matching can saturate .

Thus, it is easier to use the theorem to disprove that a matching exists, by finding a where .

Example

Let be a -regular bipartite graph.

If are the partite sets, then the total edges is , so the cardinality of the partite sets must be the same.

Let . Clearly, the total edges from to is .

Then, the total edges from to is at most .

So, so, satisfies Hall’s condition! So, any -regular bipartite graph as a matching saturating , and furthermore, as , this matching is perfect.

Theorem

Any -regular bipartite graph has a perfect matching.

We discuss ways we can apply Hall’s Theorem. In general, we try to form partite sets with edges, and apply Hall’s Theorem.

Let be (not necessarily distinct) sets.

The collection of sets has a system of distinct representatives (SDR) if there are “n” distinct elements such that

We create a bipartite set from this, and try to find a matching!

Example: SDRs

We can choose the following SDR: .

Recall that by Hall’s Theorem, the matching saturates if for all , . We can represent SDRs in terms of Hall’s Theorem to obtain some important conclusions!

We naturally define a bipartite graph with 1 partite set with nodes representing , and the other set with nodes representing . We create an edge if and only if .

Then by Hall’s theorem, we have an SDR if and only if for any union of sets , the cardinality is at least .

So to disprove an SDR, we can show the existence of sets such that the cardinality of their union is .

Example: Latin Squares

A Latin square is an array containing different symbols, each occurring exactly once in each row and column.

Say we are given an Latin rectangle. We ask, when can this rectangle be “completed” to an Latin rectangle? ()

Consider the partite sets

We adjacent to if and only if “i” can be placed in cell .

  • As there are m rows before row , we know that distinct symbols must have already been placed, so for any in , it has edges to .
  • Furthermore, with 1 distinct symbol in rows, this leaves columns (cells) remaining to fill with that distinct symbol. So, for any , it has edges to .

So in our partite sets, each element in either partite set has edges to the other set. Thus, our graph must be regular, and by an earlier example, every regular bipartite graph has a perfect matching. Thus, each cell in row can be uniquely matched with a symbol.

Thus, its always possible to extend the rectangle down further and add an extra row!

In a lot of these problems, we’re trying to smartly construct a graph to get a -regular bipartite graph! Then, we can apply Hall’s Theorem.