maths.free › Combinatorics & Graph Theory › 3. Graph Theory › Trees
Trees
Investigation Consider the graph drawn below. Find a subgraph with the smallest number of edges that is still connected and contains all the vertices. Find a subgraph with the largest number of edges that doesn't co
Section Preview
Investigation
Consider the graph drawn below.
Find a subgraph with the smallest number of edges that is still connected and contains all the vertices.
Find a subgraph with the largest number of edges that doesn't contain any cycles.
What do you notice about the number of edges in your examples above? Is this a coincidence?
One very useful and common approach to studying graph theory is to restrict your focus to graphs of a particular kind. For example, you could try to really understand just complete graphs or just bipartite graphs, instead of trying to understand all graphs in general. That is what we are going to do now, looking at trees. Hopefully by the end of this section we will have a better understanding of this class of graph, and also understand why it is important enough to warrant its own section.
Does the definition above agree with your intuition for what graphs we should call trees? Try thinking of examples of trees, and make sure they satisfy the definition. One thing to keep in mind is that while the trees we study in graph theory are related to trees you might see in other subjects, the correspondence is not exact. For instance, in anthropology, you might study family trees, like the one below,
So far so good, but while your grandparents are (probably) not blood relatives, if we go back far enough, it is likely that they did have some common ancestor. If you trace the tree back from you to that common ancestor, then down through your other grandparent, you would have a cycle, and thus the graph would not be a tree.
You might also have seen something called a decision tree (such as the algorithm for deciding whether a series converges or diverges). Sometimes these too contain cycles, as the decision for one node might lead you back to a previous step.
In this section, we will explore some basic properties of trees, which will serve as an excellent introduction to writing proofs about graphs. We will also consider a special kind of tree, called a spanning tree, which is a tree that includes all the vertices of a connected graph. Finally, we will briefly consider rooted trees.
Condensed — the full section is in Levin, Discrete Mathematics: An Open Introduction.
Properties of Trees
We wish to really understand trees. This means we should discover properties of trees: what makes them special and what is special about them.
A tree is a connected graph with no cycles. Is there anything else we can say? It would be nice to have other equivalent conditions for a graph to be a tree. That is, we would like to know whether there are any graph theoretic properties that all trees have, and perhaps even that only trees have.
To get a feel for the sorts of things we can say, we will consider three propositions about trees. These will also illustrate important proof techniques that apply to graphs in general, and happen to be a little easier for trees.
Our first proposition gives an alternate definition for a tree. That is, it gives necessary and sufficient conditions for a graph to be a tree.
Read the proof above very carefully. Notice that both directions had two parts: the existence of paths, and the uniqueness of paths (which related to the fact that there were no cycles). In this case, these two parts were really separate. In fact, if we just considered graphs with no cycles (a forest), then we could still do the parts of the proof that explore the uniqueness of paths between vertices, even if there might not exist paths between vertices.
This observation allows us to state the following corollary.A corollary is another sort of provable statement, like a proposition or theorem, but one that follows direction from another already established statement, or its proof.
We do not give a proof of the corollary (it is, after all, supposed to follow directly from the proposition), but for practice, you are asked to give a careful proof in the exercises. When you do so, try to use proof by contrapositive instead of proof by contradiction.
Our second proposition tells us that all trees have leaves: vertices of degree one.
Condensed — the full section is in Levin, Discrete Mathematics: An Open Introduction.
Spanning Trees
One of the advantages of trees is that they give us a few simple ways to travel through the vertices. If a connected graph is not a tree, then we can still use these traversal algorithms if we identify a subgraph that is a tree.
First we should consider if this even makes sense. Given any connected graph \(G\), will there always be a subgraph that is a tree? Well, that is actually too easy: You could just take a single vertex of \(G\). If we want to use this subgraph to tell us how to visit all vertices, then we want our subgraph to include all of the vertices. We call such a tree a spanning tree.
It turns out that every connected graph has one (and usually many).
How do we know? We can give an algorithm for finding a spanning tree! Start with a connected graph \(G\). If there is no cycle, then \(G\) is already a tree and we are done. If there is a cycle, let \(e\) be any edge in that cycle and consider the new graph \(G_1 = G - e\) (i.e., the graph you get by deleting \(e\)). This tree is still connected: Since \(e\) belonged to a cycle, there were at least two paths between its incident vertices. Now repeat: If \(G_1\) has no cycles, we are done; otherwise define \(G_2\) to be \(G_1 - e_1\), where \(e_1\) is an edge in a cycle in \(G_1\). Keep going. This process must eventually stop, since there are only a finite number of edges to remove. The result will be a tree, and since we never removed any vertex, a spanning tree.
This is by no means the only algorithm for finding a spanning tree. You could have started with the empty graph and added edges that belong to \(G\), as long as adding them would not create a cycle. You have some choices as to which edges you add first: You could always add an edge adjacent to edges you have already added (after the first one, of course), or add them using some other order. Which spanning tree you end up with depends on these choices.
Example
Find two different spanning trees of the graph,
Solution
Here are two spanning trees.
Condensed — the full section is in Levin, Discrete Mathematics: An Open Introduction.
Rooted Trees
So far, we have thought of trees only as a particular kind of graph. However, it is often useful to add additional structure to trees to help solve problems. Data is often structured like a tree. This book, for example, has a tree structure: Draw a vertex for the book itself. Then draw vertices for each chapter, connected to the book vertex. Under each chapter, draw a vertex for each section, connecting it to the chapter it belongs to. The graph will not have any cycles; it will be a tree, but a tree with a clear hierarchy which is not present if we don't identify the book vertex as the top.
As soon as one vertex of a tree is designated as the root, then every other vertex on the tree can be characterized by its position relative to the root. This works because there is a unique path between any two vertices in a tree. So from any vertex, we can travel back to the root in exactly one way. This also allows us to describe how distinct vertices in a rooted tree are related.
If two vertices are adjacent, then we say one of them is the parent of the other, which is called the child of the parent. Of the two, the parent is the vertex that is closer to the root. Thus the root of a tree is a parent, but is not the child of any vertex (and is unique in this respect: All non-root vertices have exactly one parent).
Not surprisingly, the child of a child of a vertex is called the grandchild of the vertex (and it is the grandparent). More generally, we say that a vertex \(v\) is a descendent of a vertex \(u\) provided \(u\) is a vertex on the path from \(v\) to the root. Then we would call \(u\) an ancestor of \(v\).
For most trees (in fact, all except paths with one end the root), there will be pairs of vertices neither of which is a descendant of the other. We might call these cousins or siblings. In fact, vertices \(u\) and \(v\) are called siblings provided they have the same parent. Note that siblings are never adjacent (do you see why?).
All of this flowery language helps us describe how to navigate through a tree. Traversing a tree, visiting each vertex in some order, is a key step in many algorithms. Even if the tree is not rooted, we can always form a rooted tree by picking any vertex as the root. Here is an example of why doing so can be helpful.
Condensed — the full section is in Levin, Discrete Mathematics: An Open Introduction.
Learning Objectives
After completing this section, you should be able to:
- Describe and identify trees.
- Determine a spanning tree for a connected graph.
- Find the minimum spanning tree for a weighted graph.
- Solve application problems involving trees.
What Is A Tree?
Whether we are talking about a family tree or a tree in a forest, none of the branches ever loops back around and rejoins the trunk. This means that a tree has no cyclic subgraphs, or is acyclic. A tree also has only one component. So, a tree is a connected acyclic graph. Here are some graphs that have the same characteristic. Each of the graphs in is a tree.
Let’s practice determining whether a graph is a tree. To do this, check if a graph is connected and has no cycles.
Identifying Trees
Try it.
Identify any trees in . If a graph is not a tree, explain how you know.
Solution
- Graph M is not a tree because it contains the cycle (b, c, f).
- Graph N is not a tree because it is not connected. It has two components, one with vertices h, i, j, and another with vertices k, l, m.
- Graph P is a tree. It has no cycles and it is connected.
Types of Trees
Mathematicians have had a lot of fun naming graphs that are trees or that contain trees. For example, the graph in is not a tree, but it contains two components, one containing vertices a through d, and the other containing vertices e through g, each of which would be a tree on its own. This type of structure is called a forest. There are also interesting names for trees with certain characteristics.
- A path graph or linear graph is a tree graph that has exactly two vertices of degree 1 such that the only other vertices form a single path between them, which means that it can be drawn as a straight line.
- A star tree is a tree that has exactly one vertex of degree greater than 1 called a root, and all other vertices are adjacent to it.
- A starlike tree is a tree that has a single root and several paths attached to it.
- A caterpillar tree is a tree that has a central path that can have vertices of any degree, with each vertex not on the central path being adjacent to a vertex on the central path and having a degree of one.
- A lobster tree is a tree that has a central path that can have vertices of any degree, with paths consisting of either one or two edges attached to the central path.
Examples of each of these types of structures are given in .
Identifying Types of Trees
Try it.
Each graph in is one of the special types of trees we have been discussing. Identify the type of tree.
Solution
Graph U has a central path a → b → d → f → i → l → o → q. Each vertex that is not on the path has degree 1 and is adjacent to a vertex that is on the path. So, U is a caterpillar tree.
Graph V is a path graph because it is a single path connecting exactly two vertices of degree one, r → s → u → v → w.
Characteristics of Trees
As we study trees, it is helpful to be familiar with some of their characteristics. For example, if you add an edge to a tree graph between any two existing vertices, you will create a cycle, and the resulting graph is no longer a tree. Some examples are shown in . Adding edge bj to Graph T creates cycle (b, c, i, j). Adding edge rt to Graph P creates cycle (r, s, t). Adding edge tv to Graph S creates cycle (t, u, v).
It is also true that removing an edge from a tree graph will increase the number of components and the graph will no longer be connected. In fact, you can see in that removing one or more edges can create a forest. Removing edge qr from Graph P creates a graph with two components, one with vertices o, p and q, and the other with vertices r, s, and t. Removing edge uw from Graph S creates two components, one with just vertex w and the other with the rest of the vertices. When two edges were removed from Graph T, edge bf and edge cd, creates a graph with three components as shown in .
A very useful characteristic of tree graphs is that the number of edges is always one less than the number of vertices. In fact, any connected graph in which the number of edges is one less than the number of vertices is guaranteed to be a tree. Some examples are given in .
Exploring Characteristics of Trees
Try it.
Use Graphs I and J in to answer each question.
- Which vertices are in each of the components that remain when edge be is removed from Graph I?
- Determine the number of edges and the number of vertices in Graph J. Explain how this confirms that Graph J is a tree.
- What kind of cycle is created if edge im is added to Graph J?
Solution
- When edge be is removed, there are two components that remain. One component includes vertices a, b, and c. The other component includes vertices d, e, and f.
- There are seven vertices and six edges in Graph J. This confirms that Graph J is a tree because the number of edges is one less than the number of vertices.
- The pentagon (i, h, j, l, m) is created when edge im is added to Graph J.
Condensed — the full section is in OpenStax Contemporary Mathematics.
Spanning Trees
Suppose that you planned to set up your own computer network with four devices. One option is to use a “mesh topology” like the one in , in which each device is connected directly to every other device in the network.
The mesh topology for four devices could be represented by the complete Graph A1 in where the vertices represent the devices, and the edges represent network connections. However, the devices could be networked using fewer connections. Graphs A2, A3, and A4 of show configurations in which three of the six edges have been removed. Each of the Graphs A2, A3 and A4 in is a tree because it is connected and contains no cycles. Since Graphs A2, A3 and A4 are also subgraphs of Graph A1 that include every vertex of the original graph, they are also known as spanning trees.
By definition, spanning trees must span the whole graph by visiting all the vertices. Since spanning trees are subgraphs, they may only have edges between vertices that were adjacent in the original graph. Since spanning trees are trees, they are connected and they are acyclic. So, when deciding whether a graph is a spanning tree, check the following characteristics:
- All vertices are included.
- No vertices are adjacent that were not adjacent in the original graph.
- The graph is connected.
- There are no cycles.
Identifying Spanning Trees
Try it.
Use to determine which of graphs M1, M2, M3, and M4, are spanning trees of Q.
Solution
- Graph M1 is not a spanning tree of Graph Q because it has a cycle (c, d, f, e).
- Graph M2 is a spanning tree of Graph Q because it has all the original vertices, no vertices are adjacent in M2 that weren’t adjacent in Graph Q, Graph M2 is connected and it contains no cycles.
- Graph M3 is not a spanning tree of Graph Q because vertices a and f are adjacent in Graph M3 but not in Graph Q.
- Graph M4 is not a spanning tree of Graph Q because it is not connected.
So, only graph M2 is a spanning tree of Graph Q.
Constructing a Spanning Tree Using Paths
Suppose that you wanted to find a spanning tree within a graph. One approach is to find paths within the graph. You can start at any vertex, go any direction, and create a path through the graph stopping only when you can’t continue without backtracking as shown in .
Once you have stopped, pick a vertex along the path you drew as a starting point for another path. Make sure to visit only vertices you have not visited before as shown in .
Repeat this process until all vertices have been visited as shown in .
The end result is a tree that spans the entire graph as shown in .
Notice that this subgraph is a tree because it is connected and acyclic. It also visits every vertex of the original graph, so it is a spanning tree. However, it is not the only spanning tree for this graph. By making different turns, we could create any number of distinct spanning trees.
Constructing Spanning Trees
Try it.
Construct two distinct spanning trees for the graph in .
Solution
Two possible solutions are given in and .
Revealing Spanning Trees
Another approach to finding a spanning tree in a connected graph involves removing unwanted edges to reveal a spanning tree. Consider Graph D in .
Graph D has 10 vertices. A spanning tree of Graph D must have 9 edges, because the number of edges is one less than the number of vertices in any tree. Graph D has 13 edges so 4 need to be removed. To determine which 4 edges to remove, remember that trees do not have cycles. There are four triangles in Graph D that we need to break up. We can accomplish this by removing 1 edge from each of the triangles. There are many ways this can be done. Two of these ways are shown in .
Removing Edges to Find Spanning Trees
Try it.
Use the graph in to answer each question.
- Determine the number of edges that must be removed to reveal a spanning tree.
- Name all the undirected cycles in Graph V.
- Find two distinct spanning trees of Graph V.
Solution
- Graph V has nine vertices so a spanning tree for the graph must have 8 edges. Since Graph V has 11 edges, 3 edges must be removed to reveal a spanning tree.
- (a, c, d), (a, c, f), (a, d, c, f), and (b, e, h, i, g)
- To find the first spanning tree, remove edge ac, which will break up both of the triangles, remove edge cf , which will break up the quadrilateral, and remove be, which will break up the pentagon, to give us the spanning tree shown in .
To find another spanning tree, remove ad, which will break up (a, c, d) and (a, d, c, f), remove af to break up (a, c, f), and remove hi to break up (b, e, h, i, g). This will give us the spanning tree in .
Condensed — the full section is in OpenStax Contemporary Mathematics.
Kruskal’s Algorithm
In many applications of spanning trees, the graphs are weighted and we want to find the spanning tree of least possible weight. For example, the graph might represent a computer network, and the weights might represent the cost involved in connecting two devices. So, finding a spanning tree with the lowest possible total weight, or minimum spanning tree, means saving money! The method that we will use to find a minimum spanning tree of a weighted graph is called Kruskal’s algorithm. The steps for Kruskal’s algorithm are:
Step 1: Choose any edge with the minimum weight of all edges.
Step 2: Choose another edge of minimum weight from the remaining edges. The second edge does not have to be connected to the first edge.
Step 3: Choose another edge of minimum weight from the remaining edges, but do not select any edge that creates a cycle in the subgraph you are creating.
Step 4: Repeat step 3 until all the vertices of the original graph are included and you have a spanning tree.
Condensed — the full section is in OpenStax Contemporary Mathematics.
Key Concepts
- A brute force algorithm always finds the ideal solution but can be impractical whereas a greedy algorithm is efficient but usually does not lead to the ideal solution.
- A Hamilton cycle of lowest weight is a solution to the traveling salesperson problem.
- The brute force method finds a Hamilton cycle of lowest weight in a complete graph.
- The nearest neighbor method is a greedy algorithm that finds a Hamilton cycle of relatively low weight in a complete graph.
Videos
- The Problem in Good Will Hunting by Numberphile
- Spanning Trees in Graph Theory
- Use Kruskal's Algorithm to Find Minimum Spanning Trees in Graph Theory
Formulas
- The number of edges in a tree graph with \(n\) vertices is \(n-1\). A connected graph with n vertices and \(n-1\) edges is a tree graph.
Projects
Everyone Gets a Turn! – Graph Colorings
Let’s put your knowledge of graph colorings to work! Your task is to plan a field day following these steps.
- Select between seven and ten activities for your field day. You can look online for ideas.
- Create a survey asking for the participants to select the three to five events in which they would most like to participate. Survey between seven and ten people.
- Use the results of your survey to create a graph in which each vertex represents one of the events. A pair of vertices will be adjacent if there is at least one participant who would like to participate in both events.
- Find a minimum coloring for the graph. Explain how you found it and how you know the chromatic number of the graph.
- Use your solution to part d to determine the minimum number of timeslots you must use to ensure that everyone has the opportunity to participate in their top three events.
- Find the complement of the graph you created. Explain what the edges in this graph represent.
A Beautiful Day in the Neighborhood – Euler Circuits
Let’s apply what you have learned to the community in which you live. Using resources such as your county’s property appraiser’s website, create a detailed graph of your neighborhood in which vertices represent turns and intersections. Represent a large enough part of your community to include no fewer than 10 intersections or turns. Then use your graph to answer the following questions.
- Label the edges of your graph.
- Determine if your graph is Eulerian. Explain how you know. If it is not, eulerize it.
- Find an Euler circuit for your graph. Give the sequence of vertices that you found.
- What does the Euler circuit you found in part c represent for your community?
- Describe an application for which this Euler circuit might be used.
Dream Vacation – Hamilton Cycles and Paths
Where in the world would you like to travel most: the Eiffel Tower in Paris, a Broadway musical in New York city, a bike tour of Amsterdam, the Tenerife whale and dolphin cruises in the Canary Islands, the Giza Pyramid in Cairo, or maybe the Jokhang Temple in Tibet? Let's plan your dream vacation!
Condensed — the full section is in OpenStax Contemporary Mathematics.
Practice (26)
Try each one on paper first. Reveal the answer to check; verified ones can be opened in the solver for every step.
-
Suppose \(T\) is a tree with 10 vertices. Which of the following statements must be true about \(T\)? Select all that apply.
-
If a tree has 20 vertices, how many edges does it have?
Number of edges:
-
What questions do you have after reading this section? Write at least one question about the content of this section that you are curious about.
-
Which of the following graphs are trees?
\(G = (V, E)\) with \(V = \{a, b, c, d, e\}\) and \(E = \{\{a, b\}, \{a,e\}, \{b, c\}, \{c,d\}, \{d,e\} \}\)
\(G = (V, E)\) with \(V = \{a, b, c, d, e\}\) and \(E = \{\{a, b\}, \{b, c\}, \{c,d\}, \{d,e\}\}\)
\(G = (V, E)\) with \(V = \{a, b, c, d, e\}\) and \(E = \{\{a, b\}, \{a, c\}, \{a,d\}, \{a,e\}\}\)
\(G = (V, E)\) with \(V = \{a, b, c, d, e\}\) and \(E = \{\{a, b\}, \{a, c\}, \{d,e\}\}\)
Onthul het antwoord
This is not a tree since it contains a cycle. Note also that there are too many edges to be a tree, since we know that all trees with \(v\) vertices have \(v-1\) edges.
This is a tree since it is connected and contains no cycles (which you can see by drawing the graph). All paths are trees.
This is a tree since it is connected and contains no cycles (draw the graph). All stars are trees.
This is a not a tree since it is not connected. Note that there are not enough edges to be a tree.
-
For each degree sequence below, decide whether it must always, must never, or could possibly be a degree sequence for a tree. Remember, a degree sequence lists out the degrees (number of edges incident to the vertex) of all the vertices in a graph in non-increasing order.
\((4,1,1,1,1)\)
\((3,3,2,1,1)\)
\((2,2,2,1,1)\)
\((4, 4, 3, 3, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1)\)
Onthul het antwoord
This must be the degree sequence for a tree. This is because the vertex of degree 4 must be adjacent to the four vertices of degree 1 (there are no other vertices for it to be adjacent to), and thus we get a star.
This cannot be a tree. Each degree 3 vertex is adjacent to all but one of the vertices in the graph. Thus each must be adjacent to one of the degree 1 vertices (and not the other). That means both degree 3 vertices are adjacent to the degree 2 vertex and to each other, so that means there is a cycle.
Alternatively, count how many edges there are!
This might or might not be a tree. The length 4 path has this degree sequence (this is a tree), but so does the union of a 3-cycle and a length 1 path (which is not connected, so this is not a tree).
This cannot be a tree. The sum of the degrees is 28, so there are 14 edges. But there are 14 vertices as well, so we don't have \(v = e+1\), meaning this cannot be a tree.
-
For each degree sequence below, decide whether it must always, must never, or could possibly be a degree sequence for a tree. Justify your answers.
\((3, 3, 2, 2, 2)\)
\((3, 2, 2, 1, 1, 1)\)
\((3, 3, 3, 1, 1, 1)\)
\((4, 4, 1, 1, 1, 1, 1, 1)\)
Onthul het antwoord
Hint:
Careful: the graphs might not be connected.
-
Suppose you have a graph with \(v\) vertices and \(e\) edges that satisfies \(v = e+1\). Must the graph be a tree? Prove your answer.
Onthul het antwoord
Hint:
Try .
-
Prove that any graph (not necessarily a tree) with \(v\) vertices and \(e\) edges that satisfies \(v \gt e+1\) will NOT be connected.
Onthul het antwoord
Hint:
Try a proof by contradiction, and consider a spanning tree of the graph.
-
If a graph \(G\) with \(v\) vertices and \(e\) edges is connected and has \(v \lt e+1\), must it contain a cycle? Prove your answer.
Onthul het antwoord
Yes. We will prove the contrapositive. Assume \(G\) does not contain a cycle. Then \(G\) is a tree, so this would have \(v = e+1\), contrary to stipulation.
-
We define a forest to be a graph with no cycles.
Explain why this is a good name. That is, explain why a forest is a union of trees.
Suppose \(F\) is a forest consisting of \(m\) trees and \(v\) vertices. How many edges does \(F\) have? Explain.
Prove that any graph \(G\) with \(v\) vertices and \(e\) edges that satisfies \(v \lt e+1\) must contain a cycle (i.e., not be a forest).
Onthul het antwoord
Hint:
For part (b), trying some simple examples should give you the formula. Then you just need to prove it is correct.
-
Give a careful proof of : A graph is a forest if and only if there is at most one path between any pair of vertices. Use proof by contrapositive (and not a proof by contradiction) for both directions.
Onthul het antwoord
Hint:
Examining the proof of gives you most of what you need, but make sure to just give the relevant parts, and take care to not use proof by contradiction.
-
Give a careful minimal criminal proof that every tree is bipartite.
Onthul het antwoord
Hint:
Minimality here should be in terms of the number of vertices. If you had a minimum counterexample and removed a leaf vertex, the resulting graph will be a smaller tree, so...
-
Consider the tree drawn below.
Suppose we designate vertex \(e\) as the root. List the children, parents, and siblings of each vertex. Does any vertex other than \(e\) have grandchildren?
Suppose \(e\) is not chosen as the root. Does our choice of root vertex change the number of children \(e\) has? The number of grandchildren? How many are there of each?
In fact, pick any vertex in the tree and suppose it is not the root. Explain why the number of children of that vertex does not depend on which other vertex is the root.
Does the previous part work for other trees? Give an example of a different tree for which it holds. Then either prove that it always holds or give an example of a tree for which it doesn't.
Onthul het antwoord
Hint:
If \(e\) is the root, then \(b\) will have three children (\(a\), \(c\), and \(d\)), all of which will be siblings and have \(b\) as their parent. \(a\) will not have any children.
In general, how can you determine the number of children a vertex will have, if it is not a root?
-
Let \(T\) be a rooted tree that contains vertices \(u\), \(v\), and \(w\) (among others, possibly). Prove that if \(w\) is a descendant of both \(u\) and \(v\), then \(u\) is a descendant of \(v\) or \(v\) is a descendant of \(u\).
-
Unless it is already a tree, a given graph \(G\) will have multiple spanning trees. How similar or different must these be?
Must all spanning trees of a given graph be isomorphic to each other? Explain why or give a counterexample.
Must all spanning trees of a given graph have the same number of edges? Explain why or give a counterexample.
Must all spanning trees of a graph have the same number of leaves (vertices of degree 1)? Explain why or give a counterexample.
Onthul het antwoord
No, although there are graphs for which this is true. For example, \(K_4\) has a spanning tree that is a path (of three edges) and also a spanning tree that is a star (with center vertex of degree 3).
Yes. For a fixed graph, we have a fixed number \(v\) of vertices. Any spanning tree of the graph will also have \(v\) vertices, and since it is a tree, must have \(v-1\) edges.
No, although there are graphs for which this is true (note that if all spanning trees are isomorphic, then all spanning trees will have the same number of leaves). Again, \(K_4\) is a counterexample. One spanning tree is a path, with only two leaves, and another spanning tree is a star with 3 leaves.
-
Find all spanning trees of the graph below. How many different spanning trees are there? How many different spanning trees are there up to isomorphism (that is, if you grouped all the spanning trees by which are isomorphic, how many groups would you have)?
-
Give an example of a graph that has exactly 7 different spanning trees. Note, it is acceptable for some or all of these spanning trees to be isomorphic.
Onthul het antwoord
Hint:
There is an example with 7 edges.
-
Prove that every connected graph which is not itself a tree must have at least three different (although possibly isomorphic) spanning trees.
Onthul het antwoord
Hint:
The previous exercise will be helpful.
-
Consider edges that must be in every spanning tree of a graph. Must every graph have such an edge? Give an example of a graph that has exactly one such edge.
Onthul het antwoord
Hint:
Note that such an edge, if removed, would disconnect the graph. We call graphs that have an edge like this 1-connected.
-
Identify any trees in . If a graph is not a tree, explain how you know.
Onthul het antwoord
- Graph M is not a tree because it contains the cycle (b, c, f).
- Graph N is not a tree because it is not connected. It has two components, one with vertices h, i, j, and another with vertices k, l, m.
- Graph P is a tree. It has no cycles and it is connected.
-
Each graph in is one of the special types of trees we have been discussing. Identify the type of tree.
Onthul het antwoord
Graph U has a central path a → b → d → f → i → l → o → q. Each vertex that is not on the path has degree 1 and is adjacent to a vertex that is on the path. So, U is a caterpillar tree.
Graph V is a path graph because it is a single path connecting exactly two vertices of degree one, r → s → u → v → w.
-
Use Graphs I and J in to answer each question.
- Which vertices are in each of the components that remain when edge be is removed from Graph I?
- Determine the number of edges and the number of vertices in Graph J. Explain how this confirms that Graph J is a tree.
- What kind of cycle is created if edge im is added to Graph J?
Onthul het antwoord
- When edge be is removed, there are two components that remain. One component includes vertices a, b, and c. The other component includes vertices d, e, and f.
- There are seven vertices and six edges in Graph J. This confirms that Graph J is a tree because the number of edges is one less than the number of vertices.
- The pentagon (i, h, j, l, m) is created when edge im is added to Graph J.
-
Use to determine which of graphs M1, M2, M3, and M4, are spanning trees of Q.
Onthul het antwoord
- Graph M1 is not a spanning tree of Graph Q because it has a cycle (c, d, f, e).
- Graph M2 is a spanning tree of Graph Q because it has all the original vertices, no vertices are adjacent in M2 that weren’t adjacent in Graph Q, Graph M2 is connected and it contains no cycles.
- Graph M3 is not a spanning tree of Graph Q because vertices a and f are adjacent in Graph M3 but not in Graph Q.
- Graph M4 is not a spanning tree of Graph Q because it is not connected.
So, only graph M2 is a spanning tree of Graph Q.
-
Construct two distinct spanning trees for the graph in .
Onthul het antwoord
Two possible solutions are given in and .
-
Use the graph in to answer each question.
- Determine the number of edges that must be removed to reveal a spanning tree.
- Name all the undirected cycles in Graph V.
- Find two distinct spanning trees of Graph V.
Onthul het antwoord
- Graph V has nine vertices so a spanning tree for the graph must have 8 edges. Since Graph V has 11 edges, 3 edges must be removed to reveal a spanning tree.
- (a, c, d), (a, c, f), (a, d, c, f), and (b, e, h, i, g)
- To find the first spanning tree, remove edge ac, which will break up both of the triangles, remove edge cf , which will break up the quadrilateral, and remove be, which will break up the pentagon, to give us the spanning tree shown in .
To find another spanning tree, remove ad, which will break up (a, c, d) and (a, d, c, f), remove af to break up (a, c, f), and remove hi to break up (b, e, h, i, g). This will give us the spanning tree in .
-
A computer network will be set up with six devices. The vertices in the graph in represent the devices, and the edges represent the cost of a connection. Find the network configuration that will cost the least. What is the total cost?
Onthul het antwoord
A minimum spanning tree will correspond to the network configuration of least cost. We will use Kruskal’s algorithm to find one. Since the graph has six vertices, the spanning tree will have six vertices and five edges.
Step 1: Choose an edge of least weight. We have sorted the weights into numerical order. The least is $100. The only edge of this weight is edge AF as shown in .
Step 2: Choose the edge of least weight of the remaining edges, which is BD with $120. Notice that the two selected edges do not need to be adjacent to each other as shown in .
Step 3: Select the lowest weight edge of the remaining edges, as long as it does not result in a cycle. We select DF with $150 since it does not form a cycle as shown in .
Repeat Step 3: Select the lowest weight edge of the remaining edges, which is BE with $160 and it does not form a cycle as shown in . This gives us four edges so we only need to repeat step 3 once more to get the fifth edge.
Repeat Step 3: The lowest weight of the remaining edges is $170. Both BF and CE have a weight of $170, but BF would create cycle (b, d, f) and there cannot be a cycle in a spanning tree as shown in .
So, we will select CE, which will complete the spanning tree as shown in .
The minimum spanning tree is shown in . This is the configuration of the network of least cost. The spanning tree has a total weight of \(\$100+\$120+\$150+\$160+\$170=\$700\), which is the total cost of this network configuration.
Symbols used here
i² = −1.
n × (n−1) × … × 1; the number of orderings of n things. 0! = 1.
Number of k-element subsets of n things: n!/(k!(n−k)!).
Add a_k for k = 1 up to n.
Multiply a_k for k = 1 up to n.
The set with no elements; the number of elements of A.
How to: Trees
- Prove basic facts about trees.
- Use theorems about trees to solve problems.
- Identify and construct spanning trees.
Questions people ask
Permutation or combination?
Ask whether order matters. A lock code is a permutation (order matters); a hand of cards is a combination (it does not).
What is a graph in this sense?
Dots (vertices) joined by lines (edges) — not a plot. Road maps, social networks and molecules are graphs; questions like "is there a route" and "how few colours" are graph theory.
Probeer je eigen
Parts of this page are adapted from Levin, Discrete Mathematics: An Open Introduction (CC BY-SA 4.0), OpenStax Contemporary Mathematics (CC BY-NC-SA 4.0). Condensed and re-explained here; errors are ours.
Meer in Combinatorics & Graph Theory
The counting principlesPigeonhole principle and inclusion–exclusionBinomial coefficients and Pascal's triangleRecurrences and generating functionsGraphs: vertices, edges, degreesPaths, cycles, trees, Euler and HamiltonColouring and planar graphs