Path between nodes in a colored oriented tree with given weight sum

27 Views Asked by At

Consider an oriented tree where each node is colored either black, white, or both. In addition, each (oriented) edge has a given weight.

I am trying to see whether there exists a pair $(u, v)$ of nodes such that both of them are black (also means that both of them can be B&W or one black and one B&W) AND

• there exists an oriented path from $u$ to $v$ such that the sum of weights on this path is equal to a given integer K.

• the sum of weights on the undirected path from $u$ to $v$ is equal to K (we are ignoring the orientation of the vertices here).

I don’t care about the vertices, I need just a YES/NO answer.