You are on page 1of 24



Euler's Formula
If G is a planar graph, then any plane drawing of G divides the plane
into regions, called faces. One of these faces is unbounded, and is
called the infinite face. If f is any face, then the degree of f (denoted
by deg f) is the number of edges encountered in a walk around the
boundary of the face f. If all faces have the same degree (g, say), the
G is face-regular of degree g.

For example, the following graph G has four faces, f4 being the infinite

It is easy to see from above graph that deg f1=3, deg f2=4, deg f3=9,
deg f4=8.

Note that the sum of all the degrees of the faces is equal to twice the
number of edges in the the graph , since each edge either borders
two different faces (such as bg, cd, and cf) or occurs twice when walk
around a single face (such as ab and gh). The Euler's formula relates
the number of vertices, edges and faces of a planar graph. If n, m,
and f denote the number of vertices, edges, and faces respectively of
a connected planar graph, then we get n-m+f = 2.

The Euler formula tells us that all plane drawings of a connected

planar graph have the same number of faces namely, 2+m-n.
(Euler's Formula) Let G be a connected planar graph, and
let n, m and f denote, respectively, the numbers of vertices,
edges, and faces in a plane drawing of G. Then n - m + f =

Proof We employ mathematical induction on edges, m. The

induction is obvious for m=0 since in this case n=1 and f=1. Assume
that the result is true for all connected plane graphs with fewer than m
edges, where m is greater than or equal to 1, and suppose that G has
m edges. If G is a tree, then n=m+1 and f=1 so the desired formula
follows. On the other hand, if G is not a tree, let e be a cycle edge of
G and consider G-e. The connected plane graph G-e has n vertices,
m-1 edges, and f-1 faces so that by the inductive hypothesis,

n - (m - 1) + (f - 1) = 2
which implies that

n - m + f = 2.

We can obtains a number of useful results using Euler's formula. (A

"corollary" is a theorem associated with another theorem from which
it can be easily derived.)

Nineteen Proofs of Euler's Formula: V-E+F=2

Many theorems in mathematics are important enough that they have
been proved repeatedly in surprisingly many different ways.
Examples of this include the existence of infinitely many prime
numbers, the evaluation of zeta(2), the fundamental theorem of
algebra (polynomials have roots), quadratic reciprocity (a formula for
testing whether an arithmetic progression contains a square) and the
Pythagorean theorem (which according to Wells has at least 367
proofs). This also sometimes happens for unimportant theorems,
such as the fact that in any rectangle dissected into smaller
rectangles, if each smaller rectangle has integer width or height, so
does the large one.

This page lists proofs of the Euler formula: for any convex
polyhedron, the number of vertices and faces together is exactly two
more than the number of edges. Symbolically V-E+F=2. For instance,
a tetrahedron has four vertices, four faces, and six edges; 4-6+4=2.

According to Malkevitch, this formula was discovered in around 1750

by Euler, and first proven by Legendre in 1794. Earlier, Descartes
(around 1639) discovered a related polyhedral invariant (the total
angular defect) but apparently did not notice the Euler formula itself.
Hilton and Pederson provide more references as well as entertaining
speculation on Euler's discovery of the formula. Confusingly, other
equations such as ei pi = -1 and aphi(n) = 1 (mod n) also go by the name
of "Euler's formula"; Euler was a busy man.

The polyhedron formula, of course, can be generalized in many

important ways, some using methods described below. One
important generalization is to planar graphs. To form a planar graph
from a polyhedron, place a light source near one face of the
polyhedron, and a plane on the other side.

shadows of
edges form
a planar
in such a
way that the
edges are
straight line
segments. The faces of the polyhedron correspond to convex
polygons that are faces of the embedding. The face nearest the light
source corresponds to the outside face of the embedding, which is
also convex. Conversely, any planar graph with certain connectivity
properties comes from a polyhedron in this way.

Some of the proofs below use only the topology of the planar graph,
some use the geometry of its embedding, and some use the three-
dimensional geometry of the original polyhedron. Graphs in these
proofs will not necessarily be simple: edges may connect a vertex to
itself, and two vertices may be connected by multiple edges. Several
of the proofs rely on the Jordan curve theorem, which itself has
multiple proofs; however these are not generally based on Euler's
formula so one can use Jordan curves without fear of circular

