Brief History Graph Theory What is a graph? It all began in 1736 when Leonhard Euler gave a proof that not all seven bridges over the Pregolya River could all be walked over once and end up where you started. This became known as the Konigsberg Bridge Problem First used to solve puzzles and analyze games but then was used for things like the Four Color Map Conjecture What is a graph? A finite set of vertices (V) and edges (E) Types of graphs Directed graph: a graph that has edges with specific directions Multigraph: a graph with parallel edges Definitions of Parts of Graphs Order: the number of vertices a graph has Size: the number of edges a graph has Adjacent vertices: vertices that share an edge Pseudograph: a graph with loops Degree of a vertex: number of edges that vertex has Simple graph: a graph with no loops or parallel edges 1
Degree Theorem In a graph G, the sum of the degrees of the vertices is equal to twice the number of edges Or the number of vertices with odd degree is even Find the degree of each of the following graphs: More Definitions.. Connected graphs: every pair of vertices can be reached from another one Cut vertex: removal of the vertex causes the graph to become disconnected Bridge: removal of an edge causes the graph to become disconnected Types of graphs, con t Complete graphs: a graph where all vertices share an edge Empty graph: a graph with no edges Complement: a graph that contains all the edges that are not present in the original graph Regular graphs: graphs where every vertex has the same degree Example 3 Draw a complete graph with 4 vertices Draw the complement of Graph Theory Draw a graph with a cut vertex and a bridge Walks, Paths and Circuits 2
Definitions Walk: sequence of vertices Path: walk in which no edge is repeated Definitions, con t Euler circuit: a circuit that traverses every edge exactly once If graph has an Euler circuit then every vertex has even degree Length of a path: number of edges in a path Circuit: path that starts and ends at the same vertex, also known as a cycle Adjacency Matrices for Graphs Adjacency matrix: an n x n matrix for a graph with n vertices where each entry is the number of edges from each vertex to all the others Example 1 Suppose A, B and C are three cities. Every day there are 2 nonstop flights from A to B, 3 from B to C and 1 from A to C. There are 2 nonstop flights from B to A, 2 from C to B, and 1 from C to A. Write the adjacency matrix for this information. Draw a picture of a directed graph that has the following adjacency matrix: 1 2 1 0 0 0 1 3 0 0 2 0 1 1 0 0 Example 3 Find the number of walks of length 2 from v 2 to v 1 in this graph. Find the number of walks of length 3 from v 1 to v 3 in this graph. 3
Definitions Graph Theory A tree is a connected graph that contains no circuits. Forest: a collection of trees Leaf: a vertex of degree 1 Trees Examples of Trees Modeling outcomes of an experiment Programmers use tree structures to facilitate searches and sorts to model logic of algorithms Properties of Trees If T is a tree of order n, then T has n 1 edges A graph of order n is a tree if and only if it is connected and contains n 1 edges If F is a forest of order n containing k connected components, then F contains n k edges Chemist use trees to represent chemical compounds College basketball tournaments Example 1 Say whether or not you can draw any of the following: A 10 vertex forest with exactly 12 edges A 12 vertex forest with exactly 10 edges A 14 vertex forest with exactly 14 edges A 14 vertex forest with exactly 13 edges A 14 vertex forest with exactly 12 edges Spanning Trees T is a spanning tree of a graph G if it contains every vertex of G Weighted graph: a graph that has real nonnegative real numbers assigned to each edge Minimum weight spanning tree: a spanning tree T with a weight smaller than all the other spanning trees 4
Kruskal s Algorithm Used to find minimum weight spanning trees Algorithm steps 1. Find an minimum edge and mark it 2. Among the unmarked edges that do not form a circuit with any of the marked edges, choose an edge of minimum weight and mark it 3. If the set of marked edges forms a spanning tree of G, then stop. If not repeat step 2. Find the minimum spanning tree of the following graph. Counting Trees Cayley s Tree Formula Gives a formula to count the number of different labeled trees on n vertices There are n n 2 distinct labeled trees of order n Graph Theory Planarity and Euler s Formula Definitions Crossing: a place in a graph where it looks like two edges intersect but not at their endpoints Planar graph: a graph G is planar if it can be drawn in such a way that the edges only intersect at the vertices, i.e. no crossings Planar representation: a drawing of a planar graph G in which edges only intersect at vertices Example 1 Draw of planar representation of the following graph, if possible. 5
Are the following graphs planar? How can we tell if the graph is planar? Region: a maximal section of the plane in which any two points can be joined by a curve that does not intersect any part of G. Or an area bounded by edges How can we tell if the graph is planar? Study these planar graphs and see if you can find a pattern. (n = vertices, q = edges and r = regions) Euler s Formula If G is a connected planar graph with n vertices, q edges and r regions, then n q + r = 2. Another cool property: if G is a planar graph with n greater than or equal to 3 vertices and q edges, then q 3n 6. Furthermore, if equality holds, then every region is bounded by three edges. Graphs that are Nonplanar There are two common graphs that are nonplanar. Regular Polyhedra Polyhedron: a solid bounded by flat surfaces If we deflate a polyhedron we can create a graph Also any graph that has these graphs as part of them are nonplanar. 6
Regular Polyhedra How many regular polyhedra exist? The neat thing about any polyhedra is that all their graphs are planar They follow Euler s Formula but this time we use vertices, edges and faces (instead of regions) So if a polyhedron has V vertices, E edges, and F faces, then V E + F = 2. Coloring Basics Graph Theory Graph Colorings k-coloring of the vertices of a graph is the number of colors needed so that no adjacent vertices are the same color, then it is k-colorable Only considering vertex colorings, not edge colorings Chromatic number: smallest integer such that a graph is k- colorable, or the smallest number of colors needed to color a graph Example 1 Find the chromatic number of the following graphs: In assigning frequencies to cellular phones, a zone gets a frequency to be used by all vehicles in the zone. Two zones that interfere (because of proximity or meteorological reasons) must get different frequencies. How many different frequencies are required if there are six zones, a, b, c, d, e, f and zone a interferes with zone b; zone b interferes with a, c, and d; c interferes with b, d, and e; d interferes with b, c, and e; e interferes with c, d, and f; and f interferes only with e? 7
Graph Coloring Algorithm Greedy Algorithm: 1. Label the vertices 2. Label the colors 3. Assign color 1 to vertex 1, if vertex 1 and 2 are adjacent use a different color or if not adjacent use 1 again 4. Continue to assign colors based on what vertices are adjacent to the other The Four Color Problem Is it true that the countries on any given map can be colored with four or fewer colors in such a way that adjacent countries are colored differently? First studied in 1852 by Francis Guthrie but was not proved until 1976 Four Color Theorem Every planar graph is 4-colorable. Example 3 Determine the chromatic number of this graph: Every planar graph is 5-colorable. 8
Francis Gutherie conjectured that any map can be colored using only 4 colors or fewer. Modular Arithmetic and Change of Base Modular Arithmetic Example 1 Let a and b be integers and let m be a positive integer. Then a b(mod m) if and only if a and b have the same integer remainder when they are divided by m. Show that 38 14 mod12 using the first definition and the Congruence Theorem. Congruence Theorem: integers a and b and positive integers m, a b(mod m) if and only if m is a factor of a - b Books published since 1972 are assigned ten-digit ISBNs. The first 9 digits give information; the last digit is a check digit. The check digit is obtained by multiplying the first nine digits by 10, 9, 8, 7, 6, 5, 4, 3, and 2, respectively. The opposite of the sum of these products must be congruent to the check digit mod 11. Fill in the correct check digit for 0-688-03118-. Properties of Modular Arithmetic Let a, b, c, and d be any integers and let m be a positive integer. If a b(mod m) and c d(mod m) then: Addition Property of Congruence: Subtraction Property of Congruence: Multiplication Property of Congruence: 9
Example 3 Find the last three digits of 19 9. Number Bases and Conversions Base 2 or binary notation: numbers represented by 0 and 1 Other bases uses similar numbers for example base 3 uses 0, 1, and 2 and base 7 uses 0, 1, 2, 3, 4, 5, and 6. Example 4 and 5 Give the base 10 representation for the number 11011011 2. Example 6 and 7 Change 2110 3 to base 10. Write 289 in base 2. Change 78 to base 3. 10