Вы находитесь на странице: 1из 4

Graph Theory puzzles to try at home!

1. The 5 Room House Puzzle Can you draw a continuous path (that is, without taking your pen off the paper) through each of the doors of these 5 rooms, without going through any door twice, and without the path crossing over itself? The path can, of course, end in any room, not necessarily in the room from where it started. Solution
To turn this into a graph theory problem, turn each room into a node and then connect two nodes if there is a direct path joining the two rooms. The green nodes denote those with an even number of edges coming out of them and the red ones have an odd number of edges. As we learnt in class, the problem is impossible if there are more than two red nodes (which there are).

2. The Wolf, the Sheep and the Turnip This is a classic problem! Dr Julia is standing on the side of a river with a wolf, a sheep and a turnip. She has a boat that is so small that it can only hold herself and one of the three objects. However, if she leaves the wolf alone with the sheep on the side of the river then the wolf will eat the sheep, and if she leaves the sheep with the turnip then the sheep will eat the turnip. Thankfully, wolves do not like to eat turnips. How can Dr Julia get all the items safely to the other side of the river? And how can this be formulated in terms of graphs?

Solution
It isnt so hard to solve this problem without graphs, but it has a nice graph theory formulation. First we need to design some notation to tell us what state the animals are in. We are going to use the symbol (W,S,T) where each of W, S and T are 0 if the object is on the left bank and is 1 if the object is on the right bank. So we have: (0,0,0) (1,0,0) (0,1,0) (0,0,1) (1,1,0) (0,1,1) (1,0,1) (1,1,1) Our initial state, with all three on the left side of the river. The wolf has crossed the river, but not the sheep or the turnip. The sheep has crossed the river, but not the wolf or the turnip. The turnip has crossed the river, but not the wolf or the sheep. The wolf and the sheep have crossed the river, but not the turnip. The sheep and the turnip have crossed the river, but not the wolf. The wolf and turnip have crossed the river, but not the sheep. Our desired state, where all three have crossed the river.

We can think of these symbols as 3-dimensional coordinates and draw ourselves a nice picture:

Now we need to delete the forbidden edges, so we dont leave behind any of the objects that might eat each other. This means the edge joining (0,0,0) to (1,0,0) is forbidden, for example, because the sheep and the turnip are left behind and the sheep would eat the turnip.

Now all we need to do is find a path from (0,0,0) to (1,1,1)! It is clear that there are two possible solutions:

1. 2. 3. 4. 5.

Move sheep to other side. Move turnip to other side. Move sheep back. Move wolf to other side. Move sheep to other side.

1. 2. 3. 4. 5.

Move sheep to other side. Move wolf to other side. Move sheep back. Move turnip to other side. Move sheep to other side.

3. The Handshaking Puzzle (hard!) In a party of people, some of whom shake hands, prove that an even number of people must have shaken an odd number of other people's hands. (Euler actually proved this result in the same paper where he found the solution to the Knigsberg Bridges problem.) Solution
Let the people at the party be the nodes of a graph, and there is an edge between nodes if those two people have shaken hands. For example, in this party we have 5 people labelled A,,E. Person C has shaken hands with person D, who has also shaken hands with A and B. Let eA be the number of edges coming out of node A. This tells us the number of people that person A has shaken hands with. Similarly for eB, eC and so on. Now we add up these numbers to get the sum eA + eB + eC +. This number has to be equal to twice the number of handshakes which took place (i.e. twice the number of edges) because we included each handshake twice once for each person doing the handshake.

So we can deduce that the sum eA + eB + eC +. is an even number. In that case, it must be that an even number of the numbers eA, eB, eC, ... is odd. (Because if an odd number of the numbers were odd, it couldnt sum to an even number). This is the same as saying that the number of people who shook hands an odd number of times is even.

Вам также может понравиться