you ve get undirected tree s consist n nod your task build optimal Tdecomposition Lets define Tdecomposition followslet denote set node s v Lets consider undirected tree t nod nonempty subset v xi the tree t tdecomposition s follow condition hold union xi equal v edge ab tree s exist tree node t contain b node tree t xi xj contain node tree s node tree t lie path xi xj contain node so condition equivalent follow node tree t contain node tree s form connect subtree tree t there obviously distinct tree t Tdecompositions tree s for example tdecomposition tree consist single node equal set vLets define cardinality node xi number nod tree s contain node Lets choose node maximum cardinality t Lets assume cardinality equal w then weight Tdecomposition t value w the optimal Tdecomposition minimum weightyour task find optimal tdecomposition give tree s minimum number node