'Combinatorial Optimization: Algorithms and Complexity,
Papadimitriou Steiglitz at page 140 has an example, 7.1, but that
admits multiple solutions, so I alter it a bit. From ticket #430
by mfrasca.'

def test_digraph3(self):

    G = nx.DiGraph()
    G.add_edge('s', 'a')
    G['s']['a'].update({0: 2, 1: 4})
    G.add_edge('s', 'b')
    G['s']['b'].update({0: 2, 1: 1})
    G.add_edge('a', 'b')
    G['a']['b'].update({0: 5, 1: 2})
    G.add_edge('a', 't')
    G['a']['t'].update({0: 1, 1: 5})
    G.add_edge('b', 'a')
    G['b']['a'].update({0: 1, 1: 3})
    G.add_edge('b', 't')
    G['b']['t'].update({0: 3, 1: 2})
    'PS.ex.7.1:    testing    main    function'
    sol = nx.max_flow_min_cost(G, 's', 't', capacity=0, weight=1)
    flow = sum((v for v in sol['s'].values()))
    assert_equal(4, flow)
    assert_equal(23, nx.cost_of_flow(G, sol, weight=1))
    assert_equal(sol['s'], {'a': 2, 'b': 2})
    assert_equal(sol['a'], {'b': 1, 't': 1})
    assert_equal(sol['b'], {'a': 0, 't': 3})
    assert_equal(sol['t'], {})
    G.add_edge('t', 's')
    G['t']['s'].update({1: (-100)})
    (flowCost, sol) = nx.capacity_scaling(G, capacity=0, weight=1)
    G.remove_edge('t', 's')
    flow = sum((v for v in sol['s'].values()))
    assert_equal(4, flow)
    assert_equal(sol['t']['s'], 4)
    assert_equal(flowCost, (-377))
    del sol['t']['s']
    assert_equal(sol['s'], {'a': 2, 'b': 2})
    assert_equal(sol['a'], {'b': 1, 't': 1})
    assert_equal(sol['b'], {'a': 0, 't': 3})
    assert_equal(sol['t'], {})
    assert_equal(nx.cost_of_flow(G, sol, weight=1), 23)