• Proof 1: Interdigitating Trees

• Proof 2: Induction on Faces
• Proof 3: Induction on Vertices
• Proof 4: Induction on Edges
• Proof 5: Divide and Conquer
• Proof 6: Electrical Charge
• Proof 7: Dual Electrical Charge
• Proof 8: Sum of Angles
• Proof 9: Spherical Angles
• Proof 10: Pick's Theorem
• Proof 11: Ear Decomposition
• Proof 12: Shelling
• Proof 13: Triangle Removal
• Proof 14: Noah's Ark
• Proof 15: Binary Homology
• Proof 16: Binary Space Partition
• Proof 17: Valuations
• Proof 18: Hyperplane Arrangements
• Proof 19: Integer-Point Enumeration

The Königsberg Bridge problem

The paper written by Leonhard Euler on the Seven Bridges of

Königsberg and published in 1736 is regarded as the first paper in the

history of graph theory.[1] This paper, as well as the one written by

Vandermonde on the knight problem, carried on with the analysis
situs initiated by Leibniz. Euler's formula relating the number of
edges, vertices, and faces of a convex polyhedron was studied and
generalized by Cauchy[2] and L'Huillier,[3] and is at the origin of

More than one century after Euler's paper on the bridges of

Königsberg and while Listing introduced topology, Cayley was led by
the study of particular analytical forms arising from differential
calculus to study a particular class of graphs, the trees. This study
had many implications in theoretical chemistry. The involved
techniques mainly concerned the enumeration of graphs having
particular properties. Enumerative graph theory then rose from the
results of Cayley and the fundamental results published by Pólya
between 1935 and 1937 and the generalization of these by De Bruijn
in 1959. Cayley linked his results on trees with the contemporary
studies of chemical composition.[4] The fusion of the ideas coming
from mathematics with those coming from chemistry is at the origin of
a part of the standard terminology of graph theory. In particular, the
term "graph" was introduced by Sylvester in a paper published in
1878 in Nature.[5]

One of the most famous and productive problems of graph theory is

the four color problem: "Is it true that any map drawn in the plane
may have its regions colored with four colors, in such a way that any
two regions having a common border have different colors?". This
problem was first posed by Francis Guthrie in 1852 and its first
written record is in a letter of De Morgan addressed to Hamilton the
same year. Many incorrect proofs have been proposed, including
those by Cayley, Kempe, and others. The study and the
generalization of this problem by Tait, Heawood, Ramsey and
Hadwiger led to the study of the colorings of the graphs embedded on
surfaces with arbitrary genus. Tait's reformulation generated a new
class of problems, the factorization problems, particularly studied by
Petersen and Kőnig. The works of Ramsey on colorations and more
specially the results obtained by Turán in 1941 was at the origin of
another branch of graph theory, extremal graph theory.

The four color problem remained unsolved for more than a century. A
proof produced in 1976 by Kenneth Appel and Wolfgang Haken[6][7],
which involved checking the properties of 1,936 configurations by
computer, was not fully accepted at the time due to its complexity. A
simpler proof considering only 633 configurations was given twenty
years later by Robertson, Seymour, Sanders and Thomas.[8]

The autonomous development of topology from 1860 and 1930

fertilized graph theory back through the works of Jordan, Kuratowski
and Whitney. Another important factor of common development of
graph theory and topology came from the use of the techniques of
modern algebra. The first example of such a use comes from the
work of the physicist Gustav Kirchhoff, who published in 1845 his
Kirchhoff's circuit laws for calculating the voltage and current in
electric circuits.

The introduction of probabilistic methods in graph theory, especially

in the study of Erdős and Rényi of the asymptotic probability of graph
connectivity, gave rise to yet another branch, known as random
graph theory, which has been a fruitful source of graph-theoretic

Graph Theory and the Bridges of Königsberg

Königsberg was a city in Prussia situated on the Pregel River, which

