This document provides lecture notes on spanning trees. It begins with an introduction to graphs and defines a spanning tree as a tree containing all the vertices of a connected graph with no cycles. It then discusses two algorithms for computing a spanning tree - a vertex-centric algorithm that marks vertices as being in the tree, and an edge-centric algorithm that connects singleton trees with edges. The document also covers using spanning trees to generate random mazes and finding minimum weight spanning trees using properties of cycles and Kruskal's algorithm.
On algorithmic problems concerning graphs of higher degree of symmetrygraphhoc
Since the ancient determination of the five platonic solids the study of symmetry and regularity has always
been one of the most fascinating aspects of mathematics. One intriguing phenomenon of studies in graph
theory is the fact that quite often arithmetic regularity properties of a graph imply the existence of many
symmetries, i.e. large automorphism group G. In some important special situation higher degree of
regularity means that G is an automorphism group of finite geometry. For example, a glance through the
list of distance regular graphs of diameter d < 3 reveals the fact that most of them are connected with
classical Lie geometry. Theory of distance regular graphs is an important part of algebraic combinatorics
and its applications such as coding theory, communication networks, and block design. An important tool
for investigation of such graphs is their spectra, which is the set of eigenvalues of adjacency matrix of a
graph. Let G be a finite simple group of Lie type and X be the set homogeneous elements of the associated
geometry. The complexity of computing the adjacency matrices of a graph Gr on the vertices X such that
Aut GR = G depends very much on the description of the geometry with which one starts. For example, we
can represent the geometry as the totality of 1 cosets of parabolic subgroups 2 chains of embedded
subspaces (case of linear groups), or totally isotropic subspaces (case of the remaining classical groups), 3
special subspaces of minimal module for G which are defined in terms of a G invariant multilinear form.
The aim of this research is to develop an effective method for generation of graphs connected with classical
geometry and evaluation of its spectra, which is the set of eigenvalues of adjacency matrix of a graph. The
main approach is to avoid manual drawing and to calculate graph layout automatically according to its
formal structure. This is a simple task in a case of a tree like graph with a strict hierarchy of entities but it
becomes more complicated for graphs of geometrical nature. There are two main reasons for the
investigations of spectra: (1) very often spectra carry much more useful information about the graph than a
corresponding list of entities and relationships (2) graphs with special spectra, satisfying so called
Ramanujan property or simply Ramanujan graphs (by name of Indian genius mathematician) are important
for real life applications (see [13]). There is a motivated suspicion that among geometrical graphs one
could find some new Ramanujan graphs.
ON ALGORITHMIC PROBLEMS CONCERNING GRAPHS OF HIGHER DEGREE OF SYMMETRYFransiskeran
Since the ancient determination of the five platonic solids the study of symmetry and regularity has always
been one of the most fascinating aspects of mathematics. One intriguing phenomenon of studies in graph
theory is the fact that quite often arithmetic regularity properties of a graph imply the existence of many
symmetries, i.e. large automorphism group G. In some important special situation higher degree of
regularity means that G is an automorphism group of finite geometry. For example, a glance through the
list of distance regular graphs of diameter d < 3 reveals the fact that most of them are connected with
classical Lie geometry. Theory of distance regular graphs is an important part of algebraic combinatorics
and its applications such as coding theory, communication networks, and block design. An important tool
for investigation of such graphs is their spectra, which is the set of eigenvalues of adjacency matrix of a
graph. Let G be a finite simple group of Lie type and X be the set homogeneous elements of the associated
geometry.
On algorithmic problems concerning graphs of higher degree of symmetrygraphhoc
Since the ancient determination of the five platonic solids the study of symmetry and regularity has always
been one of the most fascinating aspects of mathematics. One intriguing phenomenon of studies in graph
theory is the fact that quite often arithmetic regularity properties of a graph imply the existence of many
symmetries, i.e. large automorphism group G. In some important special situation higher degree of
regularity means that G is an automorphism group of finite geometry. For example, a glance through the
list of distance regular graphs of diameter d < 3 reveals the fact that most of them are connected with
classical Lie geometry. Theory of distance regular graphs is an important part of algebraic combinatorics
and its applications such as coding theory, communication networks, and block design. An important tool
for investigation of such graphs is their spectra, which is the set of eigenvalues of adjacency matrix of a
graph. Let G be a finite simple group of Lie type and X be the set homogeneous elements of the associated
geometry. The complexity of computing the adjacency matrices of a graph Gr on the vertices X such that
Aut GR = G depends very much on the description of the geometry with which one starts. For example, we
can represent the geometry as the totality of 1 cosets of parabolic subgroups 2 chains of embedded
subspaces (case of linear groups), or totally isotropic subspaces (case of the remaining classical groups), 3
special subspaces of minimal module for G which are defined in terms of a G invariant multilinear form.
The aim of this research is to develop an effective method for generation of graphs connected with classical
geometry and evaluation of its spectra, which is the set of eigenvalues of adjacency matrix of a graph. The
main approach is to avoid manual drawing and to calculate graph layout automatically according to its
formal structure. This is a simple task in a case of a tree like graph with a strict hierarchy of entities but it
becomes more complicated for graphs of geometrical nature. There are two main reasons for the
investigations of spectra: (1) very often spectra carry much more useful information about the graph than a
corresponding list of entities and relationships (2) graphs with special spectra, satisfying so called
Ramanujan property or simply Ramanujan graphs (by name of Indian genius mathematician) are important
for real life applications (see [13]). There is a motivated suspicion that among geometrical graphs one
could find some new Ramanujan graphs.
ON ALGORITHMIC PROBLEMS CONCERNING GRAPHS OF HIGHER DEGREE OF SYMMETRYFransiskeran
Since the ancient determination of the five platonic solids the study of symmetry and regularity has always
been one of the most fascinating aspects of mathematics. One intriguing phenomenon of studies in graph
theory is the fact that quite often arithmetic regularity properties of a graph imply the existence of many
symmetries, i.e. large automorphism group G. In some important special situation higher degree of
regularity means that G is an automorphism group of finite geometry. For example, a glance through the
list of distance regular graphs of diameter d < 3 reveals the fact that most of them are connected with
classical Lie geometry. Theory of distance regular graphs is an important part of algebraic combinatorics
and its applications such as coding theory, communication networks, and block design. An important tool
for investigation of such graphs is their spectra, which is the set of eigenvalues of adjacency matrix of a
graph. Let G be a finite simple group of Lie type and X be the set homogeneous elements of the associated
geometry.
We make use of the conformal compactification of Minkowski spacetime M# to explore a way of describing general, nonlinear Maxwell fields with conformal symmetry. We distinguish the inverse Minkowski spacetime [M#]−1 obtained via conformal inversion, so as to discuss a doubled compactified spacetime on which Maxwell fields may be defined. Identifying M# with the projective light cone in (4+2)-dimensional spacetime, we write two independent conformal-invariant functionals of the 6-dimensional Maxwellian field strength tensors - one bilinear, the other trilinear in the field strengths -- which are to enter general nonlinear constitutive equations. We also make some remarks regarding the dimensional reduction procedure as we consider its generalization from linear to general nonlinear theories.
IJERA (International journal of Engineering Research and Applications) is International online, ... peer reviewed journal. For more detail or submit your article, please visit www.ijera.com
This presentation is about applications of graph theory applications....it is updated version it was given at international conference at applications of graph theory at KAULALAMPUR MALYSIA 2OO7
A Fixed Point Theorem Using Common Property (E. A.) In PM Spacesinventionjournals
International Journal of Mathematics and Statistics Invention (IJMSI) is an international journal intended for professionals and researchers in all fields of computer science and electronics. IJMSI publishes research articles and reviews within the whole field Mathematics and Statistics, new teaching methods, assessment, validation and the impact of new technologies and it will continue to provide information on the latest trends and developments in this ever-expanding subject. The publications of papers are selected through double peer reviewed to ensure originality, relevance, and readability. The articles published in our journal can be accessed online.
Algorithm for Edge Antimagic Labeling for Specific Classes of GraphsCSCJournals
Graph labeling is a remarkable field having direct and indirect involvement in resolving numerous issues in varied fields. During this paper we tend to planned new algorithms to construct edge antimagic vertex labeling, edge antimagic total labeling, (a, d)-edge antimagic vertex labeling, (a, d)-edge antimagic total labeling and super edge antimagic labeling of varied classes of graphs like paths, cycles, wheels, fans, friendship graphs. With these solutions several open issues during this space can be solved.
Common Fixed Point Theorem in Menger Space through weak Compatibilityinventionjournals
In the present paper, a common fixed point theorem for five self mappings has been proved under more general -norm ( -type norm) in Menger space through weak compatibility. A corollary is also derived from the obtained result. The theorem is supported by providing a suitable example.
A function f is called a graceful labelling of a graph G with q edges if f is an injection
from the vertices of G to the set {0, 1, 2, . . . , q} such that, when each edge xy is assigned the
label |f(x) − f(y)| , the resulting edge labels are distinct. A graph G is said to be one modulo
N graceful (where N is a positive integer) if there is a function φ from the vertex set of G to
{0, 1,N, (N + 1), 2N, (2N + 1), . . . ,N(q − 1),N(q − 1) + 1} in such a way that (i) φ is 1 − 1 (ii)
φ induces a bijection φ_ from the edge set of G to {1,N + 1, 2N + 1, . . . ,N(q − 1) + 1} where
φ_(uv)=|φ(u) − φ(v)| . In this paper we prove that the every regular bamboo tree and coconut tree
are one modulo N graceful for all positive integers N .
We make use of the conformal compactification of Minkowski spacetime M# to explore a way of describing general, nonlinear Maxwell fields with conformal symmetry. We distinguish the inverse Minkowski spacetime [M#]−1 obtained via conformal inversion, so as to discuss a doubled compactified spacetime on which Maxwell fields may be defined. Identifying M# with the projective light cone in (4+2)-dimensional spacetime, we write two independent conformal-invariant functionals of the 6-dimensional Maxwellian field strength tensors - one bilinear, the other trilinear in the field strengths -- which are to enter general nonlinear constitutive equations. We also make some remarks regarding the dimensional reduction procedure as we consider its generalization from linear to general nonlinear theories.
IJERA (International journal of Engineering Research and Applications) is International online, ... peer reviewed journal. For more detail or submit your article, please visit www.ijera.com
This presentation is about applications of graph theory applications....it is updated version it was given at international conference at applications of graph theory at KAULALAMPUR MALYSIA 2OO7
A Fixed Point Theorem Using Common Property (E. A.) In PM Spacesinventionjournals
International Journal of Mathematics and Statistics Invention (IJMSI) is an international journal intended for professionals and researchers in all fields of computer science and electronics. IJMSI publishes research articles and reviews within the whole field Mathematics and Statistics, new teaching methods, assessment, validation and the impact of new technologies and it will continue to provide information on the latest trends and developments in this ever-expanding subject. The publications of papers are selected through double peer reviewed to ensure originality, relevance, and readability. The articles published in our journal can be accessed online.
Algorithm for Edge Antimagic Labeling for Specific Classes of GraphsCSCJournals
Graph labeling is a remarkable field having direct and indirect involvement in resolving numerous issues in varied fields. During this paper we tend to planned new algorithms to construct edge antimagic vertex labeling, edge antimagic total labeling, (a, d)-edge antimagic vertex labeling, (a, d)-edge antimagic total labeling and super edge antimagic labeling of varied classes of graphs like paths, cycles, wheels, fans, friendship graphs. With these solutions several open issues during this space can be solved.
Common Fixed Point Theorem in Menger Space through weak Compatibilityinventionjournals
In the present paper, a common fixed point theorem for five self mappings has been proved under more general -norm ( -type norm) in Menger space through weak compatibility. A corollary is also derived from the obtained result. The theorem is supported by providing a suitable example.
A function f is called a graceful labelling of a graph G with q edges if f is an injection
from the vertices of G to the set {0, 1, 2, . . . , q} such that, when each edge xy is assigned the
label |f(x) − f(y)| , the resulting edge labels are distinct. A graph G is said to be one modulo
N graceful (where N is a positive integer) if there is a function φ from the vertex set of G to
{0, 1,N, (N + 1), 2N, (2N + 1), . . . ,N(q − 1),N(q − 1) + 1} in such a way that (i) φ is 1 − 1 (ii)
φ induces a bijection φ_ from the edge set of G to {1,N + 1, 2N + 1, . . . ,N(q − 1) + 1} where
φ_(uv)=|φ(u) − φ(v)| . In this paper we prove that the every regular bamboo tree and coconut tree
are one modulo N graceful for all positive integers N .
Scott Pechstein – Why buying 3rd party is still the most efficient advertisementSean Bradley
Autobytel has partnered with Polk to track sales results on all Autobytel New and Used Car Quote Requests. Polk matches these leads to State Registration data for all 50 States. Scott will discuss numerous standard reports that include: Close Rate by Source, Close Rate by Make, Crossover between Makes (submitted a lead for a Toyota and bought a Nissan), Crossover between New and Used (submitted a lead for New and bought Used), and Time in Between Lead Submissions and Purchase. Most importantly, what can dealers can do with this information will be discussed. By the end of this discussion, you may redefine who your “competition” really is and refine your Internet Sales process. For a Toyota dealer, you may find you aren’t losing business to the local Toyota store, rather, to the used independent across town.
FREQUENT SUBGRAPH MINING ALGORITHMS - A SURVEY AND FRAMEWORK FOR CLASSIFICATIONcscpconf
Data mining algorithms are facing the challenge to deal with an increasing number of complex
objects. Graph is a natural data structure used for modeling complex objects. Frequent subgraph
mining is another active research topic in data mining . A graph is a general model to represent
data and has been used in many domains like cheminformatics and bioinformatics. Mining
patterns from graph databases is challenging since graph related operations, such as subgraph
testing, generally have higher time complexity than the corresponding operations on itemsets,
sequences, and trees. Many frequent subgraph Mining algorithms have been proposed. SPIN,
SUBDUE, g_Span, FFSM, GREW are a few to mention. In this paper we present a detailed
survey on frequent subgraph mining algorithms, which are used for knowledge discovery in
complex objects and also propose a frame work for classification of these algorithms. The
purpose is to help user to apply the techniques in a task specific manner in various application domains and to pave wave for further research.
For graphs of mathematical functions, see Graph of a function. For other uses, see Graph (disambiguation). A drawing of a graph. In mathematics graph theory is the study of graphs, which are mathematical structures used.In mathematics, and more specifically in graph theory, a tree is an undirected graph in which any two vertices are connected by exactly one path. In other words, any acyclic connected graph is a tree. A forest is a disjoint union of trees.
Array is a container which can hold a fix number of items and these items should be of the same type. Most of the data structures make use of arrays to implement their algorithms. Following are the important terms to understand the concept of array.
Graph is a non-linear data structure used to represent the connection between entities.
consists of vertices and edges.
Directed
In a directed graph, edges have a specific direction. They represent relationship where one node points to another i.e., edges go from one vertex to another.
undirected:
Undirected graphs have bidirectional edges. They represent symmetric relationships, like friendships on a social networks
by uj and za
1. Trees Recall that a tree is a connected acyclic graph. Note that t.pdfAHUJAMUSICCOLLECTION
1. Trees Recall that a tree is a connected acyclic graph. Note that this is similar to but slightly
different from a rooted tree that you might have come across before in the Context of data
structures. In our context the tree does not have any designated root vertex, and is just a graph on
n vertices and with m edges. We start by proving two useful properties of trees: (C) If for ever
pair of vertices in a graph they are connected by exactly one simple path. then the graph must be
a tree. (d) If the graph has no simple cycles but has the property that the addition of any single
edge (not already in the graph) will create a simple cycle, then the graph is a tree.
Solution
1-
Since T is a tree, then there is a unique path connecting any two distinct vertices of T
Hence, there are () distinct paths in T
2-
Suppose T is a tree, then by de?nition of a tree it has no simple circuits. Now in T let us
Add an edge e which connects any two non-adjacent vertices u and v. Adding this edge
De?nitely produce a circuit because the resulting graph now has more edges to be a tree.
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
How to Split Bills in the Odoo 17 POS ModuleCeline George
Bills have a main role in point of sale procedure. It will help to track sales, handling payments and giving receipts to customers. Bill splitting also has an important role in POS. For example, If some friends come together for dinner and if they want to divide the bill then it is possible by POS bill splitting. This slide will show how to split bills in odoo 17 POS.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
Ethnobotany and Ethnopharmacology:
Ethnobotany in herbal drug evaluation,
Impact of Ethnobotany in traditional medicine,
New development in herbals,
Bio-prospecting tools for drug discovery,
Role of Ethnopharmacology in drug evaluation,
Reverse Pharmacology.
1. Lecture Notes on
Spanning Trees
15-122: Principles of Imperative Computation
Frank Pfenning
Lecture 26
April 26, 2011
1 Introduction
In this lecture we introduce graphs. Graphs provide a uniform model for
many structures, for example, maps with distances or Facebook relation-
ships. Algorithms on graphs are therefore important to many applications.
They will be a central subject in the algorithms courses later in the curricu-
lum; here we only provide a very small sample of graph algorithms.
2 Spanning Trees
We start with undirected graphs which consist of a set V of vertices (also
called nodes) and a set E of edges, each connecting two different vertices.
A graph is connected if we can reach any vertex from any other vertex
by following edges in either direction. In a directed graph edges provide a
connection from one node to another, but not necessarily in the opposite
direction. More mathematically, we say that the edge relation between ver-
tices is symmetric for undirected graphs. In this lecture we only discuss
undirected graphs, although directed graphs also play an important role in
many applications.
The following is a simple example of a connected, undirected graph
L ECTURE N OTES A PRIL 26, 2011
2. Spanning Trees L26.2
with 5 vertices (A, B, C, D, E) and 6 edges (AB, BC, CD, AE, BE, CE).
A D
E
B C
In this lecture we are particularly interested in the problem of computing
a spanning tree for a connected graph. What is a tree here? They are a
bit different than the binary search trees we considered early. One simple
definition is that a tree is a connected graph with no cycles, where a cycle let’s
you go from a node to itself without repeating an edge. A spanning tree for
a connected graph G is a tree containing all the vertices of G. Below are
two examples of spanning trees for our original example graph.
A D A D
E E
B C B C
When dealing with a new kind of data structure, it is a good strategy to
try to think of as many different characterization as we can. This is some-
what similar to the problem of coming up with good representations of the
data; different ones may be appropriate for different purposes. Here are
some alternative characterizations the class came up with:
1. Connected graph with no cycle (original).
2. Connected graph where no two neighbors are otherwise connected.
Neighbors are vertices connected directly by an edge, otherwise con-
nected means connected without the connecting edge.
L ECTURE N OTES A PRIL 26, 2011
3. Spanning Trees L26.3
3. Two trees connected by a single edge. This is a recursive characteriza-
tion. The based case is a single node, with the empty tree (no vertices)
as a possible special case.
4. A connected graph with exactly n − 1 edges, where n is the number
of vertices.
5. A graph with exactly one path between any two distinct vertices,
where a path is a sequence of distinct vertices where each is connected
to the next by an edge.
When considering the asymptotic complexity it is often useful to cate-
gorize graphs as dense or sparse. Dense graphs have a lot of edges compared
to the number of vertices. Writing n = |V | for the number of vertices (which
will be our notation in the rest of the lecture) know there can be at most
n ∗ (n − 1)/2: every node is connected to any other node (n ∗ (n − 1)), but in
an undirected way (n ∗ (n − 1)/2). If we write e for the number of edges, we
have e = O(n2 ). By comparison, a tree is sparse because e = n − 1 = O(n).
3 Computing a Spanning Tree
There are many algorithms to compute a spanning tree for a connected
graph. The first is an example of a vertex-centric algorithm.
1. Pick an arbitrary node and mark it as being in the tree.
2. Repeat until all nodes are marked as in the tree:
(a) Pick an arbitrary node u in the tree with an edge e to a node w
not in the tree. Add e to the spanning tree and mark w as in the
tree.
We iterate n − 1 times in Step 2, because there are n − 1 vertices that have to
be added to the tree. The efficiency of the algorithm is determined by how
efficiently we can find a qualifying w.
The second algorithm is edge-centric.
1. Start with the collection of singleton trees, each with exactly one node.
2. As long as we have more than one tree, connect two trees together
with an edge in the graph.
L ECTURE N OTES A PRIL 26, 2011
4. Spanning Trees L26.4
This second algorithm also performs n steps, because it has to add n − 1
edges to the trees until we have a spanning tree. Its efficiency is determined
by how quickly we can tell if an edge would connect two trees or would
connect two nodes already in the same tree, a question we come back to in
the next lecture.
Let’s try this algorithm on our first graph, considering edges in the
listed order: (AB, BC, CD, AE, BE, CE).
A D A D A D A D
E E E E
B C B C B C B C
A D A D
E E
B C B C
The first graph is the given graph, the completley disconnected graph is the
starting point for this algorithm. At the bottom right we have computed the
spanning tree, which we know because we have added n − 1 = 4 edges. If
we tried to continue, the next edge BE could not be added because it does
not connect two trees, and neither can CE. The spanning tree is complete.
4 Creating a Random Maze
We can use the algorithm to compute a spanning tree for creating a random
maze. We start with the graph where the vertices are the cells and the
edges represent the neighbors we can move to in the maze. In the graph,
all potential neighbors are connected. A spanning tree will be defined by a
subset of the edges in which all cells in the maze are still connected by some
(unique) path. Because a spanning tree connects all cells, we can arbitrarily
decide on the starting point and end point after we have computed it.
L ECTURE N OTES A PRIL 26, 2011
5. Spanning Trees L26.5
How would we ensure that the maze is random? The idea is to gener-
ate a random permutation (see Exercise 1) of the edges and then consider
the edges in the fixed order. Each edge is either added (if it connects two
disconnected parts of the maze) or not (if the two vertices are already con-
nected).
5 Minimum Weight Spanning Trees
In many applications of graphs, there is some measure associated with the
edges. For example, when the vertices are locations then the edge weights
could be distances. We might then be interested in not any spanning tree,
but one whose total edge weight is minimal among all the possible span-
ning trees, a so-called minimum weight spanning tree (MST). An MST is not
necessarily unique. For example, all the edge weights could be identical in
which case any spanning tree will be minimal.
We annotate the edges in our running example with edge weights as
shown on the left below. On the right is the minimum weight spanning
tree, which has weight 9.
A D A D
2 2
E E
3 3 3
2 2 2 2
B C B C
3
Before we develop a refinement of our edge-centric algorithm for span-
ning trees to take edge weights into account, we discuss a basic property it
is based on.
Cycle Property. Let C ⊆ E be a cycle, and e be an edge of maximal weight
in C. The e does not need to be in an MST.
How do we convince ourselves of this property? Assume we have a
spanning tree, and edge e from the cycle property connects vertices u and
w. If e is not in the spanning tree, then, indeed, we don’t need it. If e is in
the spanning tree, we will construct another MST without e. Edge e splits
L ECTURE N OTES A PRIL 26, 2011
6. Spanning Trees L26.6
the spanning tree into two subtrees. There must be another edge e from
C connecting the two subtrees. Removing e and adding e instead yields
another spanning tree, and one which does not contain e. It has equal or
lower weight to the first MST, since e must have less or equal weight than
e.
The cycle property is the basis for Kruskal’s algorithm.
1. Sort all edges in increasing weight order.
2. Consider the edges in order. If the edge does not create a cycle, add
it to the spanning tree. Otherwise discard it. Stop, when n − 1 edges
have been added, because then we must have spanning tree.
Why does this create a minimum-weight spanning tree? It is a straightfor-
ward application of the cycle property (see Exercise 2).
Sorting the edges will take O(e ∗ log(e)) steps with most appropriate
sorting algorithms. The complexity of the second part of the algorithm
depends on how efficiently we can check if adding an edge will create a
cycle or not. As we will see in Lecture 27, this can be O(n ∗ log(n)) or even
more efficient if we use a so-called union-find data structure.
Illustrating the algorithm on our example
A D
2
E
3 3
2 2
B C
3
we first sort the edges. There is some ambiguity—say we obtain the follow-
ing list
AE 2
BE 2
CE 2
BC 3
CD 3
AB 3
L ECTURE N OTES A PRIL 26, 2011
7. Spanning Trees L26.7
We now add the edges in order, making sure we do not create a cycle. After
AE, BE, CE, we have
A D
2
E
2 2
B C
At this point we consider BC. However, this edge would create a cycle
BCE since it connects two vertices in the same tree instead of two differ-
ent trees. We therefore do not add it to the spanning tree. Next we consider
CD, which does connect two trees. At this point we have a minimum span-
ning tree
A D
2
E
3
2 2
B C
We do not consider the last edge, AB, because we have already added n −
1 = 4 edges.
In the next lecture we will analyze the problem of incrementally adding
edges to a tree in a way that allows us to quickly determine if an edge
would create a cycle.
L ECTURE N OTES A PRIL 26, 2011
8. Spanning Trees L26.8
Exercises
Exercise 1 Write a function to generate a random permutation of a given array,
using a random number generator with the interface in the standard rand library.
What is the asymptotic complexity of your function?
Exercise 2 Prove that the cycle property implies the correctness of Kruskal’s algo-
rithm.
L ECTURE N OTES A PRIL 26, 2011