简体   繁体   English

最小直径生成树的算法

[英]Algorithm for minimum diameter spanning tree

给定无向图和连通图G,找到直径最小的生成树。

singhsumit linked the relevant paper by Hassin and Tamir , entitled "On the minimum diameter spanning tree problem", but his answer is currently deleted. singhsumit链接了Hassin 和Tamir的相关论文,题为“关于最小直径生成树问题”,但是他的答案目前被删除。 The main idea from the paper is that finding a minimum diameter spanning tree in an undirected graph can be accomplished by finding the "absolute 1-center" of the graph and returning a shortest path tree rooted there. 本文的主要思想是,通过找到图的“绝对1中心”并返回以该图为根的最短路径树,可以实现在无向图中找到最小直径的生成树。

The absolute 1-center is the point, either on a vertex or an edge, from which the distance to the furthest vertex is minimum. 绝对1中心是顶点或边缘上的点,从该点到最远顶点的距离最小。 This can be found via an algorithm of Kariv and Hakimi (An Algorithmic Approach to Network Location Problems. I: the p-Centers) or an earlier algorithm of Hakimi, Schmeichel, and Pierce (On p-Centers in Networks), which I will attempt to reconstruct from just the running time and decades of hindsight. 这可以通过Kariv和Hakimi的算法(网络位置问题的算法方法,我:p中心)找到,也可以通过Hakimi,Schmeichel和Pierce的更早算法(在网络中的p中心上)找到。尝试从运行时间和数十年的事后洞察力中进行重构。 (Stupid pay walls.) (愚蠢的付费墙。)

Use Floyd--Warshall or Johnson's algorithm to compute all-pairs distances. 使用Floyd--Warshall或Johnson的算法来计算所有对的距离。 For each edge u--v, find the best candidate for a 1-center on that edge as follows. 对于每个边缘u-v,如下找到该边缘上1个中心的最佳候选者。

Let the points on the edge u--v be indexed by µ ranging from 0 (u itself) to len(u--v) (v itself). 令u–v边上的点的索引范围为0(u本身)到len(uv)(v本身)。 The distance from the point at index µ to a vertex w is 从索引µ处的点到顶点w的距离为

min(µ + d(u, w), len(u--v) - µ + d(v, w)). min(µ + d(u,w),len(u--v)-µ + d(v,w))。

As a function of µ, this quantity is increasing and then decreasing, with the maximum at 作为μ的函数,此数量先增加然后减少,最大值为

µ = (len(u--v) + d(v, w) - d(u, w))/2. µ =(len(u--v)+ d(v,w)-d(u,w))/ 2。

Sort the vertices by this argmax. 按此argmax对顶点进行排序。 For each partition of the array into a left subarray and a right subarray, compute the interval [a, b] of µ that induce the same argmax partition. 对于分成左子阵列和右子阵列的数组的每个分区,计算引起相同argmax分区的µ的间隔[a,b]。 Intersect this interval to [0, len(u--v)]; 将此间隔与[0,len(u--v)]相交; if the intersection is empty, then move on. 如果相交处为空,则继续前进。 Otherwise, find the maximum distance L in the left subarray from the point on u--v indexed by a, and the maximum distance R in the right subarray from the point on u--v indexed by b. 否则,找到左子数组中距u--v上由a索引的点的最大距离L,以及右子数组中距u--v上由b索引的点的最大距离R。 (The cost of computing these maximums can be amortized to O(1) for each partition, by scanning left-to-right and right-to-left at the beginning.) The best choice is the µ in [a, b] that minimizes max(L - (µ - a), R + (b - µ)). (通过在开始时从左到右和从右到左扫描,每个分区的计算这些最大值的费用可以摊为O(1)。)最佳选择是[a,b]中的µ最小化max(L-(µ-a),R +(b-µ))。

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

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