Presentation is loading. Please wait.

Presentation is loading. Please wait.

MAT 110 Workshop Created by Michael Brown, Haden McDonald & Myra Bentley for use by the Center for Academic Support.

Similar presentations


Presentation on theme: "MAT 110 Workshop Created by Michael Brown, Haden McDonald & Myra Bentley for use by the Center for Academic Support."— Presentation transcript:

1 MAT 110 Workshop Created by Michael Brown, Haden McDonald & Myra Bentley for use by the Center for Academic Support

2 Unit 1: Graph Theory Introduction

3 Terms and Definitions Vertices and Edges: A collection of points and lines, respectively, that make a graph Degree: The number of edges that use that degree as an endpoint (loops count twice) Simple Graph: One without loops or double edges Non-Simple Graph: One that contains at least one loop and/or double edge Path: A sequence of distinct edges; an ordered list of vertices Circuit: A path that begins and ends with the same vertex Length: The number of edges traveled in a given path or circuit Connected Graph: One with at least one path through every vertex Subgraph: A particular subset of vertices /edges chosen from the original graph Component: A connected subgraph Bridge: An edge in a connected graph that, if removed, would make the graph disconnected

4 Graph Terminology

5 Graph Terminology

6 Example 1: a) What is the degree of vertex R?
b) What is the degree of vertex O? c) How many vertices does the graph contain? d) How many components does the graph have? e) Is this a simple graph?

7 Example 2: a) Construct a simple graph, that has no circuits, that has vertices T,U,V,W,X,Y such that the degree of W is 3 and there are 2 disjoint parts of the graph. b) What are the edges of this simple graph?

8 The edges are "WX, UW, VW, YT“
Simple Graph The edges are "WX, UW, VW, YT“ (Answers may vary)

9 Example 3: Which of the following degree sequences are possible for a simple graph? {1,2,3,4} {6, 1,1,2} {1,2,2,3} {2,2,2,2}

10 Simple Graph A) This is not possible because there will be repeating edges. B) This is not possible because there will be repeating edges C)This IS a Simple Graph D) This Is a Simple Graph

11 Example 4: Which of the graphs below is the above graph represented differently? A B C

12 Similar Graphs The answer is Graph A because points A,B,C,D,E,F and G correspond with points W,V,Z,X,U,Y, and T for graph A. Degrees A = 4 B = 5 C = 4 D = 4 E = 2 F = 3 G = 4 W = 4 V = 5 Z = 4 X = 4 U = 2 Y = 3

13 Graph Tracing The Koenigsberg bridge problem
Starting at some point, can you visit all parts of the city, crossing each bridge once and only once, and return to the starting point?

14 Graph Tracing We can model the problem with a graph model.

15 Graph Tracing The Koenigsberg problem, phased in graph theory language, is “Can the graph be traced?” To trace a graph means to begin at some vertex and draw the entire graph without lifting the pencil and without going over any edge more than once.

16 Graph Tracing *Connected graphs are also called networks.

17 Graph Tracing Example: (solution on next slide)

18 Graph Tracing Example: Odd: B and C Even: A, D, E, and F
(Zero edges is considered “even”)

19 Euler’s Theorem

20 Euler’s Theorem

21 Euler’s Theorem Example: Which of the graphs can be traced?
(solution on next slide)

22 Euler’s Theorem Solution: Trace-able Not trace-able Trace-able

23 Example 5: Which of the following degree sequences are possible for a simple graph? A) (4, 4, 3, 4, 5, 2, 2, 1, 5) B) (2, 2, 3, 5, 6, 4, 4, 1) C) (3, 3, 4, 3, 5, 4, 2, 3, 1) D) (2, 3, 1, 3, 2, 3, 5)

24 Simple and Connected Graphs
Answer: A & C Why? Because A & C add up to even numbers…OR…A & C are the ones that have an even number of odd degrees. (For a graph to be both simple and connected, each edge will touch a vertex, and each edge has 2 ends, therefore the sum of the degrees of every vertex will always be 2 times the number of edges, and therefore, will always be an even number.)

25 Euler’s Theorem Example: Solution: Path ACEB has length 3.
Path ACEBDA is an Euler path of length 5. It is also an Euler circuit.

26 Criteria for Euler Paths & Circuits
If a graph G has an Euler PATH, then it must have exactly two odd vertices. If the number of odd vertices in G is anything other than 2, then G cannot have an Euler PATH. If a graph G has an Euler CIRCUIT, then all of its vertices must be even vertices. If the number of odd vertices in G is anything other than 0, then G cannot have an Euler CIRCUIT.

27 Does A Graph Contain an Euler Path or Circuit
Does A Graph Contain an Euler Path or Circuit? * As long as the graph is connected. # Odd Vertices Euler Path? Euler Circuit? 2 4, 6, No *YES 1, 3, No Such Graphs Exist!

28 Fleury’s Algorithm: (For finding Euler Circuits)

29 Fleury’s Algorithm

30 Fleury’s Algorithm

31 Example 7: A B C Which of the following graphs have Euler circuits?

32 Euler Circuits Only Graph B has an Euler Circuit. A has odd vertices, and C is disconnected. Use Fleury’s Algorithm to find one of the possible Euler Circuits (hint: sometimes it is easier to start with the vertices with the smallest degrees first so you don’t get stuck)

33 Eulerizing a Graph: (Making it so that it contains an Euler Circuit)

