question: private boolean labelToKeepRec ( Node v , Set < Integer > ids , NodeSet keep ) { boolean hasBelow = false ; int id = ( Integer ) v . getInfo ( ) ; if ( ids . size ( ) == 0 || ids . contains ( id ) ) hasBelow = true ; for ( Edge e = v . getFirstOutEdge ( ) ; e != null ; e = v . getNextOutEdge ( e ) ) { Node w = e . getTarget ( ) ; if ( labelToKeepRec ( w , ids , keep ) ) hasBelow = true ; } if ( hasBelow ) keep . add ( v ) ; return hasBelow ; }
target:  label all nodes in tree that we must keep in induced tree