Graph Theory: Solved and
Unsolved Problems
Roger House
Scientific Café
Coffee Catz
Sebastopol, CA
2010 April 22
Copyright © 2010 Roger House
1
What we're going to talk about
• Graphs
– What's a graph?
– What's a graph good for?
• Graph problems
– The Königsberg bridge problem
– The planarity problem
– The Traveling Salesman Problem (TSP)
2
What's a graph?
3
Remember these graphs?
4
And these?
5
6
None of these graphs are the kinds of graphs we're interested in at the moment
7
We're going to deal with much different kinds of graphs, namely, mathematical graphs .
8
Definition: A graph G consists of a finite nonempty set V of vertices together with a set E of unordered pairs of distinct vertices of V. The pair e = {u,v} of vertices in E is called an edge of G.
9
There will be a quiz on the definition
10
There will be a quiz on the definition
But not on the one above
11
There will be a quiz on the definition
But not on the one above
On the one below
12
A friendlier definition
A graph is dots connected by lines .
13
Fancy terminology
The dots are called vertices .
(Or points , or nodes , or ...)
14
Fancy terminology
The dots are called vertices .
(Or points , or nodes , or ...)
The lines are called edges .
(The graph above has 7 vertices and 9 edges.)
15
Fancy terminology
The dots are called vertices .
(Or points , or nodes , or ...)
The lines are called edges .
(The graph above has 7 vertices and 9 edges.)
Two vertices connected by an edge are adjacent .
16
Fancy terminology
The dots are called vertices .
(Or points , or nodes , or ...)
The lines are called edges .
(The graph above has 7 vertices and 9 edges.)
Two vertices connected by an edge are adjacent .
An edge is incident with its two vertices.
17
Fancy terminology
The dots are called vertices .
(Or points , or nodes , or ...)
The lines are called edges .
(The graph above has 7 vertices and 9 edges.)
Two vertices connected by an edge are adjacent .
An edge is incident with its two vertices.
The degree of a vertex is the number of edges incident with the vertex.
18
Complete graphs
19
Bipartite graphs
20
More graphs
21
Yet more graphs
22
What's a graph good for?
23
24
Road network graph
The vertices in G are intersections, protection points, and entrance points.
Modeling an electrical circuit
26
#include structure
27
Function call graph
28
Unix family tree
29
Are there enough graphs?
# vertices # graphs
1 1
2 2
3 4
30
Are there enough graphs?
# vertices #graphs
1 1
2 2
3 4
4 11
31
Are there enough graphs?
# vertices #graphs
1 1
2 2
3 4
4 11
5 34
32
Are there enough graphs?
# vertices #graphs
1 1
2 2
3 4
4 11
5 34
6 156
33
Are there enough graphs?
# vertices #graphs
1 1
2 2
3 4
4 11
5 34
6 156
7 1044
34
Are there enough graphs?
# vertices #graphs
1 1
2 2
3 4
4 11
5 34
6 156
7 1044
8 12,346
35
Are there enough graphs?
# vertices #graphs
1 1
2 2
3 4
4 11
5 34
6 156
7 1044
8 12,346
9 274,668
36
Are there enough graphs?
# vertices #graphs
1 1
2 2
3 4
4 11
5 34
6 156
7 1044
8 12,346
9 274,668
10 12,005,168
37
The K önigsberg bridge problem
38
What's the problem?
Where: Königsberg, Prussia
(now Kaliningrad, Russia)
When: Early 1700's
What: How to start at one place, cross each bridge exactly once, and end up back where you started from
39
Abstracting a bit
40
More abstraction
41
The essence of the problem
42
A graph problem
Pick any vertex V as a start vertex.
43
A graph problem
Pick any vertex V as a start vertex.
Pick any edge incident to V which has not yet been traveled, and travel along it to another vertex, marking the edge as traveled.
44
A graph problem
Pick any vertex V as a start vertex.
Pick any edge incident to V which has not yet been traveled, and travel along it to another vertex, marking the edge as traveled.
Keep traveling from vertex to vertex along untraveled edges, marking the edges as traveled, until you return to V and all edges have been traveled exactly once.
45
Euler to the rescue
Leonhard Euler (1707-1783), a Swiss mathematician discovered everything.
46
Euler to the rescue
Leonhard Euler (1707-1783), a Swiss mathematician discovered everything.
Well, almost everything.
47
Euler to the rescue
In 1735 Euler proved that the problem has no solution.
48
Euler to the rescue
In 1735 Euler proved that the problem has no solution.
He proved more: If a connected graph has a closed eulerian circuit, then the degree of every vertex is even.
49
Are the degrees all even?
50
Say we add a couple of bridges
51
Now is there an eulerian circuit?
The degree of each vertex is even
52
Now is there an eulerian circuit?
The degree of each vertex is even
So Euler's theorem tells us there is an eulerian circuit, right?
53
Now is there an eulerian circuit?
The degree of each vertex is even
So Euler's theorem tells us there is an eulerian circuit, right?
NO! NO! NO!
54
Avoid logical pitfalls
“A implies B” does NOT mean that
“B implies A”
So the fact that all the vertex degrees are even does not tell us that an eulerian circuit exists.
But one might exist anyway.
55
Can you find an eulerian circuit?
56
Here's one
3
2
7
6
5
4
9
8
1
57
Hierholzer to the rescue
Carl Hierholzer (1840-1871), a German mathematician, published a paper in 1873 proving the converse of Euler's theorem:
58
Hierholzer to the rescue
Carl Hierholzer (1840-1871), a German mathematician, published a paper in 1873 proving the converse of Euler's theorem:
If the degree of every vertex of a connected graph is even, then the graph has a closed eulerian circuit.
59
Hierholzer to the rescue
So now it's really easy to tell if a graph has a closed eulerian circuit or not.
60
Hierholzer to the rescue
So now it's really easy to tell if a graph has a closed eulerian circuit or not.
Just look at the degree of every vertex.
61
Hierholzer to the rescue
So now it's really easy to tell if a graph has a closed eulerian circuit or not.
Just look at the degree of every vertex.
If all the degrees are even then a closed eulerain circuit exists. If one or more vertices has odd degree, then no eulerian circuit exist.
62
You call that “rescue”?
So, once we know a closed eulerian circuit exists, how do we find it?
63
You call that “rescue”?
So, once we know a closed eulerian circuit exists, how do we find it?
Hierholzer's theorem tells us nothing about how to find a closed eulerian circuit.
64
You call that “rescue”?
So, once we know a closed eulerian circuit exists, how do we find it?
Hierholzer's theorem tells us nothing about how to find a closed eulerian circuit.
We can be assured that at least one exists, but we don't have a clue how to find one.
65
Some terminology
If more than one edge connects distinct vertices u and v, then we have a multigraph.
66
Some terminology
If more than one edge connects distinct vertices u and v, then we have a multigraph.
The Königsberg Bridges graph is a multigraph.
67
Some terminology
If there is at most one edge between any two distinct vertices, we have a simple graph.
68
Some terminology
If there is at most one edge between any two distinct vertices, we have a simple graph.
From now we consider only simple graphs.
69
The planarity problem
Some graphs are planar, which means they can be drawn in a “nice” way
70
Some planar graphs
71
Definition of a planar graph
A graph is planar if it can be drawn in the plane in such a way that
72
Definition of a planar graph
A graph is planar if it can be drawn in the plane in such a way that
– Each vertex is a distinct point in the plane
73
Definition of a planar graph
A graph is planar if it can be drawn in the plane in such a way that
– Each vertex is a distinct point in the plane
– Edges do not cross – in fact, two edges touch if and only if they have a common vertex, in which case they touch only at that vertex
74
Definition of a planar graph
A graph is planar if it can be drawn in the plane in such a way that
– Each vertex is a distinct point in the plane
– Edges do not cross – in fact, two edges touch if and only if they have a common vertex, in which case they touch only at that vertex
– An edge does not touch any vertices except the two at its endpoints
75
Some planar graphs again
76
Is this graph (K
4
) planar?
77
Yes, K
4 is planar
78
A bit nicer drawing
79
C
B
Is this graph (K
5
-e) planar?
A
D E
80
C
Redraw K
5
-e, swapping C and
D
B
B
A
D A
D E C E
81
D
B
Yes, K
5
-e is planar
B
A
D A
C E C E
82
C
B
Is this graph (K
5
) planar?
A
D E
83
C
B
No, K
5 is not planar
B
C A A
D E D E
84
Not so fast
How do we know K
5 is nonplanar?
85
Not so fast
How do we know K
5 is nonplanar?
Just because we have nonplanar drawings of it does not mean that no planar drawing exists.
86
Not so fast
Maybe we just haven't been clever enough to find a planar drawing.
87
Not so fast
Maybe we just haven't been clever enough to find a planar drawing.
Trust me, K
5 is nonplanar
88
Is this graph (K
3,3
) planar?
This graph is also called the Utility
Graph. Think of connecting three utilities, gas, water, and electric, to three houses without any of the lines crossing. Can it be done?
89
No, K
3,3 is not planar
90
Not so fast (again)
Again, you should be asking, “How do we know K is nonplanar?
”
3,3
91
Not so fast (again)
Again, you should be asking, “How do we know K is nonplanar?
”
3,3
Again, you'll just have to trust me on this.
92
Not so fast (again)
Again, you should be asking, “How do we know K is nonplanar?
”
3,3
Again, you'll just have to trust me on this.
Or, look at
by Richard J.
Trudeau.
93
How to tell if a graph is planar?
At this point we know that K
5 and K
3,3 nonplanar (that is, if you trust me) are
But, in general, given any old graph, how to tell if it is planar or nonplanar?
For example ...
94
Which of these is planar?
95
Which of these is planar?
None of these graphs is planar.
How do we know?
How can we be sure?
Let's carefully examine the first one ...
96
Petersen's graph
After Julius Petersen (1839-1910), a
Danish mathematician, who presented it in 1898 (although it had already been published in 1886).
Donald Knuth says the Petersen graph is "a remarkable configuration that serves as a counterexample to many optimistic predictions about what might be true for graphs in general."
97
K
3,3 is hiding in Petersen's graph
98
K
3,3 is hiding in Petersen's graph
99
K
3,3 is hiding in Petersen's graph
100
K
3,3 is hiding in Petersen's graph
101
K
3,3 is hiding in Petersen's graph
102
K
3,3 is hiding in Petersen's graph
103
K
3,3 is hiding in Petersen's graph
104
So?
We have shown that K
3,3
Petersen's graph.
is “contained” in
105
So?
We have shown that K
3,3
Petersen's graph.
is “contained” in
So what?
106
So?
We have shown that K
3,3
Petersen's graph.
is “contained” in
So what?
So, that proves that Petersen's graph is nonplanar.
107
How so?
Say that Petersen's graph is planar.
108
How so?
Say that Petersen's graph is planar.
Then we can draw it with no edge crossings.
109
How so?
Say that Petersen's graph is planar.
Then we can draw it with no edge crossings.
Now, remove the four vertices and six edges as we did above, and what have we got?
110
How so?
A planar drawing of K
3,3
.
111
How so?
A planar drawing of K
3,3
.
BUT, K
3,3 is nonplanar, so a planar drawing does not exist, so we have a contra-diction.
112
How so?
A planar drawing of K
3,3
.
But, K
3,3 is nonplanar, so a planar drawing does not exist, so we have a contradiction.
Thus the original assumption that
Petersen's graph is planar is false.
113
A test for nonplanarity
We can generalize the above proof that
Petersen's graph is nonplanar:
114
A test for nonplanarity
We can generalize the above proof that
Petersen's graph is nonplanar:
If a graph G “contains” a nonplanar graph, then G is nonplanar also.
115
A test for nonplanarity
We can generalize the above proof that
Petersen's graph is nonplanar:
If a graph G “contains” a nonplanar graph, then G is nonplanar also.
But, it gets even better ...
116
Kuratowski to the rescue
In 1930 Kuratowski (1896-1980) proved:
A graph is planar if and only if it does not
“contain” K
3,3 or K
5
.
117
Kuratowski to the rescue
So every nonplanar graph “contains” K
3,3 or K
5
.
118
Kuratowski to the rescue
So every nonplanar graph “contains” K
3,3 or K
5
.
And no planar graph contains K
3,3 or K
5
.
119
K
3,3 and K
5
120
Now prove these are nonplanar
121
The Traveling Salesman
Problem
A salesman's territory covers the city he lives in and 4 other cities.
122
The Traveling Salesman
Problem
A salesman's territory covers the city he lives in and 4 other cities.
The salesman starts from his city and visits one of the other cities, and from that city he visits a third city, etc., until he arrives back home, having visited each of the 5 cities exacty once.
123
The Traveling Salesman
Problem
A salesman's territory covers the city he lives in and 4 other cities.
The salesman starts from his city and visits one of the other cities, and from that city he visits a third city, etc., until he arrives back home, having visited each of the 5 cities exacty once.
How to pick a shortest tour?
124
E
What is the shortest tour?
D
44
7
C
25
0 632
250
608
403
447
47
2
640
300
A B
125
Shortest tour = ABDCE (1855)
D
44
7
C
25
0 632
E
250
608
403
447
47
2
640
300
A B
126
How to find the shortest tour?
Here's one way to do it: list all possible tours add up the edge distances for each tour pick the tour with smallest total distance
127
E
447
250
Try ABCDE
D
44
7
C
25
0 632
403
608
47
2
640
300
A B
300
472
250
447
447
1916
128
Lengths of all tours
ABCDE: 1916 ACBDE: 2378
ABCED: 2101 ACBED: 2595
ABDCE: 1855 ADBCE: 2410
ABDEC: 2009 ADBEC: 2534
ABECD: 2073 AEBCD: 2442
ABEDC: 2041 AEBDC: 2349
129
Tours sorted by length
ABDCE: 1855 AEBDC: 2349
ABCDE: 1916 ACBDE: 2378
ABDEC: 2009 ADBCE: 2410
ABEDC: 2041 AEBCD: 2442
ABECD: 2073 ADBEC: 2534
ABCED: 2101 ACBED: 2595
130
Longest tour = ACBED (2595)
D
44
7
C
25
0 632
E
250
608
403
447
47
2
640
300
A B
131
How many tours are there?
n # edges = n(n-1)/2 # tours = (n-1)!/2
------------------------------------------------------------
5 10 12
6 15 60
7 21 360
8 28 2,520
9 36 20,160
10 45 181,440
15 105 43,589,145,600
20 190 60,822,550,204,416,000
25 300 310,224,200,866,619,719,680,000
132
How long to check all the tours?
Fastest computer today does 360*10 12 operations per second.
133
How long to check all the tours?
Fastest computer today does 360*10 12 operations per second.
Round this up to 1000*10 12 = 10 15 operations per second.
134
How long to check all the tours?
Fastest computer today does 360*10 12 operations per second.
Round this up to 1000*10 12 = 10 15 operations per second.
Assume 10 15 second.
tours can be checked in 1
135
How long to check all the tours?
How long will it take to check
310,224,200,866,619,719,680,000 tours?
136
How long to check all the tours?
How long will it take to check
310,224,200,866,619,719,680,000 tours?
310,224,200,866,619,719,680,000 / 10 15
137
How long to check all the tours?
How long will it take to check
310,224,200,866,619,719,680,000 tours?
310,224,200,866,619,719,680,000 / 10 15
= 310,224,201 seconds
138
How long to check all the tours?
How long will it take to check
310,224,200,866,619,719,680,000 tours?
310,224,200,866,619,719,680,000 / 10 15
= 310,224,201 seconds
= 9.837 years
139
How long to check all the tours?
How long will it take to check
310,224,200,866,619,719,680,000 tours?
310,224,200,866,619,719,680,000 / 10 15
= 310,224,201 seconds
= 9.837 years
= 9 years, 10 months
140
Bad news
• Obviously the method we have used to solve the TSP is no good at all for rather small problems, e.g., 25 cities.
141
Bad news
• Obviously the method we have used to solve the TSP is no good at all for rather small problems, e.g., 25 cities.
• We want an
procedure, which means a process that does not grow exponentially with the number of cities.
142
Bad news
• Obviously the method we have used to solve the TSP is no good at all for rather small problems, e.g., 25 cities.
• We want an
procedure, which means a process that does not grow exponentially with the number of cities.
• Here's the bad news: No such procedure is known.
143
Bad news
• Obviously the method we have used to solve the TSP is no good at all for rather small problems, e.g., 25 cities.
• We want an
procedure, which means a process that does not grow exponentially with the number of cities.
• Here's the bad news: No such procedure is known.
• Finding an efficient procedure for solving
TSP in general is an unsolved problem
144
Good news
• However, this does not mean that we can't handle 25 cities.
145
Good news
• However, this does not mean that we can't handle 25 cities.
• There are clever algorithms which make it possible to handle very large cases.
146
Good news
• However, this does not mean that we can't handle 25 cities.
• There are clever algorithms which make it possible to handle very large cases.
• For example, consider this figure from a book by David Applegate, Robert Bixby,
Vasek Chvatal and William Cook:
147
A large solved tour
13,509 towns in the US with pop. > 500
148
Bad news, again
• Despite success on various practical cases, from a mathematical point of view, the problem of finding an efficient process for solving the Traveling
Salesman Problem is unsolved.
149
Good news, again
According to David Hilbert (1862-1943):
“As long as a branch of science offers an abundance of problems, so long is it alive; a lack of problems foreshadows extinction or the cessation of independent development.”
150
Good news, again
According to David Hilbert (1862-1943):
“As long as a branch of science offers an abundance of problems, so long is it alive; a lack of problems foreshadows extinction or the cessation of independent development.”
According to the Everly Brothers:
“Problems, problems, problems all day long”
151