served as the residence of the dukes of Prussia in the 16th century.
(Today, the city is named Kaliningrad, and is a major industrial and
commercial center of western Russia.) The river Pregel flowed
through the town, creating an island, as in the following picture.
Seven bridges spanned the various branches of the river, as shown.
The Bridges of Königsberg
A famous problem concerning Königsberg was whether it was
possible to take a walk through the town in such a way as to cross
over every bridge once, and only once. An example of a failed
attempt to take such a walking tour is shown below.

OK, so this attempt didn't work. But might there be some other path
that would cross every bridge exactly once? This problem was first
solved by the prolific Swiss mathematician Leonhard Euler
(pronounced "Oiler"), who invented the branch of mathematics now
known as graph theory in the process of his solution.


Euler's approach was to regard the spots of land (there are 4 of them)
as points to be visited, and the bridges as paths between those
points. The mathematical essentials of the map of Königsberg can
then be reduced to the following diagram, which is an example of
what is called a graph:

A graph is a figure consisting of points (called vertices--the plural of

vertex) and connecting lines or curves (called edges). The problem
of the bridges of Königsberg can then be reformulated as whether
this graph can be traced without tracing any edge more than once.

For each of the vertices of a graph, the order of the vertex is the
number of edges at that vertex. The figure below shows the graph of
the Königsberg bridge problem, with the orders of the vertices

Euler's Solution
Euler's solution to the problem of the Königsberg bridges involved the
observation that when a vertex is "visited" in the middle of the
process of tracing a graph, there must be an edge coming into the
vertex, and another edge leaving it; and so the order of the vertex
must be an even number. This must be true for all but at most two of
the vertices--the one you start at, and the one you end at, and so a
connected graph is traversible if and only if it has at most two vertices
of odd order. (Note that the starting and ending vertices may be the
same, in which case the order of every vertex must be even.) Now a
quick look at the graph above shows that there are more than two
vertices of odd order, and so the graph cannot be traced; that is the
desired walking tour of Königsberg is impossible.

Additional Fun with Graphs

1. Suppose the citizens of Königsberg decided to build an eighth

bridge, as in the diagram shown below. Would a walking tour of
Königsberg now be possible?

2. Show how you could add a ninth bridge to the diagram above, to
make the walking tour once again impossible.

A Different Problem with the Same Solution

