src/graph.js
function pruneDisconnectedNodes() {
    const previousState = state;

    const disconnected = findNodesDisconnectedFromEntryNodes(state);

    let updatedState = previousState;
    disconnected.forEach(name => {
      if (updatedState.has(name)) {
        const data = pruneNodeAndUniqueDependencies(updatedState, name);
        updatedState = data.nodes;
      }
    });
    state = updatedState;

    return Diff({
      from: previousState,
      to: state
    });
  }
function pruneDisconnectedNodes() {
    const previousState = state;

    const disconnected = findNodesDisconnectedFromEntryNodes(state);

    let updatedState = previousState;
    disconnected.forEach(name => {
      if (updatedState.has(name)) {
        const data = pruneNodeAndUniqueDependencies(updatedState, name);
        updatedState = data.nodes;
      }
    });
    state = updatedState;

    return Diff({
      from: previousState,
      to: state
    });
  }
function pruneDisconnectedNodes ( ) { const previousState = state ; const disconnected = findNodesDisconnectedFromEntryNodes ( state ) ; let updatedState = previousState ; disconnected . forEach ( name => { if ( updatedState . has ( name ) ) { const data = pruneNodeAndUniqueDependencies ( updatedState , name ) ; updatedState = data . nodes ; } } ) ; state = updatedState ; return Diff ( { from : previousState , to : state } ) ; }
There are edge-cases where particular circular graphs may not have
been pruned completely, so we may still be persisting references to
nodes which are disconnected to the entry nodes.

An easy example of a situation that can cause this is a tournament.
https://en.wikipedia.org/wiki/Tournament_(graph_theory)

To get around this problem, we need to walk the graph from the entry
nodes, note any that are unreachable, and then prune them directly

@returns {Diff}
There are edge - cases where particular circular graphs may not have been pruned completely so we may still be persisting references to nodes which are disconnected to the entry nodes .