The Mathematics of Graphs Outline 1. Graphs and Euler Circuits 2. Weighted Graphs 3. Planarity and Euler’s Formula 4. Graph Coloring Graphs and Euler Circuits Graph A graph is a set of points called vertices and line segments or curves called edges that connects vertices. Example: Graph • Each dot represents a person, and a line segment connecting two dots. • It means that those two people are friends on Facebook. Terminologies • In general, graphs can contain vertices that are not connected to any edges. • If two or more edges connect the same vertices, they are called multiple edges. • If an edge begins and ends at the same vertex, it is called a loop. • A graph is connected if any vertex can be reached from any other vertex by tracing along edges. • A connected graph in which every possible edges is drawn between vertices is called complete graph. A B vertices not connected A B Multiple edges A loop Complete Graph Terminologies • A graph is simple if it has no loops and there is at most one edge between any two vertices in the graph. Equivalent Graphs Two or more are called equivalent graphs if the edges form the same connections of vertices in each graphs. Euler Circuits •A path in a graph can be thought of as a movement from one vertex to another by traversing edges. •If a path ends at the same vertex at which it started, it is considered a closed path, or circuit. •A circuit that uses every edge, but never uses the same edge twice, is called an Euler circuit. •The number of edges that meet at a vertex is called the degree of a vertex. A-D-F-G-D-B-E-G-H-E-C-B-A A-B-C-E-B-D-F-G-H-E-G-D-A Eulerian Graph Theorem A connected graph is Eulerian if and only if each vertex of the graph is of even degree. Euler Path • An Euler path is a path that uses every edge of a graph exactly once. • An Euler circuit is a circuit that uses every edge of a graph exactly once. • An Euler path starts and ends at different vertices. • An Euler circuit starts and ends at the same vertex. Euler Path Theorem A connected graph contains an Euler path if and only if the graph has two vertices of odd degree with all other vertices of even degree. Furthermore, every Euler path must start at one of the vertices of odd degree and end at the other. 1 2 3 4 3-2-4-2-1-3-4 Weighted Graphs Hamiltonian Circuits • A Hamiltonian Circuit is a path that uses each vertex of a graph exactly once. • A graph that contains a Hamiltonian circuit is called Hamiltonian. Example: Hamiltonian Circuit Find a Hamiltonian circuit from this graph. 1-5-4-3-2-12-11-10-9-8-7-6-15-16-17-18-19-20-13-14-1 Example: Hamiltonian Circuit Find a Hamiltonian circuit from this graph. 1-5-4-8-7-6-15-14-13-12-11-19-20-16-17-18-9-10-3-2-1 Dirac’s Theorem Consider a connected graph with at least three vertices and no multiple edges. Let 𝑛 be the number of vertices in the 𝑛 graph. If every vertex has a degree of at least , then the 2 graph must be Hamiltonian. Dirac’s Theorem Note: If the graph does not meet the requirements of the Dirac’s Theorem, it still might be Hamitonian. Weighted Graph A weighted graph is a graph in which each edge is associated with a value, called a weight. The Greedy Algorithm A method of finding a Hamiltonian circuit in a complete weighted graph is given by the following greedy algorithm. 1. Choose a vertex to start at, then travel along the connected edge that has the smallest weight. 2. After arriving at the next vertex, travel along the edge of smallest weight that connects to a vertex not yet visited. Continue this process until you have visited all vertices. 3. Return to the starting vertex. The Greedy Algorithm Note: The greedy algorithm attempts to give a circuit of minimal total weight, although it does not always succeed. Example: Greedy Algorithm Use the greedy algorithm to find a Hamiltonian circuit starting at vertex A in the given weighted graph. A-D-B-C-F-E-A 1-2-3-6-4-5=21 The Edge-Picking Algorithm Another method of finding a Hamiltonian circuit in a complete weighted graph is given by the following edge-picking algorithm. 1. Mark the edge of smallest weight in the graph. 2. Mark the edge of the next smallest weight in the graph, as long as it does not complete a circuit and does not add a third marked edge to a single vertex. 3. Continue the process until you can no longer mark any edges. Then mark the final edge that completes the Hamiltonian circuit. The Edge-Picking Algorithm Note: The edge-picking algorithm attempts to give a circuit of minimal total weight, although it does not always succeed. Example: Edge Picking Algorithm Use the edge-picky algorithm to find a Hamiltonian circuit in the given weighted graph. A-D-B-F-E-C-A 1-2-4-4-7-2=20 Planarity and Euler’s Formula Planar Graphs A planar graph is a graph that can be drawn so that no edges intersect each other (except at vertices). Platonic Solids Subgraphs A part of a graph G is called a subgraph of G. Subgraph Theorem “If a graph G has a subgraph that is not planar, then G is also not planar. In particular, if it contains the Utilities Graph or K5 as a subgraph, G is not planar.” Nonplanar Graph Theorem A graph is nonplanar if and only if it has the Utilities Graph or K5 as a subgraph, or it has a subgraph that can be contracted to the Utilities Graph or K5. H is a subgraph of G if 𝑉 𝐻 ⊂𝑉 𝐺 𝐸 𝐻 ⊂𝐸 𝐺 Euler’s Formula In a connected planar graph drawn with no intersecting edges, let v be the number of vertices, e the number of edges, and f the number of faces. Then v + f = e + 2. Euler’s Formula v=6 e=9 v+f=e+2 6+5=9+2 f=5 Graph Colorings Coloring Map If the map is divided into regions in some manner, what is the minimum number of colors required if the neighboring regions are to be colored differently? There is a connection between map coloring and graph theory. Maps can be modeled by graphs using the countries as the vertices and two vertices (countries) are adjacent if they share a common boundary. In graph coloring, each vertex of a graph will be assigned one color in such away that no two adjacent vertices have the same color. The interesting idea here is to determine the minimum number of (distinct) colors to be used so that we can color each vertex of a graph with no two adjacent vertices have the same color. Four-Color Theorem Every planar graph is 4-colourable. The Chromatic Number of a Graph The minimum number of colors needed to color a graph so that no edge connects vertices of the same color is called the chromatic number. 2-Colorable Graph Theorem A graph is 2-colourable if and only if it has no circuits that consist of an odd number of vertices. Example: Look at the map. Assume that no country is split into more than one piece and countries that touch each other at just a corner point will not be considered neighbors. How many colors are needed? Example: Determine whether the graph is 2colorable. References: • Auffmann et al, Mathematical Excursions (2018) • https://www.youtube.com/watch?v=nZwSo4vfw6c • • Mame, Neil (Batangas State University), Manalang, Rodman (UE Manila), Maquiling Rene (Xavier University), Mocorro, Ronald (Leyte Normal University) – Powerpoint Presentation (2017) Manalang, R., Powerpoint – University of the East (2017)