public void remove (T element)
    {
        DependencyNode<T> node = _nodes.remove(element);
        _orphans.remove(element);

        // Remove ourselves as a child of our parents.
        for (DependencyNode<T> parent : node.parents) {
            parent.children.remove(node);
        }

        // Remove ourselves as a parent of our children, possibly orphaning them.
        for (DependencyNode<T> child : node.children) {
            child.parents.remove(node);
            if (child.parents.isEmpty()) {
                _orphans.add(child.content);
            }
        }
    }
public void remove ( T element ) { DependencyNode < T > node = _nodes . remove ( element ) ; _orphans . remove ( element ) ; for ( DependencyNode < T > parent : node . parents ) { parent . children . remove ( node ) ; } for ( DependencyNode < T > child : node . children ) { child . parents . remove ( node ) ; if ( child . parents . isEmpty ( ) ) { _orphans . add ( child . content ) ; } } }
Removes an element and its dependencies from the graph.