computing "node closure" of graph with removal

Posted by Fakrudeen on Stack Overflow See other posts from Stack Overflow or by Fakrudeen
Published on 2010-03-12T10:44:34Z Indexed on 2010/03/12 10:47 UTC
Read the original article Hit count: 447

Filed under:
|

Given a directed graph, the goal is to combine the node with the nodes it is pointing to and come up with minimum number of these [lets give the name] super nodes.

The catch is once you combine the nodes you can't use those nodes again. [first node as well as all the combined nodes - that is all the members of one super node]

The greedy approach would be to pick the node with maximum out degree and combine that node with nodes it is pointing to and remove all of them. Do this every time with the nodes which are not removed yet from graph.

The greedy is O(V), but this won't necessarily output minimum number super nodes. So what is the best algorithm to do this?

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about graph-theory