Graph Theory to the Rescue Using graph theory

  • Slides: 20
Download presentation
+ Graph Theory to the Rescue Using graph theory to solve games and problems

+ 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 n In Konigsberg, East Prussia, a river runs through the

+ BRIDGES OF KONIGSBERG n 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. n 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 n Can the Konigsberg Bridge Problem be solved? n

+ Bridges of Konigsberg Problem n Can the Konigsberg Bridge Problem be solved? n Suppose they had decided to build one fewer bridge in Konigsberg. Can I solve the problem now? n n n 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 n A graph is an ordered pair G=(V, E), comprising of a

+ GRAPHS n 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) n EXAMPLE: n V={a, b, c, d} E={(a, c), (a, b), (c, b), (b, d), (a, a), (d, d)}

+ Graph Theory definitions n Let x and y be vertices in a graph

+ Graph Theory definitions n 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. n 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. n 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.

+ n Represent the Bridges of Konigsberg problem into a graph (the vertices represent

+ n Represent the Bridges of Konigsberg problem into a graph (the vertices represent the parts of land the edges represent the bridges) n 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 n Here are some more graphs. Which ones have

+ Graphs and Euler Circuits n Here are some more graphs. Which ones have Euler Circuits and which ones don’t? n When do graphs have Euler Circuits? n 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. n 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 n Can the Konigsberg Bridge Problem be solved? n

+ Bridges of Konigsberg Problem n Can the Konigsberg Bridge Problem be solved? n Suppose they had decided to build one fewer bridge in Konigsberg. Can I solve the problem now? n n n 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 n Jeannie, who lives in Eugene, was flying to visit several

+ More Problems n 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 n Mike had a very successful Cub Scout popcorn sale. Now

+ More Problems n Mike 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) n A puzzle with 4 cubes. Each cubes face is

+ INSTANT INSANITY (1967) n A puzzle with 4 cubes. Each cubes face is one of 4 colors: red, blue, green, white n Stack the cubes in a column. So that each side of the column has all four colors showing.

One Instant Insanity Game R BR Y Y B Y G 4 R B

One Instant Insanity Game R BR Y Y B Y G 4 R B Y B 3 R 2 G 1 G G G B Y R

+ How many different arrangements are there? n Cube 1 at the bottom –

+ How many different arrangements are there? n Cube 1 at the bottom – 3 different arrangements for this cube (only concerned with the four faces on the side) n 6 ways to place it on top now – then rotate it 4 times with a different outcome possible – so 24 total ways n Similarly 24 for the 3 rd and 4 th arguments n Total Number: 3(24)(24) = 41, 472 possibilities

+ Instant Insanity and Graph Theory n We are only concerned with the sides

+ Instant Insanity and Graph Theory n 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 n We want to represent the cube in terms of a graph: n 4 colors will represent the vertices n Edge will represent if 2 colors are on opposite faces of the cube n 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) n Label the edges by denoting which cube they come from

One Instant Insanity Game 1 R BR Y Y B Y G 4 R

One Instant Insanity Game 1 R BR Y Y B Y G 4 R B Y B 3 R 2 G G B Y R

+ Solving Instant Insanity n With the 4 cubes stacked in a column, examine

+ Solving Instant Insanity n With the 4 cubes stacked in a column, examine two opposite sides of the column. n n n Do the same thing with the other sides. n n 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: n n n 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

+ Cubes as Graphs

+ A Solution Here is a possible solution to this puzzle. There is another

+ A Solution Here is a possible solution to this puzzle. There is another solution, too.

+ Solution n Here is a solution to this particular Instant Insanity game. There

+ Solution n Here is a solution to this particular Instant Insanity game. There is another solution to this same game.

+ Other Instant Insanity Games n There are 3 more games on the tables.

+ Other Instant Insanity Games n There are 3 more games on the tables. Can you solve them? Note: not all of them have solutions. These are labelled as b-b, meaning blue is opposite of blue. GAME CUBE 1 CUBE 2 CUBE 3 CUBE 4 1 Y-Y, Y-R, BG B-Y, B-G, R-R B-G, B-Y, R-R Y-B, G-R, GY 2 G-B, B-R, Y-R, G-Y, B-B R-G R-B, G-Y B-Y, B-B, GY 3 G-R, B-B, R-Y G-Y, R-R, B-G G-Y, R-R, G-B R-B, G-G, RY