2

I have two seperate problems both revolving around graphs and determining an approach to find a simple path from s to t that goes via as many blue vertices as possible. Additionally I have to determine which one of the two problems that is NP-Hard.

The graph in the first problem is an undirected graph where some of the vertices are blue and the graph in the other problem is a a directed acyclic graph also where some of the vertices are blue.

I have got a hint that the second problem with the directed acyclic graph, can be solved using dynamic programming, but I have a very hard time grasping how the problem can be modelled as a dynamic programming problem, as I do not quite see the overlapping of subproblems. Maybe one could demonstrate or clarify how this can be done?

Also the first problem should be the NPHard one, that can be reduced to a Hamiltonian Path, I can partly see how this is correct, but then the question arises, can the second problem with the directed acyclic graph then also be reduced to a Hamiltonian Path, also making it NPHard? Why or why not?

1 Answers1

0

The fundamental asymmetry of NP-completeness is that NP problems can always be reduced to NP-complete or hard ones, but NP-complete ones cannot always be reduced to NP ones.

You are correct that the first problem is NP hard, and that the reason why has to do with Hamiltonian paths, but the reduction goes the other way. Given a Hamiltonian path problem on an undirected graph, can you always express it in terms of the first problem?

As for the second, pretend that you didn't just hear the term "topological sort" float by on the breeze...

btilly
  • 43,296
  • 3
  • 59
  • 88