Given a tree T=(V,E) of n nodes such that each node v is associated with a value-weight pair (val v,w v ), where value val v is a real number and weight w v is a non-negative integer, the density of T is defined as Σv∈V Valu/Σv∈Vwv. A subtree of T is a connected subgraph (V′,E′) of T, where V′V and E′E. Given two integers w min∈ and w max, the weight-constrained maximum-density subtree problem on T is to find a maximum-density subtree T′=(V′,E′) satisfying w minΣv V′ w v ≤w max. In this paper, we first present an O(w max n)-time algorithm to find a weight-constrained maximum-density path in a tree T, and then present an O(w max 2 n)-time algorithm to find a weight-constrained maximum-density subtree in T. Finally, given a node subset S⊂V, we also present an O(w max 2 n)-time algorithm to find a weight-constrained maximum-density subtree in T which covers all the nodes in S.
All Science Journal Classification (ASJC) codes