MathOverflow is a question and answer site for professional mathematicians. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In graph G, every edge has a color. Rainbow spanning tree is a spanning tree where all edges have different colors. I want a polynomial algorithm to find such tree if exists any Anyone can help?

share|cite|improve this question

Boersma and Li [1] give a characterization of when an edge-colored graph contains a rainbow spanning tree. A polynomial time algorithm for your problem exists as the problem is equivalent to finding a common independent set of maximum cardinality in two matroids.

The problem of finding a spanning tree with as few different colors as possible is NP-hard, as shown in the same paper I believe.

[1] Hajo Broersma and Xueliang Li. Spanning trees with many or few colors in edge-colored graphs. Discuss. Math. Graph Theory, 17(2):259–269, 1997.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.