Presentation is loading. Please wait.

Presentation is loading. Please wait.

Breakfast Bytes: Pigeons, Holes, Bridges and Computers Alan Kaylor Cline November 24, 2009.

Similar presentations


Presentation on theme: "Breakfast Bytes: Pigeons, Holes, Bridges and Computers Alan Kaylor Cline November 24, 2009."— Presentation transcript:

1 Breakfast Bytes: Pigeons, Holes, Bridges and Computers Alan Kaylor Cline November 24, 2009

2 Bridges

3 Königsberg

4 How did you say that?

5 Königsberg

6 Did you have to write it with the funny o?

7 Nope. You can write this with “oe” instead of “ö ”.

8 Did you have to write it with the funny o? Koenigsberg Nope. You can write this with “oe” instead of “ö ”.

9 Did you have to write it with the funny o? Koenigsberg Nope. You can write this with “oe” instead of “ö ”. That looks familiar

10 Koenig+s+berg Koenig

11 Don’t we have a street in Austin with that name? Koenig+s+berg Koenig

12 Don’t we have a street in Austin with that name? Koenig+s+berg Koenig

13 Don’t we have a street in Austin with that name? Koenig+s+berg Koenig Yes, and another way of pronouncing “oe” in German is long A.

14 Koenig So, we could pronounce: as KAY-nig?

15 Koenig So, we could pronounce: as KAY-nig? YUP

16 Does this have anything to do with computer science?

17 NOPE

18 Back to Königsberg

19 Notice the seven bridges Back to Königsberg

20 Notice the seven bridges

21 Leonard Euler asked: Can you start someplace and return there having crossed each bridge exactly once

22 You try it.

23 Couldn’t do it, could you?

24 Can we make this easier to consider?

25 Let’s introduce some dots for the land areas:

26

27 … and some lines for the bridges:

28

29 … and remove the picture:

30

31 Do we gain anything by doing this?

32 Sure. It’s easier to concentrate on what matters

33 The lesson here is that sometimes it’s better to work with a model of the problem that captures just what’s important and no more

34 The lesson here is that sometimes it’s better to work with a model of the problem that captures just what’s important and no more. We call this abstraction

35 Can you see from the abstract model why there is no solution to the Seven Bridges of Königsberg Problem?

36 This is a general truth: In any graph, there is a circuit containing every edge exactly once if and only if every node touches an even number of edges.

37 In the Seven Bridges of Königsberg Problem all four of the nodes have an odd number of edges touching them

38 So there is no solution

39 In the Seven Bridges of Königsberg Problem all four of the nodes have an odd number of edges touching them. So there is no solution

40 Now you try this one

41 Pigeons and Holes

42 The Pigeonhole Principle

43 “If you have more pigeons than pigeonholes, you can’t stuff the pigeons into the holes without having at least two pigeons in the same hole.”

44 The Pigeonhole Principle Example 1: Twelve people are on an elevator and they exit on ten different floors. At least two got off on the same floor.

45 The Pigeonhole Principle Example 2: My house is burning down, it’s dark, and I need a pair of matched socks. If I have socks of 4 colors, how many socks must I take from the drawer to be certain I have a matched pair.

46 The Pigeonhole Principle Example 3: Let’s everybody select a favorite number between 1 and _.

47 The Pigeonhole Principle Example 4: Please divide 5 by 7 and obtain at least 13 decimal places.

48 Let’s divide 5 by 7 and see what happens..7 7|

49 Let’s divide 5 by 7 and see what happens..71 7|

50 Let’s divide 5 by 7 and see what happens |

51 Let’s divide 5 by 7 and see what happens |

52 Let’s divide 5 by 7 and see what happens |

53 Let’s divide 5 by 7 and see what happens |

54 Let’s divide 5 by 7 and see what happens |

55 Let’s divide 5 by 7 and see what happens … 7| Same remainder! Thus, the process must repeat.

56 And this must happen whenever we divide whole numbers … 3| … 11| … 237| … 4|

57 planar Graphs

58 This doesn’t look planar...

59 but it is.

60 All that matters is that there is some planar representation.

61 How about this problem:

62 You are given three houses… H1 H3H2

63 How about this problem: You are given three houses… and three utilities H1 H3H2 GasWaterElec.

64 How about this problem: You are given three houses… and three utilities H1 H3H2 GasWaterElec. Can you connect each of the houses to each of the utilities without crossing any lines?

65 Here’s how NOT to do it H1 H2H3 WaterElec.Gas

66 Here’s how NOT to do it H1 H2H3 WaterElec.Gas Remember: No crossing lines.

67 Now you try. H1 H3H2 GasWaterElec.

68 Here’s another problem:

69 You are given five nodes…

70 Here’s another problem: You are given five nodes… Can you connect each node to the others without crossing lines?

71 This is NOT a solution:

72 Now you try.

73 You could not solve either problem. What’s interesting is that those two problems are the ONLY ones that cannot be solved.

74 You could not solve either problem. What’s interesting is that those two problems are the ONLY ones that cannot be solved. This is the result: A graph is nonplanar if and only if it contains as subgraphs either the utility graph or the complete five node graph.

75 Can you say that again?

76 1. Look at all subgraphs with five or six nodes.

77 Can you say that again? 1. Look at all subgraphs with five or six nodes. 2. If you find an occurance of the utility graph or the complete graph with five nodes, it’s nonplanar.

78 Can you say that again? 1. Look at all subgraphs with five or six nodes. 2. If you find an occurance of the utility graph or the complete graph with five nodes, it’s nonplanar. 3. If you don’t find those, it’s planar.

79 So using that, tell me if this graph is planar:

80 You can find this subgraph, so it’s not planar

81 Hamiltonian Circuits

82 Back when we were looking at the Seven Bridges of Königsberg Problem, we wanted a circuit that used every edge. Now let’s see is we can find a circuit that visits every node once

83 That was simple. Try this one:

84 Here’s the solution:

85 Here’s another one:

86 And here’s its solution:

87 Traveling Salesman Problem

88 Here we are given some nodes and we try to create a circuit that has minimum total length.

89 This is a 10 node problem to try.

90 Here’s the solution.

91 This is a 13 node problem to try.

92 Here’s the solution.

93 Why could a solution never have a crossing?

94 Because you can always remove the crossing and get a shorter path.


Download ppt "Breakfast Bytes: Pigeons, Holes, Bridges and Computers Alan Kaylor Cline November 24, 2009."

Similar presentations


Ads by Google