简体   繁体   English

生成树的定义

[英]Definition of a spanning tree

I want to check if my understanding of a spanning tree (for undirected and connected graphs) is correct. 我想检查一下我对生成树(对于无向和连接图)的理解是否正确。

From, what I have read online. 从,我在网上看到的。 A spanning tree is a subset of a graph, it contains the same amount of vertices of the graph, however it has a minimum amount of edges. 生成树是图形的子集,它包含相同数量的图形顶点,但它具有最小量的边缘。 There can also be many different spanning trees for a graph. 图形也可以有许多不同的生成树。

I have seen some illustrations of spanning trees and their graph so i have tried to come up with my own example. 我已经看到了生成树及其图形的一些插图,所以我试图想出我自己的例子。

house graph 房子图

So this image shows a house shaped graph. 所以这张图片显示了一个房屋形状图。 If I was to get rid of one edge in that house graph, this would be a spanning tree since there is an alternate pathway to get from one node to another. 如果我要摆脱该房屋图中的一个边缘,那么这将是一个生成树,因为有一条从一个节点到另一个节点的替代路径。

I could also potentially get rid of two edges if I make sure that there is still a path that exists between the two nodes. 如果我确保在两个节点之间仍然存在路径,我还可以摆脱两条边。

Am I correct in this assumption? 我在这个假设中是否正确?

No, you are not correct in this assumption, because you will have to remove 2 edges in order to build a spanning tree. 不,您在此假设中不正确,因为您必须删除2条边以构建生成树。 Removing one edge will not work. 删除一条边不起作用。
The house graph of you picture has 5 vertices, and 6 edges. 你图片的房子图有5个顶点和6个边。
A tree with n vertices has n-1 edges, so a tree with 5 vertices needs to have 4 edges. 具有n个顶点的树具有n-1边,因此具有5个顶点的树需要具有4个边。

A spanning tree is not a tricky object, it really stands by its name. 生成树不是一个棘手的对象,它实际上是它的名字。 spanning because it covers all vertices, and tree because it is a tree. spanning因为它覆盖了所有顶点,而tree因为它是一棵树。

If you were to remove a single edge, there will still be a cycle in your graph, so it cannot be a tree (which is, by definition, a connected acyclic graph). 如果要删除单个边,图中仍会有一个循环,因此它不能是树(根据定义,它是连接的非循环图)。

That is one thing that is very easy to find out when you want to build a spanning tree of a graph, it is the number of edges to remove (or to keep, which is equivalent). 当你想要构建一个图形的生成树时,这是很容易找到的一件事,它是要删除的边数(或保持,这是等价的)。 The formula #vertices = #edges + 1 always holds in a tree. 公式#vertices = #edges + 1始终保存在树中。
I advice you to have a look at all the definitions and characterisations of a tree, it is always useful to have more than one in mind, especially when it comes to trees. 我建议你看一下树的所有定义和特征 ,考虑到不止一个,总是有用的,特别是树木时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM