private void checkNodeRecursive ( Node node ) { if ( isDangling ( node ) ) { removeNode ( node ) ; for ( Edge edge : node . getUpstream ( ) ) { checkNodeRecursive ( edge . getSourceNode ( ) ) ; } for ( Edge edge : node . getDownstream ( ) ) { checkNodeRecursive ( edge . getTargetNode ( ) ) ; } for ( Node parent : node . getUpperEquivalent ( ) ) { checkNodeRecursive ( parent ) ; } for ( Node child : node . getLowerEquivalent ( ) ) { checkNodeRecursive ( child ) ; } } }
Recursively checks if a node is dangling .