简体   繁体   English

通过此算法证明无向图的最大outdegree上的O(log n)的上界变为有向图

[英]Prove upper bound of O(log n) on the maximum outdegree of an undirected graph turned into a directed one by this algorithm

Some definitions first: an "accumulated graph" is a graph where edges are added to it later on. 首先是一些定义:“累积图”是稍后将边添加到其中的图。 The topic is orientation problem (making an undirected graph directed), when our goal is to make the maximum out-degree the lowest possible. 主题是方向问题(指向无向图),当我们的目标是使最大外度尽可能最低。

Now, they gave this algorithm: "When the edge (u,v) is added, we will direct it from the vertex with the lower outdegree to the higher one. if equal, choose randomly." 现在,他们给出了这个算法:“当添加边缘(u,v)时,我们将它从具有较低outdegree的顶点引导到较高的顶点。如果相等,则随机选择。”

For example, if outdegree(u) = 3 and outdegree(v) = 4, and we just added (u,v), the algorithm will direct it from u-->v. 例如,如果outdegree(u)= 3且outdegree(v)= 4,并且我们刚刚添加(u,v),则算法将从u - > v引导它。 If their outdegree was equal, both u,v and v,u were possible. 如果他们的退出程度相同,那么u,v和v都是可能的。

The question is to prove an upper bound of O(log n) for the maximum outdegree possible. 问题是证明O(log n)的上界可能是最大的outdegree。 The second question is to form a graph where this algorithm will lead to Omega(log n) maximum outdegree. 第二个问题是形成一个图表,该算法将导致Omega(log n)最大outdegree。

So far, all I can point out is that the question is wrong. 到目前为止,我只能指出问题是错误的。

First of all, my friend suggested that they actually meant O(log m) [m = # of edges], since that for n vertices in an undirected graph, we have at most n(n-1)/2 edges, which is eventually O(n^2). 首先,我的朋友建议他们实际上是指O(log m)[m =边缘数],因为对于无向图中的n个顶点,我们最多有n(n-1)/ 2个边,这是最终是O(n ^ 2)。 If we assume that in a complete graph, every node's outdegree is log(n), we get total of n*log(n) outdegrees, which is significally smaller than n^2 (and doesn't make sense because all outdegrees should sum to the # of edges.). 如果我们假设在一个完整的图中,每个节点的outdegree是log(n),我们总得到n * log(n)outdegree,这明显小于n ^ 2(并且没有意义,因为所有outdegrees都应该总和到#边缘。)

I came up with this algorithm that proves that because we choose randomly in cases both are equal, the highest possible outdegree is of O(n): Direct n-1 vertices to the last one (possible in the worst-case scenario where all orientations are in the same direction). 我想出了这个算法,证明了因为我们在两者都相等的情况下随机选择,最高可能的outdegree是O(n):直接n-1个顶点到最后一个(在所有方向的最坏情况下可能)是朝着同一个方向)。 We now have n-1 vertices with an outdegree of 1, and 1 with 0. Then repeat recusively to accomplish n+(n-1)+(n-2)+...+1+0 outdegrees. 我们现在有n-1个顶点,outdegree为1,而1为0。然后重复重复以完成n +(n-1)+(n-2)+ ... + 1 + 0 outdegree。

I might be understanding the problem wrong but that's what I got so far. 我可能会理解错误的问题,但这就是我到目前为止所得到的。

EDIT: The instructor edited the question and said the graph in this question is a forest (which means you can have at most V-1 edges). 编辑:教师编辑了问题,并说这个问题中的图形是一个森林(这意味着你最多可以有V-1边缘)。 I believe I managed to prove the first question: 我相信我设法证明了第一个问题:

Imagine this: Since the only way (worst case scenario) to have an outdegree of 2 is to connect two nodes with an outdegree of 1, we have to have 4 nodes where A is connected to B and C is connected to D in order to add an edge from A to C and make one of them with an outdegree of 2. Because this is the smallest tree possible to create an outdegree of 2, the only way to create an outdegree of 3 is to build two identical trees and connect them together again. 想象一下:由于唯一的方法(最坏的情况)得到2的outdegree是连接两个节点1的outdegree,我们必须有4个节点,其中A连接到B,C连接到D,以便添加从A到C的边缘,并使其中一个具有2的outdegree。因为这是可以创建2的outdegree的最小树,所以创建3的outdegree的唯一方法是构建两个相同的树并连接它们再度携手。 If we repeat this process until we reach n vertices, we will notice we eventually get to 1+2+4+8+...+log n as our outdegree. 如果我们重复这个过程直到我们到达n个顶点,我们会注意到我们最终得到1 + 2 + 4 + 8 + ... + log n作为我们的outdegree。

Right now I keep thinking about the second question. 现在我一直在思考第二个问题。

First of all, because m = O(n^2), we have O(log m) = O(log n^2) = O(2 * log(n)) = O(log n). 首先,因为m = O(n ^ 2),我们得到O(log m)= O(log n ^ 2)= O(2 * log(n))= O(log n)。 In other words, the problem doesn't contradict with the reasoning suggested by your friend. 换句话说,这个问题与你朋友提出的推理并不矛盾。

But you are right that the problem (as you've stated) is not correct -- the worst-case outdegree is O(n), using the process you described. 但你是正确的,问题(如你所说)是不正确的 - 最坏情况的outdegree是O(n),使用你描述的过程。 (But the highest outdegree is n-1, not n as you've written.) (但是最高的出局是n-1,而不是你所写的n。)

Perhaps the problem actually asks you to bound the maximum expected outdegree? 也许问题实际上要求你限制最大预期的 outdegree?

I strongly suspect that the intended problem was to bound the competitive ratio between this online algorithm and the offline optimum (eg, if the offline optimum has maximum out degree 1, then the online solution has maximum out degree O(log n); if the offline optimum has maximum out degree √n, then the online solution has maximum out degree O((√n) log n)). 我强烈怀疑,预期的问题是限制此在线算法与离线最优之间的竞争比率(例如,如果离线最优具有最大出度1,则在线解决方案具有最大出度O(log n);如果离线最优具有最大出度√n,则在线解具有最大出度O((√n)log n))。 The lower bound is easy enough (see the lower bound for union-by-rank union-find for inspiration), and I conjecture that the upper bound is attainable as well. 下限很容易(参见联盟的联合 - 找到灵感的下限),我猜想上限也是可以达到的。

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

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