Monday, May 3, 2010

Min edge coverage problem

Problem: Given a directed graph, find a minimal set of vertices which touch all edges
within a graph.

This is a NP-complete problem. No polynomial time solution exists.

One solution is to get powerset of all vertices, then for each vertice subset, check if it covers all edges in the graph. Return the subset with the smallest size.

min_size = Infi;
set_index = -1;
Generate all possible vertex set S;
for all set si in S
if union of edges covered by each vertex in set si == E
if (si.size() < min_size)
min_size=si.size();
set_index = i;
return i;

This solution is from Careercup Top 150 Questions.

2 comments:

Chris said...

Hi~
I read your post about using GflAx to convert PDF to image before. I try to use it but it only run on visual studio development server. When I put it in the IIS server, it just keep loading the page (but it seem just hang there...not running anything). Do you have any idea?

Tom said...

Hi Chris,

I don't know if there is any permission problem here. Maybe check if IUSR_[machine name] has the permission to invoke GflAx COM object remotely or something like that.

One example I had of this type is: I once wrote a COM object to do spell check. I set it up on IIS server but when creating object of the COM from ASP, I had some error. Then I went to Control panel -> Administrative Tools -> Component Services -> Computers -> My Computer -> DCOM Config, open the property of that COM, go to Security -> Launch and Activation Permissions -> Customize -> Edit -> Internet Guest Account, check "Remote Launch" and "Remote Activation", then it worked.

I don't know if this solves your issue, but just have a try. Good luck.

Blog Archive

Followers