Download presentation

Presentation is loading. Please wait.

Published byBrittney Mothershead Modified over 4 years ago

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 Fig 1: An undirected graph Fig 2: A directed weighted graph D S D C F 10 5 7 4 2 6 8

4
Walks and Paths A sequence of edges (v i, v j ), (v j, v k ), …, (v m, v n ) is said to be a walk from v i to v n. Walk A path is a walk in which no edges are repeated. Path (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. (v1, v5), (v5, v2), and (v2, v3) is a simple path from v1 to v3. (v2, v2) is a loop.

5
Degree of a Vertex 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. Degree 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 Referring to fig. 1

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 = {v 1, v 2,..., v n }, then deg(v 1 ) + deg(v 2 ) +... + deg(v n ) = 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 If a linear graph with C(n, 2) edges is called a complete graph. C(n, 2) means combination of n things taken 2 at a time. 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

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

13
Example Continued

14
Path Length = 4 + 8 + 2 + 1 + 2 + 5 = 22

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

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

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

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

19
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. http://www.tsp.gatech.edu Please visit the site

20
Traveling Salesman Problem: Nearest Neighbor Algorithm 1.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. 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. 3.Form a circuit by adding the edge connecting the starting vertex and the vertex added.

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

22
Example – Page 2 7 a b c d e 2

23
Example – Page 3 7 6 a b c d e 3

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

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

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

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

28
Four-color Problem http://www.math.gatech.edu/~thomas/FC/fourcolor.html 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.

Similar presentations

© 2019 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google