Graph Theory to the Rescue

advertisement
+
Graph Theory to
the Rescue
Using graph theory to solve games and
problems
Dr. Carrie Wright
University of Arizona
Teacher’s Circle
November 17, 2011
+
BRIDGES OF KONIGSBERG

In Konigsberg, East Prussia, a river runs through the city such
that in its center is an island, and after passing the island, the
river broke into two parts. Seven bridges were built so that
the people of the city could get from one part to another.

The people wondered whether or not one could walk around
the city in a way that would involve crossing each bridge
exactly once.
+
Bridges of Konigsberg Problem

Can the Konigsberg Bridge Problem be solved?

Suppose they had decided to build one fewer bridge in
Konigsberg. Can I solve the problem now?

Does it matter which bridge you take away?

What if you add bridges?

What about walking through the city crossing every bridge
ending at a different place? (Somebody is picking you up)
+
GRAPHS

A graph is an ordered pair G=(V,E), comprising of a finite,
nonempty set, V, (called the vertices) together with a multiset
E of unordered pairs (called edges)

EXAMPLE:

V={a,b,c,d}
E={(a,c),(a,c),(a,b),(c,b),(b,d),(b,d),(a,a),(d,d)}
+
Graph Theory definitions

Let x and y be vertices in a graph G=(V,E). An x-y walk in G
is a (loop-free) finite alternating sequence of vertices and
edges from G starting at vertex x and ending at vertex y.

If no edge in the x-y walk is repeated, then the walk is called
an x-y trail. A closed x-x trail is called a circuit.

The degree of a vertex, v, is the number of edges that are
incident to v; or, the number of edges meeting at a vertex, v.
+

Represent the Bridges of Konigsberg problem into a graph
(the vertices represent the parts of land and the edges
represent the bridges)

A graph G is said to have an Euler circuit if there is a circuit
in G that traverses every edge of the graph exactly once. If
there is an open trail from a to b in G that traverses each
edge in G exactly once, then the trail is called an Euler
circuit.
+
Graphs and Euler Circuits

Here are some more graphs. Which ones have Euler Circuits
and which ones don’t?

When do graphs have Euler Circuits?

THEOREM: Let G be a graph with no isolated vertices. The
graph G has an Euler circuit if and only if G is connected and
the degree of every vertex is even.

Theorem: Let G be a graph with no isolated vertices. G has
an Euler trail if and only if G has exactly two vertices of odd
degree.
+
Bridges of Konigsberg Problem

Can the Konigsberg Bridge Problem be solved?

Suppose they had decided to build one fewer bridge in
Konigsberg. Can I solve the problem now?

Does it matter which bridge you take away?

What if you add bridges?

What about walking through the city crossing every bridge
ending at a different place? (Somebody is picking you up)
+
More Problems

Jeannie, who lives in Eugene, was flying to visit several of her
aunts and uncles over Christmas. She flew on an airline that
has hubs in Chicago and Denver. She had to get to
Minneapolis to visit her aunt Minnie and to St. Louis to see
her Uncle Louis and to Little Rock to see her uncle Rocco.
Can Jeannie fly on each flight leg exactly once and end up
back in Eugene?
+
More Problems

Mike had had a very successful Cub Scout popcorn sale. Now the
popcorn had arrived and it was time to deliver it to all the
neighbors. He had managed to sell popcorn to just about every
household in his neighborhood and now had to haul his load of
popcorn along 22 blocks to deliver it. He's looking for the most
efficient route through his neighborhood--he wants to walk each
block exactly once until all his popcorn is delivered. Can you find a
route for him? Here's a map of his neighborhood:
+
INSTANT INSANITY (1967)

A puzzle with 4 cubes. Each cubes face is one of 4 colors:
red, blue, green, white

Stack the cubes in a column. So that each side of the column
has all four colors showing.
1
One Instant Insanity
Game
G
R
2
Y
R
Y
R
Y
B
3
4
R
R
Y
G
B
Y
+
How many different arrangements
are there?

Cube 1 at the bottom – 3 different arrangements for this cube
(only concerned with the four faces on the side)

6 ways to place it on top now – then rotate it 4 times with a
different outcome possible – so 24 total ways

Similarly 24 for the 3rd and 4th arguments

Total Number: 3(24)(24)(24) = 41,472 possibilities
+
Instant Insanity and Graph Theory

We are only concerned with the sides – and the opposite
colors. We can start by focusing on the front and back of the
cubes, then move to the sides

We want to represent the cube in terms of a graph:

4 colors will represent the vertices

Edge will represent if 2 colors are on opposite faces of the cube

Do this for all 4 cubes – you can either put them all on one
graph or separate it into 4 separate graphs (each graph
representing a cube)

Label the edges by denoting which cube they come from
1
One Instant Insanity
Game
G
R
2
Y
R
Y
R
Y
B
3
4
R
R
Y
G
B
Y
+
Solving Instant Insanity

With the 4 cubes stacked in a column, examine two opposite
sides of the column.



Do the same thing with the other sides.


This gives us 4 edges in the graph with each label appearing once.
Each color appears once on each side. So each color must appear
twice as an endpoint.
Note: These aren’t always possible.
You’re looking for 2 disjoint subgraphs:



Each subgraph contains all 4 vertices and four edges (one for each
cube)
Each subgraph, each vertex is incident with exactly two edges
No (labeled) edge of the labeled graph appears twice in both
subgraphs
+
Cubes as Graphs
+
A Solution
Here is a possible solution to this puzzle. There is another solution, too.
+
Solution

Here is a solution to this particular Instant Insanity game.
There is another solution to this same game.
+
Other Instant Insanity Games

There are 3 more games on the tables. Can you solve them?
Note: not all of them have solutions. These are labelled as bb, meaning blue is opposite of blue.
GAME
CUBE 1
CUBE 2
CUBE 3
CUBE 4
1
Y-Y, Y-R, B-G
B-Y, B-G, R-R
B-G, B-Y, R-R
Y-B, G-R, G-Y
2
G-B, B-R, Y-R
Y-R, G-Y, B-B
R-G R-B, G-Y
B-Y, B-B, G-Y
3
G-R, B-B, R-Y
G-Y, R-R, B-G
G-Y, R-R, G-B
R-B, G-G, R-Y
Download