34 Eulerizing a Graph *Note: In making every odd vertex even, you must add edges to double pre-existing edges. You cannot create any new ones. Add edges so that odd vertices become even

35 Hamilton paths Example: Find a Hamiltonian path.

36 Complete Graphs:

37 Finding Hamilton Circuits
ABCDA, ABDCA, ACBDA, ACDBA, ADBCA, ADCBA

38

39 Example 8: How many Hamilton circuits are there in a
complete graph with 4 vertices? Answer) (n – 1)! = 3! = 6 How many Hamilton Circuits are there in a complete graph with 5 vertices, if you don’t count reversals? Answer) (n – 1)! / 2 = 4!/2 = 24/2 = 12

40 Which of the following graphs have Hamiltonian Circuits?
Example 9: A B C Which of the following graphs have Hamiltonian Circuits?

41 Hamiltonian Circuits Only graph A has a Hamiltonian Circuit in it. We found it by visiting all the VERTICES. (hint: you must go to ALL the vertices so if there is a disjointed part, a vertex with only one degree, or a bridge, then there cannot be a Hamiltonian Circuit.)

42 Konigsberg Bridge Problem
Starting at some point, can you visit all parts of the city, crossing each bridge once and only once, and return to the starting point?

43 Konigsberg Bridge Problem
NO! This problem is an example of an Euler Circuit, since we want to cross each bridge once and only once, and start and stop at the same point.

44 General Rule: Hamiltonian Paths and Circuits require that every VERTEX be visited; (such as when traveling to several cities before returning home). Eulerian Paths and Circuits require that every EDGE be used; (such as when designing a delivery route or deciding which order to plow the streets).

45 Solving the TSP by Brute Force
In solving a TSP problem by brute force, we consider all possible Hamiltonian circuits.

46 Solving the TSP by Brute Force
Example: Use the weighted graph to find the sequence of cities for Danielle to visit that will minimize her total travel cost.

47 Solving the TSP by Brute Force
Solution: Use brute force to explore all possible circuits:

48 Solving the TSP by Brute Force

49 Traveling Salesman Problem - Nearest Neighbor

50 Example 10: Use the nearest neighbor algorithm to find a Hamiltonian circuit starting at vertex K. A. List the vertices in the Hamiltonian circuit in the order they are visited. Do not forget to include the starting vertex at both ends. B. What is the total weight along the Hamiltonian circuit?

51 Nearest Neighbor Algorithm
The order of the vertices we visited are K,H,J,I,K and the weight of the path is 66.

52 Traveling Salesman Problem: Best Edge or Side Sorted Algorithm
With this algorithm, you may start at any vertex, so choose the one that is connected to an edge with the smallest weight.

53 Example 11: Use the Best Edge Algorithm to find the Hamiltonian circuit with the smallest weight. List the weights of the edges in order they were chosen using the algorithm.

54 Finding a Hamilton Circuit using Best Edge
First choose the 9. Then choose the 10. You cannot choose the 11 without closing a loop. You cannot choose the 12 or you will have a vertex with degree 3. Then choose the 13. 14 will also close a loop, 15&16 will make degree 3 vertices, but choosing the 17 will work. To close the circuit there is only once choice left now, so choose the 18. Answer: 9, 10, 13, 17, 18

55 Trees For a graph to be a tree, it must be connected and have no redundant edges, which means it must contain no circuits.

56 Spanning Tree A spanning tree is a subgraph that…
Contains all the original vertices in the graph, Is connected, Contains no circuits.

57 Trees and Forests A B C D A forest is a collection of trees. Which of the following are trees and which are forests?

58 Tree/Forest Graph A is a Tree and a forest Graph B is a forest
Graph C has a circuit so it is NOT a tree or a forest. Graph D has a circuit so it is NOT a tree or a forest. (Hint: A tree can be a forest but a forest doesn’t have to be a tree)

59 Kruskal’s Algorithm Used to find a minimal spanning tree of a connected weighted graph. Step 1: Choose any edge with the smallest weight. Step 2: Choose any remaining edge in the graph with the smallest weight. Step 3: Keep adding the next smallest weight edge that does not create a circuit until all vertices have been added to your subgraph.

60 Example 12: Consider the graph given above. Use Kruskal's algorithm to find the minimum spanning tree. A) What is the total weight of the spanning tree? B) List the weights of the selected edges separated by commas in the order of selection.

61 Kruskal's Algorithm The total weight is 12. you should go from H, J, I to G. the weights are 5,3, and 4. (hint: Kruskal’s algorithm does not find circuits. All that is required is that all vertices are visited.)

62 Example 13: Consider the cities C, D, E, F, G & H. The costs of the possible roads are given below. c(C, F) = 18 c(D, E) = 13 c(D, F) = 17 c(D, H) = 12 c(E, F) = 16 c(E, G) = 11 c(F, G) = 14 c(F, H) = 15 c(G, H) = 10 Answer: = 65

63 Thank You For Coming! Tutoring help for this course is always available in the Center for Academic Support. The CAS is located in the 2nd floor, northeast corner of the Hearnes Building. We are open from 8 am to 7 pm Monday through Thursday, and 8 am to 3 pm on Friday. We are closed Saturday and Sunday. Walk in anytime or call the front desk to make an appointment: Bill Arnold is the Math Coordinator: ,


Download ppt "MAT 110 Workshop Created by Michael Brown, Haden McDonald & Myra Bentley for use by the Center for Academic Support."

Similar presentations


Ads by Google