Euler's solution can also be applied to problems that at first look
different from the problem of the Königsberg bridges. Consider the
problem of whether it is possible to draw a continuous curve that
passes through each of the ten edges (line segments) of the following
figure exactly once. (A curve that passes through a vertex is not
The next figure shows a start on a possible solution.

Is there a systematic way to approach this problem? To analyze this

problem, we will create a graph with four vertices, one for each of the
four regions (including the outside region, D). There will be ten edges
in our graph, one for each of the boundary edges between two of the
regions. For instance, our graph will have three edges between the
vertices for regions A and D, because there are three boundary
edges between regions A and D in the figure above. The resulting
graph can be drawn as follows:
The question of whether there is a continuous curve passing through
all ten edges is equivalent to the question of whether this graph can
be traced. Since there are only two vertices of odd order, Euler's
theorem not only answers the question in the affirmative, but also
tells you that you must start either in region A or in region D.

Can you determine whether it is possible to draw a continuous curve

that passes through each of the edges of the following figure exactly
once? Now that you know the secret, you can easily make up your
own similar challenges.

Graph Theory Today

Today, graph theory is a highly developed field of mathematics, and
is both a fertile ground for the creation of new mathematics and an
area with many, many applications. Many research problems in
graph theory are easily stated and easily understood (although
perhaps not easily solved). A few of the applications of graph theory
include transportation and warehousing applications, planning and
scheduling, analysis of electrical networks, and even understanding
the Internet!
1. Properties

o 1.1 Possible multiplicity

o 1.2 Uniqueness
o 1.3 Minimum-cost sub graph
o 1.4 Cycle property
o 1.5 Cut property
• 2 Pseudo Code
• 3 Algorithms
• 4 MST on complete graphs
• 5 Related problems
• 6 See also
• 7 References
• 8 External links
Donate Now »


The minimum spanning tree of a planar graph. Each edge is labeled with its
weight, which here is roughly proportional to its length.

Given a connected, undirected graph, a spanning tree of that graph is a sub

graph which is a tree and connects all the vertices together. A single graph can
have many different spanning trees. We can also assign a weight to each edge,
which is a number representing how unfavorable it is, and use this to assign a
weight to a spanning tree by computing the sum of the weights of the edges in
that spanning tree. A minimum spanning tree or minimum weight spanning
tree is then a spanning tree with weight less than or equal to the weight of every
other spanning tree. More generally, any undirected graph (not necessarily
connected) has a minimum spanning forest, which is a union of minimum
spanning trees for its connected components.

One example would be a cable TV company laying cable to a new neighborhood.

If it is constrained to bury the cable only along certain paths, then there would be
a graph representing which points are connected by those paths. Some of those
paths might be more expensive, because they are longer, or require the cable to
be buried deeper; these paths would be represented by edges with larger
weights. A spanning tree for that graph would be a subset of those paths that has
no cycles but still connects to every house. There might be several spanning
trees possible. A minimum spanning tree would be one with the lowest total cost.


A tree is a connected graph without cycles.


° A graph is a tree if and only if there is one and only one path joining any two of
its vertices.

° A connected graph is a tree if and only if every one of its edges is a bridge.

° A connected graph is a tree if and only if it has N vertices and N; 1 edges.


° A sub graph that spans (reaches out to) all vertices of a graph are called a
spanning sub graph.

° A sub graph that is a tree and that spans (reaches out to) all vertices of the
original graph are called a spanning tree.
° among all the spanning trees of a weighted and connected graph, the one
(possibly more) with the least total weight is called a minimum spanning tree

• Step 1

Find the cheapest edge in the graph (if there is more than one, pick one at
random). Mark it with any given color, say red.

• Step 2

Find the cheapest unmarked (uncolored) edge in the graph that doesn't
close a coloured or red circuit. Mark this edge red.

• Step 3

Repeat Step 2 until you reach out to every vertex of the graph (or you
have N; 1 coloured edges, where N is the number of Vertices.) The red
edges form the desired minimum spanning tree.

o Kruskal Step by Step

o Tutorial Kruskal
o Interactive Kruskal's Algorithm


• Step 0

Pick any vertex as a starting vertex. (Call it S). Mark it with any given
color, say red.

• Step 1

Find the nearest neighbor of S (call it P1). Mark both P1 and the edge SP1
red. Cheapest unmarked (uncolored) edge in the graph that doesn't close
a coloured circuit. Mark this edge with same color of Step 1.

• Step 2

Find the nearest uncolored neighbor to the red sub graph (i.e., the closest
vertex to any red vertex). Mark it and the edge connecting the vertex to the red
sub graph in red.
• Step 3

Repeat Step 2 until all vertices are marked red. The red sub graph is a
minimum spanning tree.

• Interactive Prim's Algorithm

Given the graph G below

1. Find a spanning sub graph of G and draw it below.

2. Draw all the different spanning trees of G

3. Of those you had in # 2, which one(s) is (are) minimum spanning trees. (i.e.,
those those have a minimum sum of their weighted edges.)

Given the weighted graph below:

1. Use Kruskal's algorithm to find a minimum spanning tree and indicate the
edges in the graph shown below: Indicate on the edges that are selected the
order of their selection.

2. Use Prim's algorithm to find the minimum spanning tree and indicate the edges
in the graph shown below. Indicate on the edges that are selected the order of
their selection.

Suppose we are given G = (V, E). We assume G is connected. (If not, then
The algorithm will find a minimal spanning tree for the component we
Happen to start in.)

Let B be the set of tree vertices, initially empty.

Let T be the set of tree edges, initially empty.

Choose any v in V.

Set B = B "UNION" {v}.

While B <> V do

Select the minimum weight edge (u, w) with u in V - B, w in BSet T = T "UNION"

{(u. w)}.

Set B = B "UNION" {u}

Example. If G is the graph in Figure 2, then initially choose v = vertex 1. We get

the following steps:

Iteration B V-B edge chosen T

1 {1} {2, 3, 4, 5} (1, 5) {(1, 5)}

