It's just dots and lines
Consider the following graph:
The vertex set is {A,B,C,D,E}
The edge set is {AB,AE,BC,CE,ED}
Yes! A graph is connected if for any two vertices u and w, there is a list of vertices u,v1,v2,…,vk,w such that each consecutive pair in the list is adjacent in the graph.
What does connected mean? Is this graph connected?
An extremely useful way to represent a graph is called the adjacency matrix. This is the matrix with rows and columns labeled by the vertices (in the same order). The matrix has a 1 if the row and column indices are adjacent, and zero otherwise.
x0=10000 or x0=00010
Consider the previous algorithm starting with:
The graph is connected!
How many edges do we need to delete to make it disconnected?
The graph has 16 edges, so we could delete each edge, then test again...
There are 120 pairs of edges, so we could delete each pair and test again...
What if that fails?
For a graph with vertices v1,v2,v3,…,vn the adjacency matrix A is given by
Ai,j={10vi is adjacent to vj,otherwise.
The degree of vertex vi, denoted d(vi) is the number of edges incident with vi, that is d(vj)=i=1∑nAi,j.
The Laplacian is the n×n matrix L given by
Li,j={d(vi)−Ai,ji=j,i=j.
Consider the previous example:
For any vector x∈Rn we have
x⊤Lx=[x1 x2 x3 ⋯ xn]L1,1L2,1L3,1⋮Ln,1L1,2L2,2L3,2⋮Ln,2L1,3L2,3L3,3⋯⋯⋯⋱⋯L1,nL2,n⋮⋮Ln,nx1x2x3⋮xn
=i=1∑nj=1∑nxixjLi,j=i=1∑nxi2Li,i−i=1∑nj=1∑nxixjAi,j
d(v1)−A2,1−A3,1⋮−An,1−A1,2d(v2)−A3,2⋮−An,2−A1,3−A2,3d(v3)⋯⋯⋯⋱⋯−A1,n−A2,n⋮⋮d(vn)
=i=1∑nxi2j=1∑nAi,j−i=1∑ni=1∑nxixjAi,j=i=1∑nj=1∑n(xi2−xixj)Ai,j
Thus, since Ai,j=Aj,i we have
x⊤Lx=i=1∑nj=1∑n(xi2−xixj)Ai,j=i=1∑nj=1∑n(xj2−xixj)Ai,j
Hence
x⊤Lx=21i=1∑nj=1∑n(xi2−2xixj+xj2)Ai,j=21i=1∑nj=1∑n(xi−xj)2Ai,j.
For which vectors x is it the case that
x⊤Lx=21i=1∑nj=1∑n(xi−xj)2Ai,j=0?
This occurs if and only if xi=xj for all i and j such that Ai,j=1.
Thus, x⊤Lx=0 if and only if x is "constant on connected components".
In particular,
Lx=0 ⇒ x⊤Lx=0 ⇒ x is constant on connected components.
Example
For this vector Lx=0:
For a connected graph:
Instead of Lx=0, we look for x=0 such that Lx=λx for the smallest λ.
w/ λ=0.3033351
A=
Definition 1.1.2. A graph G is a triple consisting of a vertex set V(G), an edge set E(G), and a relation that associates with each edge two vertices (not necessarily distinct) called its endpoints.
Example. Note that the vertex set is {v1,v2,v3,v4,v5} and the edge set is {e1,e2,e3,e4,e5}.
The endpoints of e4 are v3 and v4.
Example. The vertex set is {v1,v2,v3,v4,v5} and the edge set is {e1,e2,e3,e4,e5,e6}.
Both e1 and e6 have endpoints v1 and v2, thus they are multiple edges.
Example. Note that the vertex set is {v1,v2,v3,v4,v5} and the edge set is {e1,e2,e3,e4,e5,e6,e7}.
The edge e7 has only one endpoint, this type of edge is called a loop.
If u and v are endpoints of an edge, they are adjacent and are neighbors, and we write u↔v
A graph without multiple edges and without loops is called a simple graph.
In a simple graph we can name the edges by their endpoints:
In the following graph, the edge set is {v1v2,v1v3,v2v4,v3v4,v4v5}
Definition 1.1.8.
Example.
G
G
{v2,v3,v5} is a clique in G
{v2,v3,v5} is an independent set in G
Example 1.1.7. Consider a group of 5 people. Is there always a group of three who are all mutual acquaintances or mutual strangers? In other words, for every simple graph on 5 vertices G, does either G or G contain a clique of size 3?
G
G
What about in a group of 6 people?
Definition 1.1.10. A graph G is bipartite if V(G) is the union of two disjoint (possibly empty) independent sets called partite sets of G.
Example.
Definition 1.1.15.
Path
Path
Cycle
Cycle
Neither
Definition 1.1.16.
Example. The red vertices and edges are a subgraph. This subgraph is a path.
Example.
Consider the simple graph with
V(G)={a,b,c,d,e}andE(G)={ab,bc,cd,ac,ae}
Consider the graph H where V(H)={a,b,c,d,e}andE(H)={bc,cd,de,bd,ba}.
Definition 1.1.17. Let G be a loopless graph with vertex set V(G)={v1,…,vn} and edge set E(G)={e1,…,em}. The adjacency matrix of G, written A(G) is the n×n matrix with entry in row i, column j is the number of edges in G with endpoints {vi,vj}. The incidence matrix M(G) is the n×m matrix in which the entry in row i, column j is 1 if vi is an endpoint of edge ej, and zero otherwise.
If vertex v is an endpoint of edge e, then v and e are incident. The degree of a vertex (in a loopless graph) is the number of incident edges.
Example. Consider the simple graph with
V(G)={a,b,c,d,e}andE(G)={ab,bc,cd,ac,ae}
A(G)=0110110100110100010010000
M(G)=1100001100001101010010001
A(G1)=011000100100100011010000001000001000
A(G2)=011100100000100010100001001000000100
Definition 1.1.20. An isomorphism from a simple graph G to a simple graph H is a bijection f:V(G)→V(H) such that uv∈E(G) if and only if f(u)f(v)∈E(H). We say that "G is isomorphic to H", written G≅H, if there is an isomorphism from G to H.
Consider the simple graph G with V(G)={a,b,c,d,e} and E(G)={ab,bc,cd,ac,ae}
Consider the simple graph H with V(H)={a,b,c,d,e} and E(H)={bc,cd,de,bd,ba}.
The function f:V(G)→V(H) such that
f(a)=b
f(b)=c
f(c)=d
f(d)=e
f(e)=a
is an isomorphism from G to H.
Proposition. If f is an isomorphism from G and H, then for any v∈V(G) the degrees of v and f(v) are the same. Moreover, if
d1,d2,…,dnandd1′,d2′,…,dn′
are the lists of the degrees of their vertices of G and H, respectively, listed in nonincreasing order, then these lists are identical.
Proof. Consider a vertex v∈V(G) with degree d. This means that there are d other vertices v1,v2,…,vd that are adjacent to v, that is vvi∈E(G) for each i∈{1,2,…,d}. By the definition of an isomorphism, the vertices adjacent to f(v) are exactly f(v1),…,f(vd). Thus f(v) has degree d. □
Example. None of the following graphs are isomorphic:
Definition. A permutation matrix is a square matrix with entries in {0,1} and exactly one 1 in each row and each column.
Example. Some permutation matrices:
[1001]
100010001
010100001
01001000000 10010
Multiplying a matrix by a permutation on the left permutes the rows:
001100010adgbehcfi= dgaehbfic
Multiplying a matrix by a permutation on the right permutes the columns:
adgbehcfi001100010= c fiadgbeh
Rows: (1,2,3)↦(3,1,2)
Columns: (1,2,3)↦(2,3,1)
010001100adgbehcfi001100010=ic fgadhbe
1
2
3
1
2
3
If we multiply by P on the right and P⊤ on the left, then we permute the rows and columns in the same way:
Isomorphism: (1,2,3)↦(2,3,1)
010001100011100100001100010=010101010
Consider permuting the rows and columns of an adjacency matrix:
Theorem. Two simple graphs G and H are isomorphic if and only if there is a permutation matrix P such that
A(H)=P⊤A(G)P.
Thus, if we can find a permutation matrix such that A(H)=P⊤A(G)P, we can conclude G and H are isomorphic. If G and H are not isomorphic, it is harder to prove.
Definition 1.1.25. An isomorphism class of graphs is an equivalence class of graphs under the isomorphism relation.
Example. Every simple graph on 2 vertices is isomorphic to one of the following:
So, there are two isomorphism classes of graphs on 2 vertices.
Example. How many isomorphism classes are there on 3 vertices?
The "structural" properties of a graph are the same for all isomorphic graphs. For example, number of edges, number of vertices, degree of vertices (already proven), sizes of cliques, sizes of independent sets, etc.
independent set of size 4
NO independent set of size 4
≅
Definition 1.2.2.
Lemma 1.2.5. Every u,v-walk contains a u,v-path.
Proof. (On the board)
Example. A walk with a repeated vertex:
Definition 1.2.6. A graph is connected if for every pair of vertices u and v, there is a u,v-path contained in the graph. Otherwise, we say that the graph is disconnected.
If G has a u,v-path, then we say that u is connected to v in G.
Definition 1.2.8. The components of a graph G are its maximal connected subgraphs. A component is trivial if it has no edges otherwise it is nontrivial. An isolated vertex is a vertex of degree 0.
Proposition 1.2.11. Every graph with n vertices and k edges has at least n−k components.
Note, if a graph G contains a u,v-path and a v,w-path, it is not clear that G contains a u,w-path. However, if we concatenate these paths, then we get a u,w-walk which contains a u,w-path by Lemma 1.2.5. Thus, the connection relation on vertices is transitive. It is also reflexive (vertices are connected to themselves), and symmetric (since paths are reversible).
Proof. Adding an edge to a graph decreases the number of connected components by at most 1. □
Definition 1.2.12.
Cut-edges: ab
Cut-vertices: b,d
If T={a,b,c,e,f} then G[T] is shown in red.
Theorem 1.2.14. An edge is a cut-edge if and only if it belongs to no cycle.
Proof. (On the board)
Note that this theorem is the statemet that the following two implications about an edge e in a graph G both hold:
e is a cut-edge ⇒ e belongs to no cycle
and
e belongs to no cycle ⇒ e is a cut-edge
Given an implication A⇒B, it is often useful to consider the equivalent statement ∼B⇒∼A, which is called the contrapositive. (Here ∼A is the statement "A does not hold".)
Thus, we could instead prove the contrapositives of the above implications
e belongs to a cycle ⇒ e is not a cut-edge
and
e is a not a cut-edge ⇒ e belongs to a cycle
Is there a path that crosses all 7 bridges exactly once?
Is there a path that crosses all 7 bridges exactly once?
Is there a path that crosses all 7 bridges exactly once?
Definition 1.2.24.
Lemma 1.2.25. If every vertex of a graph G has degree at least 2, then G contains a cycle.
Theorem 1.2.26. A graph G is Eulerian if and only if it has at most one nontrivial component, and all its vertices have even degree.
Proof idea. By Lemma 1.2.25 the graph G contains a cycle. If we delete all the edges in that cycle, then new graph has fewer edges, but each vertex still has even degree. Thus, we can use induction on the number of edges. (Details are on the board and in the text.)
Proof. (On the board and in the text.)
Consider a path P in a graph G. If there is another path Q=P such that P⊆Q⊆G, then we call Q an extension of P. Since G only has finitely many vertices, we cannot extend a path forever. If a path P⊆G has no extension, then we call P a maximal path.
Proposition 1.2.27. Every even graph decomposes into cycles.
Proposition 1.2.28. If G is a simple graph in which every vertex has degree at least k, then G contains a path of length at least k. If k≥2, then G contains a cycle of length at least k+1.
Proposition 1.2.29. Every graph with at least one nonloop edge has at least two vertices that are not cut vertices.
Theorem 1.2.33. For a connected nontrivial graph with exactly 2k odd vertices, the minimum number of trails that decompose it is max{k,1}.
Note: This "decomposition" is a partition of the edges. The cycles may share vertices. Indeed, every vertex of degree ≥2 must be in more than one cycle.
Definition 1.3.1.
1
1
2
2
2
4
Δ(G)=4 and δ(G)=1
Example.
Definition 1.1.36. The Petersen graph is the simple graph with vertices consisting of all 2-element subsets of {1,2,3,4,5}, that is,
V(G)={{1,2},{1,3},{1,4},{1,5},{2,3},{2,4},{2,5},{3,4},{3,5},{4,5}},
and two vertices are adjacent if the sets are disjoint.
Note that
Δ(G)=δ(G)=3
Thus, the Petersen graph is 3-regular.
Definition 1.1.27.
Definition 1.3.2.
Proposition 1.3.3. (Degree-Sum Formula) If G is a graph, then
v∈V(G)∑d(v)=2e(G).
Proof. Recall that d(v) is the number of edges with endpoint v. Since each edge has two endpoints, adding up all the degrees we count each edge twice. □
Corollary 1.3.4. In a graph G, the average vertex degree is n(G)2e(G), and hence
δ(G)≤n(G)2e(G)≤Δ(G)
Corollary 1.3.5. Every graph has an even number of vertices of odd degree. No graph of odd order is regular with odd degree.
Corollary 1.3.6. A k-regular graph with n vertices has nk/2 edges.
Proposition 1.3.9. If k>0, then a k-regular bipartite graph has the same number of vertices in each partite set.
X
Y
Example. Consider the 2-regular bipartite graph below
Proof. Let X and Y be the partite sets, then e(G)=k∣X∣=k∣Y∣. Thus ∣X∣=∣Y∣. □
Delete vertex {i,j} and the vertices adjacent to it.
The remaining vertices are the two element sets that contain either i or j.
{i,k1},{i,k2},{i,k3}
and
{j,k1},{j,k2},{j,k3}
Cycle:
{i,k1},{j,k3},{i,k2},{j,k1}{i,k3},{j,k2}
# cycles ≥# vertices:
Consider a 6-cycle F in the graph.
Cycle:
{a1,b1},{a2,b2},{a3,b3},
{a4,b4},{a5,b5},{a6,b6}
# cycles ≤# vertices:
Two numbers i and j show up three times on this list.
Hence, this cycle is the one we obtained by deleting vertex {i,j} and its neighbors.
Proposition 1.3.11 For a simple graph G with vertices v1,…,vn and n≥3,
e(G)=n−21i=1∑ne(G−vi)anddG(vj)=n−21i=1∑ne(G−vi)−e(G−vj)
Conjecture 1.3.12. (Reconstruction Conjecture) If G is a simple graph with at least three vertices, then G is uniquely determined by it's list of vertex-deleted subgraphs.
A subgraph obtained by deleting a single vertex is called a vertex-deleted subgraph.
Examples.
Example. Consider the following vertex-deleted subgraphs:
What order 5 graph?
Example. Consider the graph G and its vertex-deleted subgraphs:
Proposition 1.3.13. The minimum number of edges in a connected graph with n vertices is n−1.
Proposition 1.3.15. If G is a simple graph with n vertices and δ(G)≥(n−1)/2, then G is connected.
Example 1.3.16. We wish to show that the inequality in Proposition 1.3.15 is sharp, that is, for any n there exists an n-vertex graph G such that δ(G)<(n−1)/2 and G is disconnected.
For even n consider Kn/2+Kn/2, for odd n consider K2n−1+K2n+1.
Definition 1.3.17. The union of two graphs G and H with disjoint vertex sets, is called their disjoint union or sum, and it is denoted G+H. The disjoint union of m copies of G is denoted mG.
Definition 1.3.27. The degree sequence of a graph is the list of vertex degrees, usually written in nonincreasing order d1≥⋯≥dn.
If d1,⋯,dn is the degree sequence of a graph G, then the vertex-sum formula implies ∑i=1ndi is even.
To be a degree sequence of a graph, it is necessary that ∑i=1ndi is even. Is this condition also sufficient?
w/o loops, but w/ multiple edges, things are more complicated:
Exercise 1.3.63. The nonnegative integers d1≥…≥dn are the vertex degrees of some loopless graph if and only if ∑i=1ndi is even and d1≤d2+…+dn.
With loops in our graphs, yes!
Proposition 1.3.28. The nonnegative integers d1,…,dn are the vertex degrees of some graph if and only if ∑i=1ndi is even.
Theorem 1.3.31. For n>1, an integer list d of size n is graphic if and only if d′ is graphic, where d′ is obtained from d by deleting the largest element Δ of d and subtracting 1 from each of its Δ next largest elements. The only 1-element graphic sequence is d1=0.
Definition 1.3.29. A graphic sequence is a list of nonnegative numbers that is the degree sequence of some simple graph.
What about degree sequences of simple graphs?
Example. The degree sequences of both graphs are 3,2,2,1,1,1
But these are not isomorphic graphs!
idd′1Δ=d12d2d2−13d3d3−1……Δ+1 dΔ+1 dΔ+1−1Δ+2dΔ+2dΔ+2…,…ndndn
idd′1Δ=d12d2d2−13d3d3−1……Δ+1 dΔ+1 dΔ+1−1Δ+2dΔ+2dΔ+2…,…ndndn
Example. Consider the sequence d=(3,3,2,1,1).
d=(3,3,2,1,1) ⇝ d′=(2,1,0,1)
d′=(2,1,1,0) ⇝ d′′=(0,0,0)
⇝
Reorder
d′=(2,1,1,0) ⇝ d′′=(0,0,0)
How to build d′ from d: Suppose d1≥⋯≥dn
The sequence d=(3,2,2,2,1) is graphic since:
Deleting degree 3 vertex →
So (2,1,1,0) is graphic, but why is d′=(1,1,1,1) graphic?
We want a graph with degree sequence (3,2,2,2,1) AND...
these vertices
this one's neighbors are...
Why does d graphic ⇒ d′ graphic?
vertices degreesv13v22v32v42v51
N(v1)={v2,v4,v5}
Modify the graph so that v3↔v1 and v5↔v1
BUT, keep degrees the same
v1
v2
v3
v4
v5
Add: v1v3
Delete: v1v5
Pick a vertex y:
y↔v3 and y↔v5
Delete: yv3
Add: yv5
v1
v2
v3
v4
v5
v1
v2
v3
v4
v5
Definition 1.4.2.
A directed graph or digraph G is a triple consisting of a vertex set V(G), an edge set E(G), and function assigning each edge an ordered pair of vertices. The first vertex in the ordered pair is the tail of the edge, and the second is the head; together, they are the endpoints. We say that an edge is from its tail to its head.
Example. Let V(G)={v1,v2,v3,v4,v5} and E(G)={e1,e2,e3,e4,e5,e6}
and the function that assigns edges to points is given by
f(e1)=(v1,v2),f(e2)=(v2,v3),f(e3)=(v3,v5)
f(e4)=(v4,v4),f(e5)=(v2,v1),f(e6)=(v3,v5)
Definition 1.4.3. In a digraph:
In a simple digraph:
Not simple!
Definition 1.4.6. A digraph G is a path if it is simple, and all of the vertices can be listed (without repetition) v1,v2,…,vn such that E(G)={v1v2 , v2v3 , v3v4 , … , vn−1vn}
A digraph is a cycle if it is simple, and all of the vertices can be listed (without repetition) v1,v2,…,vn such that E(G)={v1v2 , v2v3 , v3v4 , … , vn−1vn , vnv1}
Cycle
Path
Neither
P=010.10.900.10.100.8
Given a vector of nonnegative entries x=[xA xB xC] such that xA+xB+xC=1, we interpret xi as the probability that we're in state i
Then xP gives the probabilities that we're in each state after another step.
P=010.10.900.10.100.8
Let xn be the vector of probabilities after n steps.
If we start at A, then x0=[1 0 0], and
x1=x0P=[0 0.9 0.1]
x2=x1P=x0P2=[0.91 0.01 0.08]
x3=x2P=x0P3=[0.018 0.827 0.155]
x100=x0P100≈[0.410706 0.385357 0.203936]
⋮
Definition 1.4.17. Let v be a vertex in a digraph.
Proposition 1.4.18. In a digraph G, v∈V(G)∑d+(v)=e(G)=v∈V(G)∑d−(v).
Proposition 1.4.19. A list of ordered pairs of nonnegative integers is realizable as the degree pairs of a digraph if and only if the sum of the first coordinates equals the sum of the second coordinates.
Definition 1.4.22.
Lemma 1.4.23. If G is a digraph with δ+(G)≥1 or δ−(G)≥1, then G contains a cycle.
Theorem 1.4.24. A digraph is Eulerian if and only if d+(v)=d−(v) for each vertex v and the underlying graph has at most one nontrivial component.
Definition 1.4.9. The underlying graph of a digraph D is the graph G obtained by treating the edges of D as unordered pairs.
We have already seen that graphs are Eulerian if and only if they are even. What about digraphs?
Definition 2.1.1.
Forest
Tree
Tree
Each of these vertices is a leaf.
Lemma 2.1.3. Every tree with at least two vertices has at least two leaves. Deleting a leaf from an n-vertex tree produces a tree with n−1 vertices.
Theorem 2.1.4. For an n-vertex graph G (with n≥1), the following are equivalent:
A) G is connected and has no cycles, that is, G is a tree.
B) G is connected and has n−1 edges.
C) G has n−1 edges and no cycles.
D) For u,v∈V(G), G has exactly one u,v-path.
The next theorem give several alternate characterizations of graphs that are trees. Note that each of A, B, and C is the statement that two of the following hold: 1) G is acyclic, 2) G is connected, 3) G has n−1 edges.
Corollary 2.1.5.
a) Every edge of a tree is a cut edge.
b) Adding one edge to a tree forms exactly one cycle.
c) Every connected graph contains a spanning tree.
Proposition 2.1.6. If T and T′ are spanning trees of a connected graph G, and e∈E(T)−E(T′), then there is an edge e′∈E(T′)−E(T) such that T−e+e′ is a spanning tree of G.
Proposition 2.1.7. If T and T′ are spanning trees of a connected graph G, and e∈E(T)−E(T′), then there is an edge e′∈E(T′)−E(T) such that T′+e−e′ is a spanning tree of G.
Suppose T is a tree and G is a simple graph. What must be true about T and G to ensure that T is a subgraph of G.
If T has one vertex adjacent to all of the others, then T is called a star.
Clearly, T is a subgraph of G if and only if G has a vertex of degree e(T), that is, Δ(G)≥e(T).
Is is sufficient? No! P4 is not a subgraph of the star with 4 vertices.
What about δ(G)≥e(T)?
G
Not a subgraph of G
Subgraph of G
G
What about the other trees with 4 edges?
Proposition 2.1.8. If T is a tree with k edges, and G is a simple graph with δ(G)≥k, then T is a subgraph of G
T
T′
Call its neighbor u
u
u
Pick a leaf v
u
Delete v
Find T′ in G
Since dG(u)≥4
and dT′(u)≤3
∃v adj. to u, but not in T′
v
Proposition 2.1.8. If T is a tree with k edges, and G is a simple graph with δ(G)≥k, then T is a subgraph of G
Proof outline. Use induction on k:
Suppose that for some k≥1 the claim holds for trees with <k edges. Let G be a graph with δ(G)≥k, and let T be a tree with k edges.
Definition 2.1.9.
b
a
c
e
f
g
d(a,b)=1
d(a,c)=2
d(a,e)=3
d(a,f)=2
d(a,g)=1
d(a,a)=0
diamG=3
ϵ(a)=3
radG=3
Example.
Theorem 2.1.11. Suppose G is a simple graph. If diamG≥3, then diamG≤3.
Proof. Since diamG>2, there are two nonadjacent vertices u and v with no common neighbor.
Hence, for x∈V(G)−{u,v} either x↔u or x↔v.
Note that u and v are adjacent in G. And any other vertex x is adjacent to either u or v in G.
Therefore, for any two vertices, there is a path of lenghth at most 3 in G. □
Definition 2.1.12. The center of a graph G is the subgraph induced by the vertices of minimum eccentricity.
Theorem 2.1.13. The center of a tree is either a vertex (K1) or an edge (K2).
Proof. We use induction on the number of vertices in a tree T.
Inductive step:
Basis step: n(T)≤2, then T=K1 or K2 and the center is T.
If we want a graph with all vertices close together, then we want a small diameter.
On the other hand, if we want a graph where most vertices are close together, then we might want the average distsnce between points to be small. That is, if G is a graph with n vertices, then we want
n(n+1)2v,u∈V(G)∑dG(v,u)
to be small. Equivalently, we want the Wiener index:
D(G):=v,u∈V(G)∑dG(v,u)
to be small.
The next theorem gives us the extremes of this index among all trees.
Theorem 2.1.14. For trees with n vertices, the Wiener index is minimized by stars and maximized by paths, both uniquely. That is, if T is a tree with n vertices, then
(n−1)2≤D(T)≤(3n+1),
moreover, if D(T)=(n−1)2 then T≅K1,n−1 and if D(T)=(3n+1) then T≅Pn.
A weighted graph is a graph G together with a nonnegative number for each edge.
Our goals:
Find a minimum spanning tree: a spanning tree such that the sum of the edge weights is minimal
Find shortest path from u to v:
The path from u to v such that the sum of the edge weights is minimal.
Define the subgraph H with V(H)=V(G) and E(H)=∅.
While it's possible
Add an edge to H from E(G) that does not create a cycle in H, and has minimal weight among these.
Suppose G is a connected, weighted graph with n vertices:
End when no such edge exists
Theorem 2.3.3. In a connected weighted graph G, Kruskal's Algorithm constructs a minimum-weight spanning tree.
Suppose T∗ is a spanning tree of minimum weight. If T=T∗ then we're done.
Proof. First, we see that the output, which we call T, is a spanning tree
v
u
What is the shortest path from vertex v to vertex u?
Start with a list of distances 0 for v and ∞ for the rest.
More generally, take the distance between vertices d(u,v) to be the smallest sum of weights among all u,v-paths.
What is d(u,v)?
v
u
Start with a list of distances 0 for v and ∞ for the rest.
Step 1: Update tentative distances: t1(z)={0∞z=vz=v
Pick next vertex to visit: z1=v.
Step k>1: Update tentative distances: tk(z)=min{tk−1(zk−1)+w(zk−1z),tk−1(z)}.
Pick next vertex to visit: zk.
For each edge yz, let w(yz) denote the weight of the edge.
Step 1: Update tentative distances: t1(z)={0∞z=vz=v
Pick next vertex to visit: z1=v.
Given vertices vvv and uuu, define d(v,u)d(v,u)d(v,u) to be the minimum, over all v,uv,uv,u-paths, of the sum of the edge weights along the path.
Theorem 2.3.7. Given a graph G and a vertex v∈V(G), Dijkstra's Algorithm computes d(v,z) for each vertex z∈V(G).
v
u
For an unweighted graph, Dijkstra's algorithm is called a Breadth-First search.
However, we just take the next unvisited vertex that we've "seen" instead of the vertex with smallest tentative weight.
Definition 3.1.1.
Example.
The blue edges are a perfect matching
Are there other perfect matchings?
Example. If a graph has a vertex with degree 0, then it contains no perfect matching.
Give an example of a graph G such that δ(G)≥1, but no perfect matching?
The only star that contains a perfect matching is K2.
Stars!
Example 3.1.2. A perfect matching in Kn,n corresponds to a bijection of the partite sets.
If X={x1,x2,…,xn} and Y={y1,y2,…,yn} are the partite sets of vertices, then a bijection f:X→Y gives a perfect matching, namely, the edges xf(x) for each x∈X.
Conversely, given a perfect matching of edges, each edge has one endpoint in X and one in Y, thus, for each edge xy in the perfect matching, we can define a bijection g:X→Y by g(x)=y if and only if xy is in the perfect matching.
The number of bijections f:X→Y is n!, and thus there are n! perfect matchings in Kn,n.
Corresponding bijection:
f(x1)=y2
f(x2)=y1
f(x3)=y4
f(x4)=y5
f(x5)=y3
Example 3.1.3. Why is there no perfect matching in K3, K5, K7,…?
If G has a perfect matching, then the order of G must be even!
Does K2n have a perfect matching for each n∈N?
YES! The set of perfect matchings of K2n is in one-to-one correspondence with the partitions of {1,2,3,…,2n} into n subsets of size 2. How many such partitions are there?
2nn!(2n)!
Partition: {1,3}, {2,4}, {5,6}
Definition 3.1.4. A maximal matching in a graph is a matching that cannot be enlarged by adding an edge. A maximum matching is a matching of maximum size among all matchings in the graph.
Maximal matching
(not maximum):
Maximum matching:
Definition 3.1.6. Given a matching M, an M-alternating path is a path that alternates between edges in M and edges not in M. An M-alternating path whose endpoints are unsaturated by M is an M-augmenting path.
Definition 3.1.7. If G and H are graphs with a common vertex set V, then the symmetric difference G△H is the graph with vertex set V whose edges are all those appearing in exactly one of G and H. We similarly define the notion of symmetric difference for sets of edges.
Lemma 3.1.9. Every component of the symmetric difference of two matchings is a path or an even cycle.
△
△
=
=
Theorem 3.1.10. A matching M in a graph G is a maximum matching in G if and only if G has no M-augmenting path.
Consider the matching M in blue
the M-augmenting path P in red
and...
Replacing M with every other edge in P we obtain a matching with more edges:
Thus, if M is a maximum matching, then there is no M-augmenting path.
Given a bipartite graph G, and one of the partite sets X, one might ask whether there is a matching that saturates X.
Consider the following graph:
The blue edges are a matching that saturates X:={x1,x2,x3,x4,x5}.
If S⊂X, then clearly the number of vertices adjacent to S must be ≥ the number of vertices in S.
Theorem 3.1.11. (Hall's Theorem) An X,Y-bigraph G has a matching that saturates X if and only if ∣N(S)∣≥∣S∣ for all S⊆X.
Recall:
Corollary (the Marriage Theorem). An X,Y-bigraph G contains a perfect matching if and only if both of the following hold:
Does the following bigraph have a perfect matching?
S
N(S)
Thus, the graph contains no perfect matching.
Corollary 3.1.13. For k>0, every k-regular bipartite graph has a perfect matching.
Does the following bigraph have a perfect matching?
Since it is 3-regular, by Corollary 3.1.13...YES!
Example. A group of 50 pets and 50 people meet one day and they decide whether they are compatible. Each pair decide whether they are mutually compatible.
At the end, each person is compatible with 10 of the pets, and each pet is compatible with 10 of the people.
Is there a way to match all 50 people compatible pets?
Definition 3.1.14. A vertex cover of a graph G is a set Q⊆V(G) that contains at least one endpoint of every edge. We say that the vertices in Q cover E(G).
Example. In each of the following graphs, the blue vertices comprise a vertex cover:
blue
Theorem 3.1.16. If G is a bipartite graph, then the maximum size of a matching in G equals the minimum size of a vertex cover of G.
This is an example of a min-max relation since it establishes the equivalence between a maximization problem and a minimization problem.
Theorem 3.1.16. If G is a bipartite graph, then the maximum size of a matching in G equals the minimum size of a vertex cover of G.
Extra vertex
One vertex in Q for each edge in M.
Proof. First, we show that if Q is any vertex cover, and M is a maximum matching, then ∣Q∣≥∣M∣. Therefore, a vertex cover of minimum size has at least as many vertices as the number of edges in a maximum matching.
Proof. Suppose X and Y are the partite sets in G. Let Q be a vertex cover of minimum size.
Theorem 3.1.16. If G is a bipartite graph, then the maximum size of a matching in G equals the minimum size of a vertex cover of G.
We'll use Hall's theorem to find a matching in H that saturates R and a matching in H′ that saturates T.
Since Q=T∪R, together these matchings give a matching in G of size ∣Q∣.
Proof. For each S⊆R we consider NH(S).
Theorem 3.1.16. If G is a bipartite graph, then the maximum size of a matching in G equals the minimum size of a vertex cover of G.
If ∣NH(S)∣<∣S∣, then we could replace S with NH(S) in Q to obtain a smaller vertex cover.
The union of the matchings in H and H′ is a matching with ∣Q∣ edges in it. □
Since Q is minimum size, we see ∣NH(S)∣≥∣S∣.
The same argument shows Hall's condition holds in H′.
Definition. The independence number of a graph is the maximum size of an independent set of vertices.
Is the independence number of a tree equal to the number of leaves?
Is the independence number of a tree ≥ the number of leaves?
No!
No! Consider P2
Is the independence number of a bipartite graph equal to the size of one of the partite sets?
No!
Definition 3.1.19. An edge cover of a graph G is a set of edges such that every vertex of G is incident to some edge of L.
How many edges are in the smallest edge cover of the following graph?
5 edges!
Lemma 3.1.21. In a graph G, a subset S⊆V(G) is an independent set if and only if S is a vertex cover, and hence α(G)+β(G)=n(G).
Theorem 3.1.22. If G is a graph without isolated vertices, then α′(G)+β′(G)=n(G).
Definition 3.1.20.
Theorem 3.1.24. If G is a bipartite graph without isolated vertices, then α(G)=β′(G).
Proof. We have the following equivalent statements:
Theorem 3.1.22. If G is a graph without isolated vertices, then α′(G)+β′(G)=n(G).
Definition 3.1.20.
Proof that α′(G)+β′(G)≤n(G).
Theorem 3.1.22. If G is a graph without isolated vertices, then α′(G)+β′(G)=n(G).
Definition 3.1.20.
Proof that α′(G)+β′(G)≥n(G).
⎩⎨⎧G - an X,Y-bigraphM - a matching in GU= verts in X unsat. by M
Inputs:
Initialize:
⎩⎨⎧S=UT=∅K=∅
Iteration: If K=S then by the next theorem T∪(X−S) is a minimum cover, and M is a maximum matching.
If K⊊S, the select x∈S−K. Go through each y∈N(x) such that xy∈/M.
Note: S⊆X, T⊆Y and K⊆S is the "marked vertices".
After all y's have been explored, add x to K.
Example.
We see x6y5∈/M but y5 is unsat. Since x6 is in S, there is an M-alternating path from U to x6, extend this path to y5 for an M-augmenting path!
S={x1,x2,x3,x4,x5,x6}
T={y1,y2,y3}
K={x1,x2,x3,x4,x5}
S={x1,x2,x3,x4,x5}
T={y1,y2}
K={x1,x2,x3,x4}
S={x1,x2,x3,x4,x5}
T={y1,y2}
K={x1,x2,x3}
S={x1,x2,x3,x4}
T={y1}
K={x1,x2}
S={x1,x2,x3,x4}
T={y1}
K={x1}
S=U={x1,x2,x3}
T=∅
K=∅
Example.
A bigger matching!
Theorem 3.2.2. Repeatedly applying the Augmenting Path Algorithm to a bipartite graph produces a matching and a vertex cover of equal size.
Theorem 3.1.16. If G is a bipartite graph, then the maximum size of a matching in G equals the minimum size of a vertex cover of G.
Recall the König-Egerváry Theorem:
Hence, the Augmenting Path Algorithm gives a maximum matching and a minimum vertex cover in a bipartite graph.
Definition 4.1.1.
Example. Consider the complete graph Kn. Deleting a vertex results in Kn−1, which is also connected. So Kn has no separating set.
Thus, we say κ(Kn)=n−1.
Example. What about Km,n?
If X and Y are a bipartition of the graph, then any separating set must contain either X or Y, thus, κ(Km,n)=min{m,n}.
In this section all graphs have no loops.
Lemma. κ(G)≤δ(G)
Proof. Let v∈V(G) be a vertex with degree δ(G). Clearly NG(v) is a separating set or G−NG(V) is a single vertex. Thus κ(G)≤∣NG(v)∣=δ(G). □
Given a graph G on n vertices which is k-connected, how many edges must G have?
Clearly, we must have δ(G)≥k, and hence every vertex of G must have degree ≥k.
By the degree-sum formula:
e(G)=21v∈V(G)∑d(v)≥21nk.
Since e(G) is an integer, we have the following:
Proposition. If G is a k-connected graph on n vertices, then G has at least ⌈nk/2⌉ edges.
Definition (see Example 4.1.4.). Given 1<k<n the graph Hk,n has n vertices placed equidistant around a circle, each vertex is connected to the ⌊k/2⌋ vertices closest to it in each direction around the circle.
If k is odd and n is even, add an edge between antipodal vertices as well.
If k is odd and n is odd, label the vertices {0,1,2,…,n}, and add an edge between vertices i and i+(n−1)/2 for i=0,1,…,(n−1)/2.
The graphs H4,8, H5,8, and H5,9 are shown here:
Theorem 4.1.5. κ(Hk,n)=k, and hence the minimum number of edges in a k-connected graph on n vertices is ⌈kn/2⌉.
Theorem 4.1.5. κ(Hk,n)=k, and hence the minimum number of edges in a k-connected graph on n vertices is ⌈kn/2⌉.
Since δ(Hk,n)=k we see that κ(Hk,n)≤k.
H4,10 is shown here:
Similar proofs work with k is odd
Definition 4.1.7.
Disconnecting set
Not an edge cut
Edge cut
Disconnecting set
Disconnecting set
Not an edge cut
Note: A minimal disconnecting set is an edge cut.
Theorem 4.1.9. If G is a simple graph, then
κ(G)≤κ′(G)≤δ(G).
Given disconnecting set F⊆E(G), we can delete one endpoint for each edge in F to disconnect the graph, right?
We conclude there is a vertex cut S with ∣S∣=∣F∣, and thus κ(G)≤κ′(G), right?
The edges in blue are a disconnecting set.
If we delete the red vertices...
the graph is still connected.
So, is it true that κ(G)≤κ′(G)?
Theorem 4.1.9. If G is a simple graph, then
κ(G)≤κ′(G)≤δ(G).
Proof. The set of edges incident with a vertex of degree δ(G) is an edge cut, thus κ′(G)≤δ(G).
Thus, we must show κ(G)≤κ′(G):
How many colors do we need so that every bordering territory is a different color?
How many colors do we need so that every bordering territory is a different color?
Four colors
How many "colors" do we need so that we can color each vertex and no adjacent vertices are the same color?
Definition 5.1.1.
Proposition. A graph is 2-colorable if and only if it is bipartite.
Proposition. C5 is not 2-colorable.
Proof. Assume toward a contradiction there exists a proper 2-coloring f : V(G)→{1,2}. Label the vertices {0,1,2,3,4} such that i and j are adjacent if and only if i−j≡±1 (mod 5). By the pigeonhole principle, at least 3 vertices are labeled the same color. Let these vertices be a,b,c where 0≤a<b<c≤4. Note that b≥a+2 and c≥b+2. Therefore 4≥c≥a+4≥4. We conclude a=0 and c=4, and since 0−4≡1 (mod 5), we see a↔c. Thus f is not a proper coloring, which is a contradiction. □
Definition 5.1.6. The clique number of a graph G, written ω(G), is the maximum size of a set of pairwise adjacent vertices (a clique) in G.
Theorem 5.1.7. For every graph G,
χ(G)≥ω(G)andχ(G)≥n(G)/α(G).
Theorem 5.1.13. χ(G)≤Δ(G)+1.
Proof. Label the vertices v1,v2,…,vn. In order, label each vertex vi with the smallest label not used on a neighbor with an index smaller than i (this is just the greedy algorithm). One will never use more than Δ(G)+1 colors. □
Proof. A proper coloring of a clique on k vertices requires k colors. Thus, the first inequality is clear.
Each color class is an independent set. Let V1,…,Vχ(G) be the color classes of a minimum proper coloring, then ∣Vi∣≤α(G), and χ(G)α(G)≥∣V1∣+∣V2∣+⋯+∣Vχ(G)∣=n(G). □
Example. Consider the join of C5 and K3, which is denoted C5∨K3 (see Definition 3.3.6)
Note that χ(C5)=3 and χ(K3)=3
Since C5 contains no triangles, we see that ω(C5∨K3)=5.
We cannot use any of the same colors in C5 and K3, thus χ(C5∨K3)=6.
Theorem 5.1.13. χ(G)≤Δ(G)+1.
Proposition 5.1.14. If a graph G has degree sequence d1≥d2≥⋯≥dn,
then χ(G)≤1+maximin{di,i−1}.
Proof. Use the greedy algorithm on the vertices, but listed in nonincreasing order by degree. □
Example. Consider the graph G below:
Example 6.1.1. Alice, Bob, and Chris each need to hook up gas, water, and electricity to their homes. The hookups don't need to be straight, but the lines cannot cross. Can it be done?
In other words, can we draw the graph of K3,3 in the plane without the edges crossing?
We still need to hook Chris up to gas!
Proposition 6.1.2. The graphs K5 and K3,3 cannot be drawn in the plane without edges crossing.
Proof. First, consider K3,3:
The proof that K5 cannot be drawn without crossings is similar.
Definition 6.1.4.
Definition 5.2.19. A subdivision of G is a graph obtained by successively replacing edges with paths. That is, an edge xy∈E(G) is replaced with the path x,z1,…,zn,y, where the new vertices z1,…,zn are only adjacent to the adjacent vertices in the path.
G
subdivision of G
Proposition 6.2.1. If a graph G has a subgraph that is a subdivision of K5 or K3,3, then it is nonplanar.
Theorem 6.2.2. A graph is planar if and only if it does not contain a subdivision of K5 or K3,3.
Proof. If a subdivision of a graph is planar, then removing degree 2 vertices and replacing them with edges would result in a planar graph. Thus, if a subdivision of K5 or K3,3 were planar, then K5 or K3,3 would be planar, which they are not. □
Theorem 6.2.2. A graph is planar if and only if it does not contain a subdivision of K5 or K3,3.
Proof idea:
Theorem 6.1.21 (Euler's Formula). If a connected plane graph G has exactly n vertices, e edges, and f faces, then n−e+f=2.
Definition 6.1.5.
How many faces?
Don't forget the unbounded face
4
X
5
Theorem 6.1.21 (Euler's Formula). If a connected plane graph G has exactly n vertices, e edges, and f faces, then n−e+f=2.
Proof. Use induction on n:
Inductive step: Suppose G has n>1 vertices, e edges, and f faces.
2=(n−1)−(e−1)+f=n−e+f. □
Theorem 6.1.23. If G is a simple planar graph with at least 3 vertices, then e(G)≤3n(G)−6. If G is triangle free, then e(G)≤2n(G)−4.
Proof. Let F1,…,Ff be the faces of G. Let ℓ(Fi) be the number of edges on the boundary of face Fi. Each edge is counted twice, and thus 2e(G)=i=1∑fℓ(Fi).
Since G is simple and n(G)≥3, each face has at least 3 edges on it's boundary, and thus 2e(G)≥3f.
By Euler's formula f=2−n(G)+e(G), substituting this in the above inequality gives
2e(G)≥3(2−n(G)+e(G))=6−3n(G)+3e(G).
If G is triangle free, then 2e(G)≥4f, and hence 2e(G)≥4(2−n(G)+e(G))=8−4n(G)+4e(G). □
This face has 6 edges on its boundary
Theorem 6.1.23. If G is a simple planar graph with at least 3 vertices, then e(G)≤3n(G)−6. If G is triangle free, then e(G)≤2n(G)−4.
Example. Note e(K5)=10>9=3⋅5−6=3n(K5)−6, which implies K5 is not planar.
Similarly e(K3,3)=9>8=2⋅6−4=2n(K3,3)−4, and since K3,3 is triangle free, K3,3 is not planar.
Theorem 6.1.23. If G is a simple planar graph with at least 3 vertices, then e(G)≤3n(G)−6. If G is triangle free, then e(G)≤2n(G)−4.
Corollary. If G is simple and planar, then δ(G)≤5.
Proof. Assume toward a contradiction that δ(G)>5. For each v∈V(G) we have d(v)≥6. By the degree-sum formula we have 2e(G)≥6n(G).
By Theorem 6.1.23 3n(G)≤e(G)≤3n(G)−6.
This is a contradiction, and shows δ(G)≤5. □
Theorem 6.3.1. Every planar graph is 5-colorable.
Proof. We will use induction on n(G). For the basis step we note that any graph with n(G)≤5 is 5-colorable.
Next, suppose G is a planar graph with n(G)>5:
P1,3
Theorem 6.3.6. Every planar graph is 4-colorable.
Proof...
A wedding has n guests, but some refuse to sit at the same table.
How many tables are needed so that no one is sitting at a table with someone they hate?
Consider the graph on n vertices, labeled 1,2,3,…,n.
Draw an edge ij if guest i refuses to sit with guest j.
The chromatic number of this graph is the minimum number of tables needed.