将DAG转换为强连接图 [英] Convert DAG into Strongly Connected Graph

查看:95
本文介绍了将DAG转换为强连接图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给出一个DAG(有向无环图),假设有20,000个顶点和50,000个边.为了将图变成牢固连接的图,您需要插入的最小边数是多少?

Given a DAG (Directed Acyclic Graph), assume 20,000 vertices and 50,000 edges. What is the minimum amount of edges you need to insert in order to turn the graph into a strongly connected graph? What are those new edges that need to be added?

推荐答案

可以用两种不同的方式来理解这个问题.

1)仅根据给定的信息计算给定的边数,这是给定的顶点和边数的所有可能图形的一种解决方案.这个问题没有明确的解决方案.这在带有三个顶点和两个边的图形上很容易说明.以所有可能的方式绘制两个边缘,您将看到解决方案可能需要添加一个或两个边缘-这取决于初始边缘的方向.

2)问题可能是关于基于初始DAG的全部信息找到最小数量的附加边缘的算法.这个问题对我来说似乎并不简单.计算图是否是强连通的,这相对来说比较琐碎,找到一种将图补充到强连通的某种方式的方法也很容易,但是似乎很难证明任何特定的解决方案极少.

抱歉,我现在只能说这些.也许存在一个简单的算法,我只是看不到.也许这个问题并不完全取决于CodeProject的快速问答.答案.看来您应该独立解决问题,不是吗? :-)

—SA
The question can be understood in two different ways.

1) Calculate the required number of edges based just on the information given, one solution of all possible graphs of given number of vertices and edges. This problem has no unambiguous solution. This is easy to illustrate on a graph with three vertices and two edges. Draw the two edges in all possible ways, and you will see that the solution may require adding either one or two edges — it depends on the direction of initial edges.

2) The question may be about the algorithm of finding the minimum number of additional edges based on full information on the initial DAG. This problem seems to be quite non-trivial to me. It is relatively trivial to calculate if the graph is strongly connected, it''s also pretty easy to find a way to complement a graph to a strongly connected somehow, but it seems hard to prove that any particular solution is minimal.

Sorry that''s all I can say right now. Maybe a simple algorithm exists which I just fail to see. Perhaps this problem is not quite up to the CodeProject''s quick Questions & Answers. And it looks like you''re supposed to solve the problem independently, isn''t that so? :-)

—SA


这篇关于将DAG转换为强连接图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