简体   繁体   English

Boruvka算法有向图的最小生成树

[英]Boruvka algorithm Minimum Spanning Tree for Directed Graphs

Does the Boruvka algorithm (http://en.wikipedia.org/wiki/Bor%C5%AFvka's_algorithm) only work for undirected graphs? Boruvka算法(http://en.wikipedia.org/wiki/Bor%C5%AFvka's_algorithm)仅适用于无向图吗?

For example, if we have a graph structure that looks like: 例如,如果我们有一个图结构,如下所示:

node 1 -> node 2 (weight 1), node 3 (weight 1), node 4 (weight 1)

node 2 -> node 3 (weight 2)

node 3 -> node 4 (weight 2)

node 4 -> node 2 (weight 2)

Then the minimum spanning tree should include the edges: 然后,最小生成树应包括边缘:

1 -> 2

1 -> 3

1 -> 4

However, Boruvka's algorithm will spit out 但是,Boruvka的算法会吐出

1 -> 2

2 -> 3

3 -> 4

Because, Boruvka first looks at each individual node and adds the shortest edge outgoing from that node to the MST. 因为,Boruvka首先查看每个单独的节点,并将从该节点传出的最短边添加到MST。

I know in the wikipedia article it says that edge weights have to be distinct but as long as all of the edge weights coming out of node 1 are less than the "outer" edge weights (from nodes 2-4) then it seems like Boruvka's algorithm fails. 我在Wikipedia文章中知道,它说边缘权重必须是不同的,但是只要从节点1出来的所有边缘权重都小于“外部”边缘权重(来自节点2-4),那么看来Boruvka的算法失败。 Is this because it is a directed graph not undirected? 这是因为它是有向图而不是无向图吗?

Is this because it is a directed graph not undirected? 这是因为它是有向图而不是无向图吗?

Yes. 是。 For a directed graph, you would have to consider incoming as well as outgoing edges, then the algorithm would work in the same manner. 对于有向图,您必须考虑入站和出站边,然后算法将以相同的方式工作。 The easiest way to do this is to consider the underlying undirected graph. 最简单的方法是考虑基础无向图。

The question you should ask yourself is what does "minimum spanning tree" mean for a directed graph ? 您应该问自己的问题是,“最小生成树”对有向图意味着什么? The algorithm you should use depends on the answer to this question. 您应使用的算法取决于此问题的答案。

Minimum spanning tree is defined only on undirected graphs so taking this into account your question doesn't make sense. 最小生成树仅在无向图上定义,因此考虑到您的问题没有任何意义。 Probably you are looking for something else, eg strongly connected induced subgraph of original graph with the same set of vertices and minimal sum of edge weights. 可能您正在寻找其他东西,例如具有相同顶点集和最小边缘权重总和的原始图的强连通诱导子图。 In this case you don't have to get tree, actually tree is also defined as an undirected graph. 在这种情况下,您不必获取树,实际上树也被定义为无向图。 IMHO algorithm solving this would be computationally harder problem. 解决这个问题的恕我直言算法将是计算上更困难的问题。

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

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