Download presentation
Presentation is loading. Please wait.
Published byDwayne Moore Modified over 8 years ago
1
Grade 11 AP Mathematics Graph Theory Definition: A graph, G, is a set of vertices v(G) = {v 1, v 2, v 3, …, v n } and edges e(G) = {v i v j where 1 ≤ i, j ≤ n; i ≠ j} Vertex set: v(G) = {v 1, v 2, v 3, v 4, v 5 } Edge set: e(G) = {v 1 v 2, v 1 v 3, v 2 v 3, v 2 v 4, v 2 v 5, v 3 v 4 } v1v1 v5v5 v4v4 v3v3 v2v2 G
2
Grade 11 AP Mathematics Graph Theory We will consider only simple graphs with no loops and no multiple edges between vertices. Graph F alongside is not a simple graph F We will not attach any direction to the edges (we speak of a digraph in this case) thus, for our purposes, the edges are not directed. The order of a graph is the number of vertices and the size of a graph is the number of edges. Graph H has order 4 and size 5 H
3
Grade 11 AP Mathematics Graph Theory Edges are adjacent if they share a common vertex e.g. edges v 1 v 2 and v 2 v 3 are adjacent since they share a common vertex v 2 Vertices are adjacent if they are the endpoints of a particular edge e.g. vertices v 1 and v 2 are adjacent since they are the endpoint of edge v 1 v 2 The degree of a vertex is the number of vertices adjacent to it. e.g. deg (v 4 ) = 2 H v2v2 v3v3 v4v4 v1v1
4
Grade 11 AP Mathematics Graph Theory A complete graph (K n ) is a graph in which each vertex is adjacent to every other vertex. Number of edges in a complete graph =. Graph P is a complete graph K 4 since it has 4 vertices and all of its vertices are adjacent to each of the other three vertices. Number of edges =. Think of a group of people shaking hands … how many handshakes will you have for 4 people? v3v3 P v2v2 v4v4 v1v1
5
Grade 11 AP Mathematics Graph Theory A bipartite graph is a simple graph whose vertices are partitioned into two subsets V 1 and V 2 such that every edge v i v j has i V 1 and j V 2 i.e. we don’t join vertices in the same subset. V 1 = {v 1, v 2, v 3, v 4 } V 2 = {v 5, v 6 } V 1 = {v 1, v 2, v 3, v 4 } V 2 = {v 5, v 6 } Graph Q is a complete bipartite graph v1v1 v2v2 v4v4 v5v5 v6v6 v3v3 Q v1v1 v2v2 v4v4 v5v5 v6v6 v3v3 M
6
Grade 11 AP Mathematics Graph Theory A connected graph is a graph such that there is a path from any vertex to any other vertex in the graph. Graph Q is a connected graph. v1v1 v2v2 v4v4 v5v5 v6v6 v3v3 Q v1v1 v2v2 v4v4 v5v5 v6v6 v3v3 M By contrast, Graph M is a disconnected graph. For example, there is no path from v 3 to v 5.
7
Grade 11 AP Mathematics Graph Theory A regular graph is a graph such that all of the vertices have the same degree. Examples: 2-regular graphs 3-regular graphs (cubics)
8
Grade 11 AP Mathematics Graph Theory Walks A walk is a sequence of vertices and edges such that the end vertex of one edge is the start of another edge. A B C D F G H E I A - B - C - D - E - H - G - E - B - C - D
9
Grade 11 AP Mathematics Graph Theory Paths A path is a walk such that no edge is travelled more than once. A B C D F G H E I G - E - D - C - B - E - F - H - I - A
10
Grade 11 AP Mathematics Graph Theory Chains A chain is a path such that no vertex is visited more than once. A B C F G H E I D A - I - H - F - E - D - C - B
11
Grade 11 AP Mathematics Graph Theory A path (and by extension a chain) that starts and ends at the same vertex is called a closed path. A closed path also called a circuit or a cycle. A B C F G H E I D A - I - H - F - E - D - C - B - A
12
Grade 11 AP Mathematics Graph Theory Euler Path An Euler path is a path such that every edge in a connected circuit is travelled once only. A B C F G E H D A - H - G - F - E - D - C - B - E - G - A - B - G
13
Grade 11 AP Mathematics Graph Theory Hamiltonian Circuit A circuit that passes through every vertex at most once is called a Hamiltonian circuit. A B C F G E H D A - H - G - F - E - D - C - B - A
14
Grade 11 AP Mathematics Graph Theory Euler Circuit An Eulerian path that starts and ends at the same vertex is called an Eulerian circuit. A B C F G E H D A - H - G - F - E - D - C - B - E - G - A
15
Grade 11 AP Mathematics Graph Theory Distance between two vertices The distance between two vertices in a connected graph is the length of the shortest path between them. For a disconnected graph M alongside, we say that d(v 1, v 6 ) = ∞. Thus, we can now say that a graph G is connected in the sense that for any two vertices v i and v j v(G) we have d(v i, v j ) < ∞. v1v1 v2v2 v4v4 v5v5 v6v6 v3v3 M
16
Back to the 7 Bridges of Konigsberg… ( remember, the problem asked whether it was possible to cross ALL 7 bridges without passing over any bridge more than once … i.e. does an Eulerian path exist? ) A vertex that is NOT a start/end vertex must have an even degree (if you enter it only via an unused edge, you have to also be able to leave it via an unused edge) A vertex that is a start/end vertex must have an odd degree (if you leave the start, you cannot return to it for a final time via a path already used) Grade 11 AP Mathematics Graph Theory
17
Back to the 7 Bridges of Konigsberg… ( remember, the problem asked whether it was possible to cross ALL 7 bridges without passing over any bridge more than once … i.e. does an Eulerian path exist? ) Grade 11 AP Mathematics Graph Theory Theorem 1.An Eulerian path exists if a connected graph has 2 vertices of odd degree where the start ≠ end. 2. An Euler circuit (i.e. start = end) exists if all vertices have even degree. NOTE: The theorem does not tell us how to find and Euler path or Circuit
18
Grade 11 AP Mathematics Graph Theory Fleury’s Algorithm for finding an Euler path First check that an Euler path exists! Start at one of the two vertices with odd degree – in this case, vertex A, for example C D A B G E H F
19
Grade 11 AP Mathematics Graph Theory Fleury’s Algorithm for finding an Euler circuit First check that an Euler circuit exists! Start anywhere, for example vertex C B C G E D F
20
Grade 11 AP Mathematics Graph Theory Shortest Paths - 1 Finding shortest paths (in a weighted graph) is a very common use of graph theory. Commonly used algorithms for doing so include: Dijkstra’s algorithm, which is used under these conditions: when there is a given starting point when none of the weighted edges are negative We will study and practice this algorithm Bellman-Ford algorithm, used when some edges are negative (own research) Johnson algorithm, used to solve all pairs’ shortest paths (own research) Finding the shortest path in a weighted graph is a common imperative in many commercial, practical situations … e.g. transport and logistics
21
Grade 11 AP Mathematics Graph Theory Shortest Paths - 2 Perhaps the imperative is not simply to find a shortest path in a weighted graph, but to do so by having to travel along each edge only once and returning to where you started … think of a postman having to go from door to door along every street in a neighbourhood. The vertices in a graph modelling this situation should be thought of as the intersections of the respective streets. This classic case is called the Chinese Postman problem named after a Chinese mathematician Mei Ko Kuan in 1962 and is really akin to finding an optimal Euler circuit. If all vertices have an even degree, then an Euler circuit exists and that will be the best solution If there are two vertices of odd degree, then an Euler path exists – use Dijkstra’s algorithm
22
Grade 11 AP Mathematics Graph Theory Shortest Paths - 3 If there are more than two vertices of odd degree, we have to create an Euler circuit (we have to Eulerise it) which may or may not be the optimal Euler circuit: Connect the odd vertices in pairs and retrace these routes when devising an Euler circuit Algorithms for finding an optimal Euler circuit in problems like the Chinese Postman problem are fairly complex.
23
Grade 11 AP Mathematics Graph Theory Shortest Paths - 4 Perhaps it may be that we have to find a shortest path by visiting each vertex once only. Think of a salesman visiting all of his clients on a sales trip and doing so by minimising cost or travelling time. This situation has come to be known as the Travelling Salesman problem and is really a matter of finding an optimal Hamiltonian circuit. There is no theorem which tells us whether or not a Hamiltonian circuit exists for all graphs. Algorithms for finding optimal Hamiltonian circuits: Brute force algorithm Nearest Neighbour algorithm
24
Grade 11 AP Mathematics Graph Theory Shortest Paths - 5 1.Brute force algorithm Start at any vertex e.g. A List all possible unique Hamiltonian circuits Calculate respective lengths Select circuit with minimum length Not very time efficient B D A F C 1 5 4 1 2 4 2 2 CircuitLength ABCFDA2+4+2+1+1=10 ABFCDA2+2+2+4+1=11 ABFDCA2+2+1+4+5=14 ACBFDA5+4+2+1+1=13
25
Grade 11 AP Mathematics Graph Theory Shortest Paths - 6 2.Nearest Neighbour algorithm Select a starting vertex Move to an adjacent (unvisited) vertex using the edge with the smallest weight (where a choice exists) Repeat until a circuit has been completed “Greedy” algorithm since at each vertex, the best choice is made without considering the future consequences – in many instances, it gives only an approximate optimal Hamilton circuit but it is a very time-efficient algorithm B D A F C 7 5 4 1 9 4 3 6 ADCFBA … Total weight = 1 + 4 + 9 + 3 + 6 = 28
26
Grade 11 AP Mathematics Graph Theory Spanning Tree B D A E C F G A spanning tree is a sub-graph found within an existing connected graph which ensures that a path exists between any pair of vertices in the original graph Note: all vertices are used but not all original edges are used no new edges are created where none existed before no circuit is formed for any connected graph, multiple spanning trees can exist
27
Grade 11 AP Mathematics Graph Theory Minimum Cost Spanning Tree B D A E C F G Minimum cost spanning trees can be found using Kruskal’s Algorithm Select an unused edge of minimum weight Repeat this process unless doing so creates a circuit Continue until all vertices have been used 1 2 3 1 7 4 9 1 6 2 5 Minimum Cost = 1 + 1 + 1 + 2 + 2 + 3 = 10 units
28
Grade 11 AP Mathematics Graph Theory ABCDEF A1131479 B26910 C16175 D432 E21 F Use the adjacency matrix to construct the MCST for the connected graph. A B C D E F Minimum Cost = 2 + 3 + 4 + 5 + 6 = 20 units
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.