1 / 28

Introduction to Graph Theory

Introduction to Graph Theory. Instructor: Dr. Chaudhary Department of Computer Science Millersville University. Reading Assignment Chapter 1. Topics. Definition of a Graph Walks and Paths Degree of Vertecies Minimum Spanning Tree (MST) Relationship Between Degrees and Vertices

aisha
Télécharger la présentation

Introduction to Graph Theory

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Graph Theory Instructor: Dr. Chaudhary Department of Computer Science Millersville University Reading Assignment Chapter 1

  2. Topics • Definition of a Graph • Walks and Paths • Degree of Vertecies • Minimum Spanning Tree (MST) • Relationship Between Degrees and Vertices • Euler's Path Problem • Traveling Salesman’s Problem

  3. Definition of a Graph A graph G = (V, E) is an ordered pair, where V is a nonempty finite set, and E is a binary relation on V. Members of V are called vertices and members of E are called edges. An edge connects two vertices. (v3, v4) and (v2, v2) are edges 7 C 10 F 2 8 5 D D 4 6 S Fig 1: An undirected graph Fig 2: A directed weighted graph

  4. Walk Walks and Paths A sequence of edges (vi, vj), (vj, vk), …, (vm, vn) is said to be a walk from vito vn. Path A path is a walk in which no edges are repeated. (v1, v5), (v5, v2), (v2, v1), (v1, v2), and (v2, v3) is a walk from v1 to v3. (v1, v5), (v5, v2), (v2, v2), and (v2, v3) is a path from v1 to v3. (v2, v2) is a loop. (v1, v5), (v5, v2), and (v2, v3) is a simple path from v1 to v3.

  5. Degree of a Vertex Degree The degree of a vertex v, denoted by deg(v), is simply the number of times an edge of G meets v. This is not quite the same as the number of edges that are incident with v, since we must count any loops at v twice when determining the degree of v. Referring to fig. 1 deg(v1) = 2, deg(v2) = 7, deg(v3) = 2 deg(v4) = 1, deg(v5) = 2, deg(v6) = 4 deg(v7) = 1, deg(v8) = 3, deg(v9) = 0

  6. Relationship Between Degrees and Vertices A connection between degrees of vertices in a graph and number of edges in a graph is expressed in the following theorem. Theorem: If G(V, E) is a graph with V = {v1, v2, ..., vn}, then deg(v1) + deg(v2) + ... + deg(vn) = 2|E|. That is, the sum of degrees of all vertices in a graph G is equal to twice the number of edges of G. We observe that each edge that is not a loop is incident with exactly two vertices, and each loop is incident with same vertex twice. Hence, the number 2|E|.

  7. Linear and Complete Graphs If a graph G has vertices of degrees 2, 2, 2, 3, 3, 3, 4, 4, 5, and 6 then, according to the above theorem, the number of edges = 17. (2+2+2+3+3+3+4+4+5+6 = 34) There is no graph G with degrees of its vertices 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, and 6. Why? A graph is called linear graph if there is a single edge between every pair of vertices. A linear graph with n vertices has at most C(n, 2) edges. If a linear graph with C(n, 2) edges is called a complete graph. A complete graph on 5 nodes.

  8. A linear graph with n vertices has at most C(n, 2) edges C(n, 2) means combination of n things taken 2 at a time. If a linear graph with C(n, 2) edges is called a complete graph. Number of edges = Number of edges = Number of edges = Number of edges =

  9. A complete graph with 5 vertices Exercise : Use mathematical induction to prove that a complete linear graph on n vertices has edges.

  10. Spanning Trees Example

  11. Example 2: Spim’s Algorithm http://www.cs.auckland.ac.nz/~jmor159/PLDS210/dijkstra.html Start at vertex a

  12. Example Continued

  13. Example Continued Path Length = 4 + 8 + 2 + 1 + 2 + 5 = 22

  14. Euler's Path Problem • Euler's Path (Konigsberg’s bridge problem) http://mathforum.org/isaac/problems/bridges1.html A path in a graph is called Eulerian path if it traverses each edge in a graph exactly once. Theorem: An undirected graph possesses an Eulerian path if and only if it is connected and has none or two vertices of odd degree. The people wondered whether or not one could walk around the city in a way that would involve crossing each bridge exactly once.

  15. Euler’s Path Problem :Example – Page 1 a g c b d e f Since all vertices have even degrees, there is an Euler’s circuit in the graph.

  16. Euler’s Path Problem :Example – Page 2 a a g g c c b b d d e e f f

  17. Euler’s Path Problem :Example – Page 3 a 10 g 3 1 c b 2 9 4 7 6 d 8 e f 5 The numbers indicate the order of traversal.

  18. Traveling Salesman’s Problem Theorem: A Hamiltonian path in a graph is a path that passes through every vertex in the graph. Consider a salesperson who wants a tour of n cities which starts and ends at the same city and includes visiting each of the remaining n - 1 cities once and only once, subject to the condition that such a tour is also of minimum length. The problem is no more than finding a Hamiltonian circuit in a weighted graph. But no efficient algorithm has been discovered to solve this problem. Please visit the site http://www.tsp.gatech.edu

  19. Traveling Salesman Problem: Nearest Neighbor Algorithm • Start with an arbitrary chosen vertex, and find the vertex that is closest to the starting vertex to form an initial path of one edge. This path will be augmented in a vertex-by-vertex manner as described in step 2. • Let x be the latest vertex that was added to the path. Among all vertices that are not in the path, pick the one that is closest to x, and add to the path the edge connecting x and this vertex. Repeat this step 2 until all vertices are included in the path. • Form a circuit by adding the edge connecting the starting vertex and the vertex added.

  20. Example – Page 1 a 14 12 10 7 9 b c 5 6 13 8 e d 11 Start from vertex a. 1

  21. Example – Page 2 a 7 b c e d 2

  22. Example – Page 3 a 7 b c 6 e d 3

  23. Example – Page 4 a 7 b c 6 8 e d 4

  24. Example – Page 5 a 7 b c 5 6 8 e d 5

  25. Example – Page 6 a 14 7 b c 5 6 8 e d 6 Total Path Length = 7 + 6 + 8 + 5 + 14 = 40

  26. A Better Solution a 10 7 9 b c 5 6 e d Total Path Length = 7 + 6 + 9 + 5 + 10 = 37

  27. Four-color Problem Is it true that any map can be colored using four colors in such a way that adjacent regions (i.e. those sharing a common boundary segment, not just a point) receive different colors? The answer is yes. Please read the history by visiting the following web sites. http://www.math.gatech.edu/~thomas/FC/fourcolor.html

More Related