2 {1, 5} {2, 3, 4} (1, 2) {(1, 5) (1, 2)}

3 {1, 2, 5} {3, 4} (2, 3) {(1, 5), (1, 2), (2, 3)}

4 {1,2,3,5} {4} (3,4) {(1,5),(1,2),(2,3), (3, 4)}

Note that at step 3 we could have chosen to add edge (2, 4) instead of (2, 3).

At step 4 we could have chosen to add edge (2, 4) instead of (3, 4).

Now it is fairly easy to see that the algorithm finds a spanning tree for G. But is it
a minimal spanning tree? To see that it is, we need the following lemma.

Lemma. Suppose E1 is a subset of E with the property that E1 is a subset of the

edges in a minimal spanning tree T for G. Let V1 be the set of vertices incident
with edges in E1. Let (u, v) be an edge of minimal weight with the property that u
is in V - V1 and v is in V1. Then E1 union {(u, v)} is also a subset of a minimal
spanning tree. (figure3).

Proof. If the edge (u, v) is in the minimal spanning tree T, then we are done. If (u,
v) is not in T, on the other hand, then there is a path from u to v in T. Let (x, y) be
the edge in this path with exactly one vertex in V1. Call this vertex x. (Figure 4).
Let T1 be T with edge (x, y) removed and edge (u, v) added. Then E1 union {(u,
v)} is contained in T1 and T1 is a spanning tree. Now by the choice of (u, v) we
know that the weight of (u, v) is less than or equal to the weight of (x, y).
Therefore the weight of T1 is less than or equal to the weight of T, i.e., T1 is a
minimal spanning tree for G.

Kruskal's Algorithm. . Another algorithm for finding a minimum spanning tree

uses the set data structure. Let G be a connected graph with n vertices and
nonnegative edge weights.

Initialize n components, each one containing one vertex of G.

Now sort the edges in increasing order by weight and set T = the empty set.

Now examine each edge in turn. If an edge joins two components, add it to T and
merge the two components into one. If not, discard the edge.

Stop when only one component remains.

Example. Consider the graph in Figure 2.

Sorted edges: (1, 5), (2, 4), (2, 3), (3, 4), (1, 2), (4, 5)

Step Components add T

1 {1}. {2}, {3}, {4}, {5} (1, 5) (1, 5)

2 {1, 5}, {2}, {3}, {4} (2, 4) (1, 5), (2, 4)

3 {1,5},{2,4},{3} (2,3) (1,5),(2,4),(2,3)

4 {1,5},{2,3,4} (1,2) (1,5),(2,4),(2,3),(1,2)

Possible multiplicity

There may be several minimum spanning trees of the same weight; in particular,
if all weights are the same, every spanning tree is minimum.

If each edge has a distinct weight then there will only be one, unique minimum
spanning tree. The proof of this fact can be done by induction or contradiction.
This is true in many realistic situations, such as the cable TV company example
above, where it's unlikely any two paths have exactly the same cost. This
generalizes to spanning forests as well.


If the weights are non-negative, then a minimum spanning tree is in
fact the minimum-cost subgraph connecting all vertices, since
subgraphs containing cycles necessarily have more total weight.

For any cycle C in the graph, if the weight of an edge e of C is larger than the
weights of other edges of C, then this edge cannot belong to an MST. Indeed,
assume the contrary, i.e., e belongs to an MST T1. If we delete it, T1 will be
broken into two subtrees with the two ends of e in different subtrees. The
remainder of C reconnects the subtrees, hence there is an edge f of C with ends
in different subtrees, i.e., it reconnects the subtrees into a tree T2 with weight
less than that of T1, because the weight of f is less than the weight of e.

For any cut C in the graph, if the weight of an edge e of C is smaller than the
weights of other edges of C, then this edge belongs to all MSTs of the graph.
Indeed, assume the contrary, i.e., e does not belong to an MST T1. Then adding
e to T1 will produce a cycle, which must have another edge e2 from T1 in the cut
C. Replacing e2 with e, would produce a tree T1 of smaller weight.

