public static void prune(DialogueState state){
  try {
    Set<String> nodesToKeep=getNodesToKeep(state);
    if (!nodesToKeep.isEmpty()) {
      DialogueState reduced=reduce(state,nodesToKeep);
      reinsertActionAndUtilityNodes(reduced,state);
      removePrimes(reduced);
      removeSpuriousNodes(reduced);
      state.reset(reduced);
    }
 else {
      state.reset(new BNetwork());
    }
  }
 catch (  RuntimeException e) {
    log.warning("cannot prune state: " + e);
  }
}

public static void prune ( DialogueState state ) { try { Set < String > nodesToKeep = getNodesToKeep ( state ) ; if ( ! nodesToKeep . isEmpty ( ) ) { DialogueState reduced = reduce ( state , nodesToKeep ) ; reinsertActionAndUtilityNodes ( reduced , state ) ; removePrimes ( reduced ) ; removeSpuriousNodes ( reduced ) ; state . reset ( reduced ) ; } else { state . reset ( new BNetwork ( ) ) ; } } catch ( RuntimeException e ) { log . warning ( "cannot prune state: " + e ) ; } }
prunes the state of all the non - necessary nodes . the operation selects a subset of relevant nodes to keep , prunes the irrelevant ones , remove the primes from the variable labels , and delete all empty nodes .
