I am having trouble coming up with a polynomial time algorithm to solve the following problem:
Let =(,) be an undirected and unweighted graph with vertices. Let _1,_2,...,_ be =−1 distinct spanning trees of . Find a polynomial time algorithm that finds a spanning tree
=(,_) in that contains at least one edge from each spanning tree _.
I would really appreciate any help on this!
Here is a basic solution.
If for the given graph |E| < 2*(|V|-1) or the size list of spanning trees < |V|, then the above algorithm definitely works.
An interesting case is when |E| >= 2*(|V|-1). As shown in the image below, for some input list of spanning trees L, say the set of green edges is the result set returned by the above algorithm. A spanning tree of Blue edges could be formed without using any of the green edges.
Just posted this answer so that it works as some basic ground work for people trying to answer this question. Otherwise, could be treated as brute force solution.