views:

52

answers:

1

How can I find 2-approximate solution for a problem of determining a maximum subgraph with no cycles of an oriented graph? Subgraph is "maximum" if it contains the maximal number of edges amongst other graphs that bear the same property.

2-approximate means that we can build 2 times smaller graph than the optimal one. That's quite a big constraint reduction and should lead to quite a dumb algorithm that--wow!--turns out to be only twice worse than the exact solution.

[That's a problem from the exam I passed recently. Not a homework anymore.]

+2  A: 

Divide the set of nodes into two nonempty sets, A and B. Consider the set of edges from A to B and the set of edges from B to A. Throw out the edges from the smaller set and keep the edges from the larger set (break ties arbitrarily). Recurse on A and B individually.

The resulting graph is acyclic because every cycle will be broken the first time the cycle's nodes are split among A and B. The total set of edges we throw out is no bigger than the total set of edges we keep, so we've thrown out at most half of the edges.

[note: I don't think you mean 'maximal' here, you mean 'maximum'. A 'Maximal' graph typically means one which has no proper superset meeting the condition. A maximal acyclic subgraph is easy to construct with no approximation factor, just add all the edges to a new graph one at a time only if they don't add a cycle.]

Keith Randall
Seems a correct O(V²) solution. Thank you for linguistic explanations as well.
Pavel Shved
It can be done in O(E) time. Let A be {v_1} and B be {v_2, ... v_n}. You just need to compare the indegree and outdegree of v_1 and drop the edges with smaller degree. Repeat for A = {v_2} and B = {v_3, ..., v_n}, comparing the indegree/outdegree of v_2 ignoring edges to/from v_1.
Keith Randall