Search code examples
algorithmgraphorientationassignundirected-graph

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."

For example, if outdegree(u) = 3 and outdegree(v) = 4, and we just added (u,v), the algorithm will direct it from u-->v. If their outdegree was equal, both u,v and v,u were possible.

The question is to prove an upper bound of O(log n) for the maximum outdegree possible. The second question is to form a graph where this algorithm will lead to Omega(log n) maximum 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). 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.).

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). 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.

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). 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. 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.

Right now I keep thinking about the second question.


Solution

  • First of all, because m = O(n^2), we have 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. (But the highest outdegree is n-1, not n as you've written.)

    Perhaps the problem actually asks you to bound the maximum expected outdegree?