1

Given m shortest paths between any two vertices of a graph. Determining whether we can pick k shortest paths such that their union covers all edges.

I am sure that reduction has to be from set cover but I am not getting a way how to reduce it to this problem. Please help me with it

sv_jan5
  • 1,543
  • 16
  • 42
  • So you have 2 chosen verticies, and k different paths between them, all the same length? Each edge has length 1, or each has a dfferent length? Define the problem better. – maniek Dec 02 '16 at 15:34
  • This is the complete problem: https://s15.postimg.org/cgm5vqgrf/Screenshot_from_2016_11_30_21_17_34.png – sv_jan5 Dec 02 '16 at 15:42
  • 1
    One thing I don't understand about the question: are the two vertices of a graph fixed for a set of paths we are investigating, or can the pairs of start and end vertices of those paths be different? – Tymur Gubayev Dec 04 '16 at 18:45
  • This is the problem statement; https://s15.postimg.org/cgm5vqgrf/Screenshot_from_2016_11_30_21_17_34.png On my own I can't say much about it. But I believe that set of paths are not fixed, they are between differetn pair of vertices because problem states that 'shortest path between some pair of vertices' not 'between a pair of vertices'. – sv_jan5 Dec 05 '16 at 03:41

2 Answers2

2

Hint: look at the graph below. There are lots of different shortest paths from A to B. Can you encode set cover using a graph like this and a set of paths? (well, you will probably have to modify the graph a bit, but this is the general idea).

   o     o     o     o     o     o     o     o     o     o     o     o     o
  / \   / \   / \   / \   / \   / \   / \   / \   / \   / \   / \   / \   / \
A     o     o     o     o     o     o     o     o     o     o     o     o     B
  \ /   \ /   \ /   \ /   \ /   \ /   \ /   \ /   \ /   \ /   \ /   \ /   \ /
   o     o     o     o     o     o     o     o     o     o     o     o     o
maniek
  • 7,087
  • 2
  • 20
  • 43
  • What do A and B correspond to in the set cover. I couldn't get your hint completely. Please elaborate. – sv_jan5 Dec 02 '16 at 16:12
  • On input, you have the graph and a set of paths, each from A to B. Each path will encode a set in the set cover. – maniek Dec 02 '16 at 18:21
  • can you illustrate it with an example? – sv_jan5 Dec 04 '16 at 08:54
  • How about the edited simplier graph? I am not going to do the homework for you. – maniek Dec 04 '16 at 09:05
  • It seems that you are proving the opposite of what I want to prove. Input will not a graph with a set of paths instead it will be a universe with sets containing some elements of it. Somehow I want to represent those sets in form of a graph. I am not asking you to solve my homework. One small example can make the intuition clear that's why I need it. – sv_jan5 Dec 04 '16 at 12:25
  • 1
    Nope. in set cover you have a set S and some set subsets of S called G. Each element of S will map to a node on the top row in the graph above. each element of G will map to a shortest path from A to B , containing only the matching elements in the top row. Also, you need to do something about the bottom row, whixh is left as an exercise to the reader :) – maniek Dec 05 '16 at 09:37
  • I don't understand why we need the bottom row for the reduction. Just by using top row elements we can express sets in form of paths. Adding the bottom row of elements will only add additional edges to the graph which need to be covered by the shortest paths. – sv_jan5 Dec 05 '16 at 11:28
  • I promise I will give you 50+ extra credits (apart from 50 here) for revealing the reason for the bottom row. – sv_jan5 Dec 05 '16 at 13:05
  • Say you have 10-element set S, and G contains 1 element, which is the whole set S. Naturally, the set cover will exist. But the bottom row will have no path. You must do something about that. – maniek Dec 06 '16 at 11:22
1

Update wasn't aware the set cover is NP-complete too. There is no need to do anything to fit the original into the exact set cover, so the wlog assumption I made isn't necessary. But I also realized the basic idea of my proof was wrong: it shows that current problem is a special case of another problem, which makes it easier, not harder. The complete and correct answer is given at https://math.stackexchange.com/q/2047262 by mjqxxxx.

Let's w.l.o.g. assume no single vertice belongs to more than 1 path (i.e. the paths correspond to distinct sets of vertices).

Then this problem is an exact cover problem (which is NP-complete) extended to find all of the exact covers instead of only any one (and then check if one of them has exact k elements -- this check is a little trickier in general case). https://en.wikipedia.org/wiki/Exact_cover https://en.wikipedia.org/wiki/Set_cover_problem

The set X contains all vertices of the graph, the collection S contains the sets of vertices corresponding to the given set of paths.

Community
  • 1
  • 1
Tymur Gubayev
  • 468
  • 4
  • 14
  • I am not sure but I think the doubt which you raised in the comments is actually quite critical for the problem. From the problem statement it seems that all paths are between two vertices only because your assumption that all paths are disjoint cannot be assumed w.l.o.g. – sv_jan5 Dec 05 '16 at 08:57