Skip to main content
Logo image

Chapter 4 Graph Theory

In the time of Euler, in the town of Königsberg in Prussia, there was a river containing two islands. The islands were connected to the banks of the river by seven bridges (as seen below). The bridges were very beautiful, and on their days off, townspeople would spend time walking over the bridges. As time passed, a question arose: was it possible to plan a walk so that you cross each bridge once and only once? Euler was able to answer this question. Are you?
Drawing of a river (blue) running left to right with two islands. There are 7 bridges over the river: two from the top bank to the left island, two from the left island to the bottom bank, and a bridge from the right island to each of the top bank, bottom bank, and left island.
Graph Theory is a relatively new area of mathematics, first studied by the super famous mathematician Leonhard Euler in 1735. Since then it has blossomed in to a powerful tool used in nearly every branch of science and is currently an active area of mathematics research.
The problem above, known as the Seven Bridges of Königsberg, is the problem that originally inspired graph theory. Consider a “different” problem: Below is a drawing of four dots connected by some lines. Is it possible to trace over each line once and only once (without lifting up your pencil, starting and ending on a dot)?
Three dots aligned in a vertical column left of a single dot on the right.  Lines connect the dot on the right to each dot on the left.  Among the dots on the left, two arced lines connect the bottom dot to the center dot, and two more connect the center dot to the top dot.
There is an obvious connection between these two problems. Any path in the dot and line drawing corresponds exactly to a path over the bridges of Königsberg.
Pictures like the dot and line drawing are called graphs. Graphs are made up of a collection of dots called vertices and lines connecting those dots called edges. When two vertices are connected by an edge, we say they are adjacent. The nice thing about looking at graphs instead of pictures of rivers, islands and bridges is that we now have a mathematical object to study. We have distilled the “important” parts of the bridge picture for the purposes of the problem. It does not matter how big the islands are, what the bridges are made out of, if the river contains alligators, etc. All that matters is which land masses are connected to which other land masses, and how many times.
We will return to the question of finding paths through graphs later. But first, here are a few other situations you can represent with graphs:

Example 4.0.1.

Al, Bob, Cam, Dan, and Euler are all members of the social networking website Facebook. The site allows members to be “friends” with each other. It turns out that Al and Cam are friends, as are Bob and Dan. Euler is friends with everyone. Represent this situation with a graph.
Each person will be represented by a vertex and each friendship will be represented by an edge. That is, two vertices will be adjacent (there will be an edge between them) if and only if the people represented by those vertices are friends.
A graph with 4 vertices forming a square and fifth vertex centered between them.  Vertices are labeled: A (top left), B (top right), C (bottom right), D (bottom left), and E (center).

Example 4.0.2.

Each of three houses must be connected to each of three utilities. Is it possible to do this without any of the utility lines crossing?
We will answer this question later. For now, notice how we would ask this question in the context of graph theory. We are really asking whether it is possible to redraw the graph below without any edges crossing (except at vertices). Think of the top row as the houses, bottom row as the utilities.
A graph with six vertices arranged in two rows of three.  There are nine edges, connecting each dot in the top row to each dot in the bottom row.