[英]How to find smallest cost of edges to add to a weighted graph to make it biconnected?
This is related to the following problem- http://www.iarcs.org.in/inoi/contests/aug2005/Advanced-2.php . 这与以下问题有关:http: //www.iarcs.org.in/inoi/contests/aug2005/Advanced-2.php。 Any hints on how to solve this problem?
关于如何解决此问题的任何提示?
Here are a few simple observation that give us a solution to this problem: 以下是一些简单的观察结果,可以为我们解决这个问题:
If a non-capital city is removed, the rest of the graph is still connected. 如果删除了非首都城市,则该图的其余部分仍将连接。 It is the case because we can reach one city from another through the capital.
之所以如此,是因为我们可以通过首都从另一个城市到达一个城市。
If a capital is removed, the rest of the graph is empty. 如果删除了大写,则该图的其余部分为空。
It means that we just need to find a minimum spanning tree in the given graph after removing the first vertex and all edges adjacent to it. 这意味着我们只需要在删除第一个顶点及其相邻的所有边后,在给定图中找到最小的生成树。 You can find a minimum spanning tree using any standard algorithm(for example, Prim's).
您可以使用任何标准算法(例如Prim's)找到最小生成树。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.