是否存在不包含最小/最大加权边的最小生成树?
如果我们有一个(任意)连通的无向图 G,其边具有不同的权重,那么
- G 的每个 MST 是否都包含最小加权边?
- G 是否存在不包含最大加权边的 MST?
另外,如果有人能给出一些在处理此类 MST 问题时必须牢记的关键事项的提示,我会更加感激。
这是一个家庭作业问题。谢谢。
If we have an (arbitrary) connected undirected graph G, whose edges have distinct weights,
- does every MST of G contains the minimum weighted edge?
- is there an MST of G that does not contain the maximum weighted edge?
Also, I'm more thankful if someone can give a hint of the key things one must keep in mind when dealing with such MST questions.
This is a homework problem. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
可能有,但不一定有。考虑如下 4 顶点图:
最小生成树由边集 {CA, AB, BD} 组成。沿 {CD} 的最大边权重为 50,但它不是 MST 的一部分。但如果 G 已经等于它自己的 MST,那么显然它会包含它自己的最大边。
是的。 MST 具有剪切属性。 割只是将图的顶点划分为两个不相交的集合。对于您可以进行的任何切割,如果该切割中的一条边的权重小于该切割中其他边的权重,则该边属于图中的所有 MST。因为您保证边权重不同,所以您还保证有一条边小于所有其他边。
最好的选择是使用 MST 的一般属性来推理事物,并尝试构建您认为可以证明您的情况的具体反例。我对上面的每条推理都给出了一个例子。由于剪切和循环属性,您始终可以准确确定哪些边在 MST 中,因此您可以系统地测试每条边以确定它是否在 MST 中。
There may be, but there doesn't have to be. Consider a 4-vertex graph as follows:
The minimum spanning tree consists of the edge set {CA, AB, BD}. The maximum edge weight is 50, along {CD}, but it's not part of the MST. But if G were already equal to its own MST, then obviously it would contain its own maximum edge.
Yes. MSTs have a cut property. A cut is simply a partition of the vertices of the graph into two disjoint sets. For any cut you can make, if the weight of an edge in that cut is smaller than the weights of the other edges in the cut, then this edge belongs to all MSTs in the graph. Because you guaranteed that the edge weights are distinct, you have also guaranteed that there is an edge which is smaller than all other edges.
Your best bet is to reason about things using the properties of MSTs in general, and to try to construct specific counterexamples which you think will prove your case. I gave an instance of each line of reasoning above. Because of the cut and cycle properties, you can always determine exactly which edges are in an MST, so you can systematically test each edge to determine whether or not it's in the MST.
是的。假设我们有一个不包含最小权重边的
MST
。现在,将此边包含到MST
将导致一个循环
。现在循环
中总会有另一条边,可以将其删除以删除循环并仍然保持图(MST
)连接。取决于图表。如果
图
本身是一棵树,那么我们需要将其所有n-1
边包含在MST
中,因此最大权重边不能被排除在外。此外,如果最大权重边是切边,因此排除它永远不会导致连通性,则不能排除最大权重边。但如果最大权重边缘是循环
的一部分,则可以从MST
中排除。Yes. Lets assume we have a
MST
which does not contain the min weight edge. Now the inclusion of this edge to theMST
will result in acycle
. Now there will always be another edge in thecycle
which can be removed to remove the cycle and still maintain the graph(MST
) connected.Depends on the graph. If the
graph
itself is a tree then we need to include all of itsn-1
edges in theMST
, so the max weight edge cannot be excluded. Also if the max weight edge is acut-edge
so that its exclusion will never result in connectivity, then the max weight edge cannot be excluded. But if the max weight edge is a part of acycle
then it is possible to exclude from theMST
.对于你的第一个问题,答案是否定的,kruskal 算法证明了这一点。它将始终选择最小成本边。
对于第二个问题,答案是肯定的,找到一个示例图很简单:
第三条边永远不会被选择,因为它引入了一个循环。所以基本上,如果成本最大的边插入到 MST 中会产生一个循环,那么它就不会被插入。
For your first question the answer is no, and kruskal's algorithm proves it. It will always select the minimum cost edge.
For the second question the answer is yes, and it's trivial to find an example graph:
The third edge will never be selected as it introduces a cycle. So basically, if the edge with the maximum cost would create a cycle if inserted in the MST, it won't be inserted.
我看你也正在通过2009年的CSC263考试学习? (这里也一样!)
查看最小值始终位于 MST 中的另一种方法是简单地查看这个最小边(称之为 e):
(假设这与其他顶点有连接)。现在,e 不包含在最终 MST 中意味着在不失一般性的情况下,我们在某个时刻有 v1 在 MST 中,但没有 v2。然而,添加 v2 而不添加 e 的唯一方法是说添加 v1 不会将 e 添加到队列中(因为根据定义,e 将位于队列顶部,因为它具有最低优先级),但是这个与 MST 构造定理相矛盾。
因此,本质上,不可能有一条具有最小权重的边不进入队列,这意味着构建的任何 MST 都会拥有它。
I see you too are studying for CSC263 through the 2009 test? (Same here!)
Another way to see that the minimum is always in the MST is to look simply at this minimum edge (call it e):
(Assume this has connections to other verticies). Now, for e NOT to be included in the final MST means at one point we have, without loss of generality, v1 in the MST but not v2. However, the only way to add v2 without adding e would be to say that the addition of v1 didn't add e to the queue (because by definition, e would be at the top of the queue because it has lowest priority) but this contradicts the MST construction theorem.
So essentially, it is impossible to have an edge with minimum weight not get to the queue which means that any MST constructed would have it.