0

So my problem is the following:

I have an undirected (complete) weighted graph G=(V,E), and I would like to generate all the possible spanning trees with minimum number of leaves, i.e. with minimum number of vertices of degree 1. Let's call this kind of trees MIN_LEAF.

Possibly, I would like to directly generate, among all trees with minimum number of leaves, the one which has also the minimum total weight (please note that this is not necessarily a minimum spanning tree). Is the problem of deciding if a tree T is a MIN_LEAF for a given graph G NP-complete?

If so, I wonder if some kind of heuristic algorithm exists (greedy or local search) which can at least give an approximate solution for this problem.

Thanks in advance.

Syden
  • 8,425
  • 5
  • 26
  • 45
user7427473
  • 3
  • 1
  • 2

1 Answers1

4

The first problem you described - finding a spanning tree with the fewest number of leaves possible - is NP-hard. You can see this by reducing the Hamiltonian path problem to this problem: notice that a Hamiltonian path is a spanning tree of a graph and only has two leaf nodes, and that any spanning tree of a graph with exactly two leaf nodes must be a Hamiltonian path. That means that the NP-hard problem of determining whether a Hamiltonian path exists in a graph can be solved by finding the minimum-leaf spanning tree of the graph: the path exists if and only if the minimum-leaf spanning tree has exactly two leaves. The second problem you've described contains that first problem as a special case and therefore is going to also be NP-hard.

A quick Google search turned up the paper "On finding spanning trees with few leaves", which seems like it might be a good starting point for approximation algorithms (they have a 2-approximation for arbitrary graphs) and further reading on the subject.

templatetypedef
  • 362,284
  • 104
  • 897
  • 1,065
  • Thank you. Just wanna add that the decisional version of the problem is NP-complete though: given an integer k>=2 representing the maximum number of leaves allowed in a spanning tree, a graph G and a candidate solution tree T, it is trivial to check in polynomial time if T is a spanning tree for G with a number of leaves lesser or equal than k. – user7427473 Jan 17 '17 at 00:19
  • @user7427473 Absolutely. As framed in the original question you didn't have that bit, which is why I mentioned **NP**-hardness rather than completeness. – templatetypedef Jan 17 '17 at 00:22