question: @ Override public Node pickNode ( final InferenceGraph g ) { treeCache . clear ( ) ; Pair < List < Node > , Integer > bestPath = noPath ; for ( Node n : g . nodes ) { if ( ! Collections . disjoint ( n . data , varsToSolve ) ) { Pair < List < Node > , Integer > path = computeTreeToLeafs ( n ) ; if ( path . snd < bestPath . snd ) { bestPath = path ; } } } if ( bestPath == noPath ) { throw new NodeNotFoundException ( g ) ; } return bestPath . fst . head ; }
target:  Pick the leaf that minimize cost