Presentation is loading. Please wait.

Presentation is loading. Please wait.

Graph Theory and Algorithms 1 DM Notes1CMrsLenox.

Similar presentations


Presentation on theme: "Graph Theory and Algorithms 1 DM Notes1CMrsLenox."— Presentation transcript:

1 Graph Theory and Algorithms 1 DM Notes1CMrsLenox

2  I can solve chromatic number problems using graphs and existing algorithms.. DM Notes1CMrsLenox 2

3  Trial and error is generally how humans approach problems… Hmmm… pants, socks and shoes. Shoes then socks then pants? Socks,then pants then shoes? Shoes then pants then socks? DM Notes1CMrsLenox 3

4  And if you do something enough, you generally settle on a procedure (algorithm)  In the previous example, a getting dressed algorithm would be pants then socks then shoes, or socks then pants then shoes.  Algorithms are an ordered series of steps, also called procedures. DM Notes1CMrsLenox 4

5  If we did these problems for a long time, most of us would develop a process or procedure on how to solve the problem.  The discrete math we will cover is generally people publishing the procedures (algorithms) they have found useful for a specific type of problem. Most of these algorithms become computer programs so that humans do the thinking part, and computers do the computing part. DM Notes1CMrsLenox 5

6  Optimal: The procedure will give the best solution to that kind of problem.  Efficient: The procedure doesn’t require too much time or effort.  Approximate: Fairly good and efficient. DM Notes1CMrsLenox 6

7  If you try every possible way of doing something, you will find the best answer  For a 10 vertex connected graph, there are up to 10! sequences (3628800) or different ways to run the problem.  Exhaustive is not used for the graph problems we do in this course unless the vertex number is REALLY small. I will not make you do a problem 3628800 different ways so you know you got the best answer DM Notes1CMrsLenox 7

8 Greedy Algorithm  Step 1. Assign the first color to the first vertex  Step 2. Choose the next vertex. If it is adjacent to v, give it a new color. When selecting colors, see if the first one you used will work, then the second color used, etc.  Step 3 Keep repeating. DM Notes1CMrsLenox 8

9  Note: We could get different answers using this.  Efficient doesn’t guarantee we will get the best answer using it, just that it doesn’t take much work to do. DM Notes1CMrsLenox 9

10 10

11  The greedy algorithm is fast to use, but the answer may or may not be the best answer.  So, a new efficient (though not quite as efficient) algorithm is developed, which usually means steps to fix a problem with the old one are added. Approximate describes these. DM Notes1CMrsLenox 11

12 A vertex’s degree is the number of edges that touch it. BACD DM Notes1CMrsLenox 12

13  A:4 B:3 C:3  B: 1 DM Notes1CMrsLenox 13 A B C A B IS A 2 or 3?

14  1. Assign color 1 to the vertex with the highest degree  2. Also assign color 1 to any vertex not connected to that vertex that you legally can.  3. Assign color 2 to the vertex with the next highest degree that is not already colored.  Also assign color 2 to any vertex not connected to that vertex that you legally can.  repeat…. DM Notes1CMrsLenox 14

15 1.Degree of vertices 2. Ascending Priority list 3. Use to priority list to assign colors – a.To all not connected b.Cross out colored  Degrees next AB D C E F GH IJ DM Notes1CMrsLenox 15

16 1.Degree of vertices 2. Ascending Priority list 3. Use to priority list to assign colors – a.To all not connected b.Cross out colored  A:2 B:3 C:3 D:3 E:1  F:3 G:5 H:2 I:3 J: 1  Start with G! Color next. AB D C E F GH IJ DM Notes1CMrsLenox 16

17 1.Degree of vertices 2. Ascending Priority list 3. Use to priority list to assign colors – a.To all not connected that you can b.Cross out colored A:2 B:3 C:3 D:3 E:1 F:3 G:5 H:2 I:3 J: 1  Cross of the colored ones. AB D C E F GH IJ DM Notes1CMrsLenox 17

18 1.Degree of vertices 2. Ascending Priority list 3. Use to priority list to assign colors – a.To all not connected b.Cross out colored A:2 B:3 C:3 D:3 E:1 F:3 G:5 H:2 I:3 J: 1  Highest left is C,D,I or F. I choose C. Colored Next. AB D C E F GH IJ DM Notes1CMrsLenox 18

19 1.Degree of vertices 2. Ascending Priority list 3. Use to priority list to assign colors – a.To all not connected b.Cross out colored A:2 B:3 C:3 D:3 E:1 F:3 G:5 H:2 I:3 J: 1 AB D C E F GH IJ DM Notes1CMrsLenox 19

20  Find the vertex with the highest degree.  Color it. Also color every other vertex you can that color.  Looking at the subgraph of currently uncolored vertices, repeat step.  Continue until everything is colored. DM Notes1CMrsLenox 20

21  In the old days, the more colors a map had, the more expensive it was to make the map.  Map makers and math guys spent a lot of time trying to figure out a good procedure for coloring maps that used as few colors as possible. This is the chromatic number problem. (Borders are edges, countries are vertices). DM Notes1CMrsLenox 21

22  A conjecture (educated but unproven belief) is that no planar map requires more than 4 colors.  Algorithmoncomputer Algorithmoncomputer DM Notes1CMrsLenox 22 Planar maps include geography maps. I can draw them as dots and edges without the edges crossing over each other.

23 Chromatic numbers really were about coloring originally Graphs and matrices can be used to find solutions to different types of problems Algorithms are step by step procedures to solve different types of problems. The greedy algorithm and Welsh Powell algorithms are popular map coloring algorithms. DM Notes1CMrsLenox 23


Download ppt "Graph Theory and Algorithms 1 DM Notes1CMrsLenox."

Similar presentations


Ads by Google