The first algorithm for finding a minimum spanning tree was developed by Czech
scientist Otakar Borůvka in 1926 (see Borůvka's algorithm). Its purpose was an
efficient electrical coverage of Moravia. There are now two algorithms commonly
used Prim's algorithm and Kruskal's algorithm. All three are greedy algorithms
that run in polynomial time, so the problem of finding such trees is in FP, and
related decision problems such as determining whether a particular edge is in the
MST or determining if the minimum total weight exceeds a certain value are in P.
Another greedy algorithm not as commonly used is the reverse-delete algorithm,
which is the reverse of Kruskal's algorithm.

The fastest minimum spanning tree algorithm to date was developed by Bernard
Chazelle, which is based on the Soft Heap, an approximate priority queue. [1] [2]
Its running time is O (e α (e, v)), where e is the number of edges, v is the number
of vertices and α is the classical functional inverse of the Ackermann function.
The function α grows extremely slowly, so that for all practical purposes it may be
considered a constant no greater than 4; thus Chazelle's algorithm takes very
close to linear time.

What is the fastest possible algorithm for this problem? That is one of the oldest
open questions in computer science. There is clearly a linear lower bound, since
we must at least examine all the weights. If the edge weights are integers with a
bounded bit length, then deterministic algorithms are known with linear running
time. For general weights, there are randomized algorithms whose expected
running time is linear.

Whether there exists a deterministic algorithm with linear running time for general
weights is still an open question. However, Seth Pettie and Vijaya
Ramachandran have found a provably optimal deterministic minimum spanning
tree algorithm, the computational complexity of which is unknown.

More recently, research has focused on solving the minimum spanning tree
problem in a highly parallelized manner. With a linear number of processors it is
possible to solve the problem in O (log n) time. A 2003 paper "Fast Shared-
Memory Algorithms for Computing the Minimum Spanning Forest of Sparse
Graphs" by David A. Bader and Guojing Cong demonstrates a pragmatic
algorithm that can compute MSTs 5 times faster on 8 processors than an
optimized sequential algorithm. Typically, parallel algorithms are based on
Boruvka's algorithm — Prim's and especially Kruskal's algorithm do not scale as
well to additional processors.
Other specialized algorithms have been designed for computing minimum
spanning trees of a graph so large that most of it must be stored on disk at all
times. These external storage algorithms, for example as described in
"Engineering an External Memory Minimum Spanning Tree Algorithm" by Roman
Dementiev et al.,[10] can operate as little as 2 to 5 times slower than a traditional
in-memory algorithm; they claim that "massive minimum spanning tree problems
filling several hard disks can be solved overnight on a PC." They rely on efficient
external storage sorting algorithms and on graph contraction techniques for
reducing the graph's size efficiently.

MST on complete graphs

It has been shown by J. Michael Steele based on work by Alan M. Frieze that
given a complete graph on n vertices, with edge weights chosen from a
continuous random distribution f such that f'(0) > 0, as n approaches infinity the
size of the MST approaches ζ (3) / f'(0), where ζ is the Riemann zeta function.

For uniform random weights in [0, 1], the exact expected size of the minimum
spanning tree has been computed for small complete graphs.

Expected size Approximate expected size

2 1/2 0.5

3 3/4 0.75

4 31 / 35 0.8857143

5 893 / 924 0.9664502

6 278 / 273 1.0183151

7 30739 / 29172 1.053716

8 199462271 / 184848378 1.0790588

9 126510063932 / 115228853025 1.0979027

Related problems

A related graph is the k-minimum spanning tree (k-MST) which is the tree that
spans some subset of k vertices in the graph with minimum weight.

A set of k-smallest spanning trees is a subset of k spanning trees (out of all

possible spanning trees) such that no spanning tree outside the subset has
smaller weight. (Note that this problem is unrelated to the k-minimum spanning

The Euclidean minimum spanning tree is a spanning tree of a graph with edge
weights corresponding to the Euclidean distance between vertices.

In the distributed model, where each node is considered a computer and no node
knows anything except its own connected links, one can consider Distributed
minimum spanning tree. Mathematical definition of the problem is the same but
has different approaches for solution.

For directed graphs, the minimum spanning tree problem can be solved in
quadratic time using the Chu–Liu/Edmonds algorithm.