private void addDummySourceNode(final Graph<V> residualGraph) {
        if (!residualGraph.isResidualGraph) {
            throw new IllegalStateException("Graph should be residual graph to add dummy source node");
        }

        // Add a dummy null node connected to every existing node with residual flow 1 and cost 0
        // Then try to find negative cylce starting using dummy node as source node. Since there's no
        // path from original nodes to null node, negative cycles must be within original nodes.
        final TreeMap<V, Edge> destMap = new TreeMap<>();
        for (final V node : residualGraph.nodes) {
            final Edge edge = new Edge(node, 1, 0, 1, 0);
            destMap.put(node, edge);
        }
        residualGraph.adjList.put(null, destMap);
        residualGraph.nodes.add(null);
    }
Get residual graph of this graph.
Residual graph definition:
If there is an edge in original graph from u to v with capacity c, cost w and flow f,
then in the new graph there are two edges e1 and e2. e1 is from u to v with capacity c - f,
cost w and flow f. e2 is from v to u with capacity f, cost -w and flow 0.

@return Residual graph
streams/src/main/java/org/apache/kafka/streams/processor/internals/assignment/Graph.java