简体   繁体   English

最小化图中的桥数

[英]Minimising Number of Bridges in a Graph

I was trying to solve a problem which basically reduces to this: 我试图解决一个基本上减少到这个问题的问题:
Give a set of N nodes numbered from 1 to N and M edges where N<10000 and M<100000 , 给出一组N个节点,编号从1到N和M个边缘,其中N <10000M <100000
Find an Edge(u,v) which when added to the graph -- Minimizes the number of bridges in the graph . 找到边缘(u,v) ,当添加到图形中时 - 最小化图形中的桥梁数量
If there are many such edges - Print the one which has lowest lexicographical value. 如果有许多这样的边缘 - 打印具有最低字典值的那个边缘
What would be an efficient approach to this problem? 什么是解决这个问题的有效方法?

I believe this problem is very hard. 我相信这个问题很难。 Here would be outline of the solution I can think of: 这里将概述我能想到的解决方案:

1) Find all bridges in graph. 1)在图中找到所有桥。

2) Now imagine that bridges are the only edges you want in your graph. 2)现在想象桥梁是图中唯一的边缘。 You only keep bridges and join all the nodes between bridges in big nodes. 您只保留桥接并加入大节点中桥之间的所有节点。

3) You now have a tree. 3)你现在有一棵树。 Edges are bridges, nodes are "big nodes" that combine nodes from previous graph. 边是桥,节点是“大节点”,它们组合了前一个图的节点。

4) Let's call this forest graph T. 4)让我们称之为森林图T.

5) Connecting any two nodes in graph T, creates a cycle. 5)连接图T中的任意两个节点,创建一个循环。 Any edge in the cycle is not a bridge. 循环中的任何边缘都不是桥梁。

6) Point 5 implies that solution is found by creating the longest cycle possible. 6)第5点意味着通过创建尽可能长的循环来找到解决方案。 You can do that simply by finding two nodes that have longest distance between them. 您只需找到两个距离最长的节点即可。

7) You can find nodes with longest distance in graph. 7)您可以在图中找到距离最长的节点。 How is discussed here: A linear-time algorithm for finding the longest distance between two nodes in a free tree? 这里讨论如何: 一个线性时间算法,用于找到自由树中两个节点之间的最长距离?

Let me know if any point needs further explanation. 如果有任何意见需要进一步解释,请告诉我。

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

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