Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley. All rights reserved Chapter 15: Graph Theory 15.1 15.2 15.3 15.4 Basic Concepts Euler Circuits Hamilton Circuits and Algorithms Trees and Minimum Spanning Trees 15-1-2 © 2008 Pearson Addison-Wesley. All rights reserved Chapter 1 Section 15-1 Basic Concepts 15-1-3 © 2008 Pearson Addison-Wesley. All rights reserved Basic Concepts • • • • Graphs Walks, Paths, and Circuits Complete Graphs and Subgraphs Graph Coloring 15-1-4 © 2008 Pearson Addison-Wesley. All rights reserved Simple Graphs Graphs in which there is no more than one edge between any two vertices and in which no edge goes from vertex to the same vertex are called simple. Simple Not simple 15-1-5 © 2008 Pearson Addison-Wesley. All rights reserved Degree of the Vertex The number of edges joined to a vertex is called the degree of the vertex. A C D B A has degree 0, B has degree 1, C has degree 2 and D has degree 3. 15-1-6 © 2008 Pearson Addison-Wesley. All rights reserved Isomorphic Graphs Two graphs are isomorphic if there is a one-to-one matching between vertices of the two graphs with the property that whenever there is an edge between two vertices of either one of the graphs, there is an edge between the corresponding vertices of the other graph. 15-1-7 © 2008 Pearson Addison-Wesley. All rights reserved Connected and Disconnected Graphs A graph is connected if one can move from each vertex of the graph to every other vertex of the graph along edges of the graph. If not, the graph is disconnected. The connected pieces of a graph are called the components of the graph. 15-1-8 © 2008 Pearson Addison-Wesley. All rights reserved Example: Isomorphic Graphs Are the two graphs isomorphic? Solution Yes, and corresponding vertices are labeled below. A D B C B A D C 15-1-9 © 2008 Pearson Addison-Wesley. All rights reserved Sum of Degrees Theorem In any graph, the sum of the degrees of the vertices equals twice the number of edges. 15-1-10 © 2008 Pearson Addison-Wesley. All rights reserved Example: Sum of Degrees A graph has exactly four vertices, each of degree 3. How many edges does this graph have? Solution The sum of degrees of the vertices is 12. By the theorem, this number is twice the number of edges, so the number of edges is 12/2 = 6. 15-1-11 © 2008 Pearson Addison-Wesley. All rights reserved Walk A walk in a graph is a sequence of vertices, each linked to the next vertex by a specified edge of the graph. 15-1-12 © 2008 Pearson Addison-Wesley. All rights reserved Path A path in a graph is a walk that uses no edge more than once. 15-1-13 © 2008 Pearson Addison-Wesley. All rights reserved Circuit A circuit in a graph is a path that begins and ends at the same vertex. 15-1-14 © 2008 Pearson Addison-Wesley. All rights reserved Venn Diagram of Walks, Paths, and Circuits 15-1-15 © 2008 Pearson Addison-Wesley. All rights reserved Example: Classifying Walks Using the graph, classify each sequence as a walk, a path or a circuit. A E B a) E C D E D C b) A C D E B A c) B D E B C d) A B C D B A 15-1-16 © 2008 Pearson Addison-Wesley. All rights reserved Example: Classifying Walks A Solution E B D C Walk Path Circuit a) No No No b) Yes Yes Yes c) Yes No No d) Yes No No 15-1-17 © 2008 Pearson Addison-Wesley. All rights reserved Complete Graph A complete graph is a graph in which there is exactly one edge going from each vertex to each other vertex in the graph. 15-1-18 © 2008 Pearson Addison-Wesley. All rights reserved Example: Complete Graph Draw a complete graph with four vertices. Solution Answers may vary, but one solution is shown below. 15-1-19 © 2008 Pearson Addison-Wesley. All rights reserved Subgraph A graph consisting of some of the vertices of the original graph and some the original edges between those vertices is called a subgraph. 15-1-20 © 2008 Pearson Addison-Wesley. All rights reserved Coloring and Chromatic Number A coloring for a graph is a coloring of the vertices in such a way that the vertices joined by an edge have different colors. The chromatic number of a graph is the least number of colors needed to make a coloring. 15-1-21 © 2008 Pearson Addison-Wesley. All rights reserved Coloring a Graph Step 1: Choose a vertex with highest degree, and color it. Use the same color to color as many vertices as you can without coloring vertices joined by an edge of the same color. Step 2: Choose a new color, and repeat what you did in Step 1 for vertices not already colored. Step 3: Repeat Step 1 until all vertices are colored. 15-1-22 © 2008 Pearson Addison-Wesley. All rights reserved Example: Coloring a Graph Color the graph below and give its chromatic number . Solution Its chromatic number is 3. 15-1-23 © 2008 Pearson Addison-Wesley. All rights reserved