查找有向加权图的所有生成树

发布于 2024-12-14 11:11:05 字数 466 浏览 0 评论 0原文

我发现本文到目前为止。它已经过时了吗?有没有更快更好的实施方案?

顺便说一句,维基百科说无向图中可以有 n^n-2 个生成树。有向图中可以有多少棵生成树?

I have found this paper so far. Is it outdated? Are there any faster and better implementations?

By the way, Wikipedia says that there can be n^n-2 spanning trees in a undirected graph. How many spanning trees can be in a directed graph?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

人疚 2024-12-21 11:11:05

如果您使用您提到的论文中的术语,并将有向图的生成树定义为以顶点 r 为根的树,具有从 r 到任何其他顶点的唯一路径,则:

很明显,当有向图具有最大数量的生成树时,最坏的情况是完全图(任何对都有 a->b 和 b->a 边)。
如果我们“忘记”方向,我们将得到 n^{n-2} 生成树,就像无向图的情况一样。对于任何这种生成树,我们都有 n 个选项来选择根,并且这个选择定义了我们需要使用的边的唯一定义方向。不难看出,我们得到的所有树都是跨越的、独特的,没有其他选择。这样我们就得到了n^{n-1}个生成树。严格的证明需要时间,我希望简单的解释就足够了。

因此,在最坏的情况下,此任务将花费指数时间,具体取决于顶点数。考虑到输出的大小(所有生成树),我得出的结论是,对于任意图,算法不可能明显更快更好。我认为您需要以某种方式重新表述您的原始问题,以不处理所有生成树,并且可能仅需要按某些标准进行搜索。

If you use terms from paper you mentioned and you define spanning tree of directed graph as tree rooted in vertex r, having unique path from r to any other vertex then:

It's obvious that worst case when directed graph has the greatest number of the spanning trees is complete graph (there are a->b and b->a edges for any pair).
If we "forget" about directions we will get n^{n-2} spanning trees as in case of undirected graphs. For any of this spanning trees we have n options to choose a root, and this choice define uniquely define directions of edges we need to use. Not hard to see, that all trees we get are spanning, unique and there are no nother options. So we get n^{n-1} spanning trees. Strict proof will take time, I hope that simple explanation is enough.

So this task will take exponential time depend from vertex count in worst case. Considering the size of output (all spanning trees), I conclude that for arbitrary graph, algorithm can not be significantly faster and better. I think you need to somehow reformulate your original problem to not deal with all spanning trees, and may be search only needed by some criteria.

往事风中埋 2024-12-21 11:11:05

仅适用于无向图....

n^n-2 生成树仅适用于完整图....要查找任何图的生成树的总数,您可以应用此方法.....

  1. 找到的邻接矩阵图表。
  2. 如果列值由“i”表示,行条目由“j”表示,那么...
  3. 如果 i=j...则该值将是顶点的度数
  4. 假设,顶点 v1 和 v2 之间有一条边,则矩阵项的值将为 -1......7 如果有两条边则为 -2...&依此类推...
  5. 构建邻接矩阵后...排除任何行和列...即第N行和第N列...
  6. 答案将是跨越树的总数。

for undirected graph only....

n^n-2 spanning tress are possible for only complete graph....to find total number of spanning trees of any graph u can apply this method.....

  1. find the adjacency matrix of the graph.
  2. if column values are represented by 'i' and row entries by 'j' then...
  3. if i=j...then the value will be the degree of vertex
  4. suppose,there is a single edge between vertex v1 and v2 then the value of matrix entry will be -1......7 if there are two edges then it will be -2...& so on...
  5. after constructing adjacency matrix....exclude any row and column...i.e, Nth row and Nth column....
  6. answer will be the total number of spanning tress.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文