Notes on Graph Theory
Published Sep 30, 2022
#math #csGraph Theory, as the name suggests, is the study of graphs. But what exactly is a graph?
Definition
A simple graph consists of a vertex set (not necessarily finite) and a finite edge set consisting of doubletons of .
This is a simple graph. The figure above shows a visualization of six vertices (also called nodes), connected by seven edges. A graph is simple if and only if it does not have more than one edge between any two vertices and no edge starts and ends at the same vertex.
We can extend simple graphs to allow more variety, such as multigraphs (nodes are allowed to be connected by multiple edges), pseudographs (self-connecting loops are also allowed), and hypergraphs (one edge can connect multiple nodes). Unless otherwise stated, assume any graphs are simple by convention in what follows.
Often, we also assign properties to vertices and edges. For example, in a directed graph, edges point specifically from one vertex to another. Edges and nodes might also have a weight, color, etc, assigned to them. Then we can optimize some function of these parameters in a subgraph satisfying some properties.
Applications of Graph Theory
It is relatively easy to see that graphs serve as good models for networks, and networks are interesting long before the advent of computers. One of the oldest problems in this theory goes back to Euler.
The Konisberg Bridge ProblemCan one start on one of the islands, cross each bridge exactly once, and end back on the original island?
Of course, we can model each island as a node and bridges as edges between the nodes. In fact, here we have a multigraph that is not simple.
This question was famously answered in the negative by Leonhard Euler. His solution to the problem laid the foundations for Graph Theory and conceptually, Topology. To this day, the two fields remain closely connected, despite being studied by disparate groups of mathematicians.
Planar graphs
The above image might inspire one to wonder: Are all graphs expressable as a 2-dimensional drawing?
Certainly one can project any graph onto the plane with no regard for structure, but mathematicians are interested in a more sophisticated question: Are all graphs expressable as a 2-dimensional drawing such that no edges intersect?
The answer is actually no, and graphs that do satisfy this property are called planar.
See Kuratowski’s Theorem for related info on the characterization of planar graphs.
Four Color Theorem
Many people are probably familiar with the Four Color Theorem, given it’s popularity with pop-science. The (layman) statement is quite simple, all ‘maps’ can be colored with four colors such that no two boundaries that share an edge are monochromatic. However, the proof and underlying mathematical reasonings are far from simple.
- The Six color theorem could be proven with half a page, and is a common exercise for a first year Graph Theory course.
- Five color theorem: Substantially harder, perhaps suitable as a research assignment.
- Four color theorem: Very difficult, and we still don’t have a pure pen and paper proof. A very large finite amount of cases were checked computationally.
Graph Isomorphism
Here’s a problem of high modern significance:
Graph Isomorphism ProblemCan you rearrange vertices without changing edge pairs to morph one graph into another?
It turns out solving this problem is quite difficult, and so far mathematicians have only been able to produce an algorithm in Quasi-polynomial time complexity. This problem has surged in popularity due to its relevance with P vs NP; A polynomial algorithm or lack thereof is relatively within reach and would contribute substantial progress towards the famous unsolved computer science problem.
Traversal
Paths, Walks, and Cycles
Let be a simple graph. A walk is defined as a sequence of vertices of vertices , where are connected by an edge for all . One could “walk” along these vertices consecutively and in order.
A path is a walk where contains no duplicate elements; are pairwise distinct.
A cycle is a sequence such that is a path and .
Connectivity
A simple graph is connected if for any two vertices , there exists a path connecting and .
A connected component is a subgraph such that is connected. In most cases, we can assume the graph we are working with is connected, as each connected component in an unconnected graph can usually be treated seperately.
Travelling Salesman
In the Konisberg Bridge Problem, we were asked, Can we traverse all the edges exactly once, and return to our starting node?
In most cases, however, we are more concerned with
Can we traverse all the nodes exactly once, and returning to our starting node?
Such a traversal is called a Hamiltonian Cycle. A graph that has such a cycle is considered Hamiltonian.
Exercise (Dirac's Theorem):If every vertex in a simple graph satsifies , is Hamiltonian.
Of practical signficance is the widely-studied Travelling Salesman Problem, where we further assign a cost to each edge. Now this into an optimization problem, where we not only consider whether or not it is possible to have a Hamiltonian Cycle, but to find the cycle with minimum cost.
To learn more about graph traversal, commonly appearing in informatics competitions, see the USACO Silver Guide and Gold Guide.
Density
A basic result concerning connected graphs is the following: . The theorem is sharp in the sense that equality is achieveable, in the form of Trees.
If a graph is “too sparse”, it can’t be connected.
Trees
A simple connected graph is said to be a Tree if any of the following are satisfied:
- has no cycles.
- For each pair of distinct vertices there is a unique path starting at and ending at .
Exercise:Prove that the three above definitions are equivalent.
On the other end of the spectrum, we have complete graphs, where there is an edge betwen every node. This the densest possible simple graph. These two special types of graphs are immensely useful.
Degrees and Neighborhoods
An adjacent vertex of , is a vertex connected to by an edge. The degree of a vertex , denoted , is the number of adjacent vertices of . The neighbourhood of is the subgraph of composed of all vertices adjacent to (does not include itself) and all edges connecting those vertices.
If we have a directed graph, we can be more specific with degrees. The outdegree, denoted , is the number of adjacent vertices with an edge pointing from to . Analogously, the indegree () is the number of adjacent vertices with an edge pointing from to .
Handshaking Lemma
For a finite undirected graph ,
Take a moment to convince yourself the lemma is true.
Exercise:In a finite undirected graph, prove that the number of vertices that have odd degree is even.
We also have the following two identities:
In a directed graph,
In a tournament, a complete directed graph,
Exercise:Prove the above identities.
Problem (2010 IMO Shortlist C5):players participated in a tennis tournament. Any two players have played exactly one game, and there was no tie game. We call a company of four players bad if one player was defeated by the other three players, and each of these three players won a game and lost another game among themselves. Suppose that there is no bad company in this tournament. Let and be respectively the number of wins and losses of the -th player. Prove that
The Complete Graph
The complete graph with vertices, denoted as , is a simple connected graph such that there is an edge between any two vertices. The complete graph is analogous to the symmetric group of group theory, in that it serves as a “mother of all graphs”. In other words, every finite simple graph can be realized as the subgraph of a complete graph. More precisely, every finite simple graph can be obtained from a complete graph by keeping the same vertex set and removing some edges from the edge set.
Exercise:How many edges does have? How many subgraphs with vertices?
Extremal Graph Theory
Complete graphs are also one of the central objects studied in extremal graph theory, which asks: What is the largest/smallest graph with some kind of property? Some significant results have come from studying graphs with no complete subgraph.
Mantel's Theorem:The maximum number of edges in a graph on vertices that does not have a subgraph is .
You can try proving this with induction, noting the equality case of a complete bipartite graph, a bipartite graph with an edge connecting every pair of vertices . Turan’s Theorem generalizes this result.
Graph Colorings
Complete graphs serve as the perfect setting to discuss graph colorings, which form a very popular class of contest problems. A vertex/edge coloring is an assignment for some finite set of colors , where it assigns each vertex/edge a color.
Size of the color set determines the order of the coloring.
We say that a graph is -colorable if one can color the vertices of using at most colors so that there are no monochromatic edges: that is, for each edge the two endpoints of have distinct colors.
The chromatic number of is the least integer such that is -colorable.
Colorability of the complete graph .
The complete graph is -colorable but not -colorable.
The proof is simple: It is obviously -colorable, as we can color each vertex a different color. It is not however -colorable as by the pigeonhole principle 2 vertices must share a color, but they must also be connected by an edge by definition.
Exercise:Prove the converse. That is, if a simple graph on vertices is not -colorable, it is .
Planar Graph Colorings
There’s an intuitive notion that graph colorings and topology should be intimately connected. This is motivated by the Map Coloring problem, posed by South African mathematician William Gilmour Guthrie in 1872. The problem arises exactly as the name suggests: when coloring a map (Guthrie was trying to color a map of England), how many colors must be available to guaratee that no two contiguous regions share the same color?
You probably already know the answer.
The Four Color Theorem, againWe are now in a position to restate this theorem with more sophisticated language: All planar graphs are 4-colorable.
In planar graphs, we also have the notion of faces, the regions of space bounded by edges. Faces can be unbounded. Note that they are not the same as regions in maps, which are actually expressed as nodes in planar graphs.
Exercise (Face-Shaking Lemma):Consider a connected planar graph . For a face let be the number of edges enclosing . Then
Exercise:Prove that for a connected planar graph , that
We also have the powerful Euler’s Formula.
Euler's Formula:In a connected planar graph,
Consider lines in the plane, no two parallel and no three concurrent. Convince yourself of Euler’s Formula. You might find that . In this context, we can imagine the unbounded line segments converge at an extra vertex at infinity.
Exercise:Suppose is a connected planar graph with a cycle. The length of the smallest cycle is called the graph’s girth, . Prove,
Bipartite Graphs
A bipartite graph is a graph that is 2-colorable.
Exercise:A simple finite graph is bipartite if and only if there exists no odd cycles.
Solution:A cycle is bipartite if and only if is even (Why?). Thus there are no odd cycles if and thus any is bipartite.
Now we tackle the harder direction: If is not bipartite then there must exist an odd cycle. Consider connected components seperately. Take any vertex in , assign it a color, and alternate colors assignments by depth. For to not be bipartite, there must exist adjacent vertices that are monochromatic. Since was colored by depth, cannot be colored directly from . Hence it must be colored from some , and similarly must be colored from some . If then we are done, otherwise continue to and so on. Since and thus is finite, there must exist such that . The cycle is odd and we are done.
Bipartite graphs are extremely applicable in the real world, because they model a lot of natural assignment problems. One of the basic questions that can be modelled by bipartite graphs is the following: Suppose at a worksite there are workers and different types of tasks that need to be completed (the tasks could involve electrical work, carpentry, transporting, etc.). For each worker there are certain tasks they can do, but they can only do one task at a time. How would one assign tasks to the workers as to minimal idling (i.e., as many workers should be working as possible) and no overlaps (i.e, each task should be done by at most one worker)?
We can restate this in graph theory. A vertex cover in a graph is a set of vertices that includes at least one endpoint of every edge, and a vertex cover is minimum if no other vertex cover has fewer vertices. A matching in a graph is a set of edges no two of which share an endpoint, and a matching is maximum if no other matching has more edges. So, in the general example above: Given a bipartite graph, what is the optimal matching satisfying some conditions?
As one can imagine, above question is analogous to many other applications, like assigning workers to employers, or applicants to colleges. Given their practical significance, there is a lot of interest in finding matchings which are somewhat optimal.
Konig's Theorem:In a bipartite graph, the number of edges in a maximal matching is equal to the number of vertices in a minimal vertex cover.
Although interesting, the notion of vertex covers is hardly every relevant in math olympiads due to its relative obscurity and counter-intuitive definition.
Hall’s Marriage Theorem
Hall’s Marriage Theorem characterizes the existance of perfect matchings. It is also a powerful tool in olympiads.
Perfect Matching
Let be a bipartition (where , denotes the 2 partitions). A perfect -matching is a matching such that every vertex in is matched to a vertex in .
Note that a perfect -matching exists only if .
Statement
Hall's Theorem:Let be a bipartition . Define as the neighborhood of of a subset of vertices . Then has a perfect -matching if and only if for every subset in we have
In other words, a perfect -matching exists if and only if for every subset of , has at least as many neighbours in as .
Bipartite Problems
Bipartitions, matchings, and Hall’s Theorem are common in olympiad combinatorics. For questions applying Hall’s, the difficulty is usually in formulating the question in a graph-theoretic way and finding the correct bipartition.
Problem:A Latin rectangle is an array with , such that each row and column consists of distinct numbers from the set . Prove for any Latin rectangle that can be extended to an Latin square.
Problem (2012 Putnam B3):A round-robin tournament of teams lasted for days, as follows: On each day, every team played one game against another team, with one team winning and one team losing in each of the games. Over the course of the tournament, each team played every other team exactly once. Can one necessarily choose one winning team from each day without choosing any team more than once? Prove or provide a counterexample.
Problem (2017 RMM Q5):Fix an integer . An sieve is an array with cells removed so that exactly one cell is removed from every row and every column. A stick is a or array for any positive integer . For any sieve , let be the minimal number of sticks required to partition . Find all possible values of , as varies over all possible sieves.
Challenge (2019 Canada MO Q5):A 2-player game is played on points, where no three points are collinear. Each move consists of selecting 2 of the points and drawing a new line segment connecting them. The first player to draw a line segment that creates an odd cycle loses. (An odd cycle must have all its vertices among the points from the start, so the vertices of the cycle cannot be the intersections of the lines drawn). Find all such that the player to move first wins.