Reimplement the network simplex method for min-cost flows

Addresses #401, #598, #630, #1106.

Performance comparison with `capacity_scaling`:

```
netgen-1 (n=400, e=1500)
network_simplex     : 0.061
capacity_scaling    : 0.091

netgen-2 (n=400, e=1416)
network_simplex     : 0.093
capacity_scaling    : 0.692

netgen-3 (n=400, e=2676)
network_simplex     : 0.108
capacity_scaling    : 1.089

netgen-4 (n=1000, e=2900)
network_simplex     : 0.196
capacity_scaling    : 0.952

netgen-5 (n=1500, e=4342)
network_simplex     : 0.319
capacity_scaling    : 2.550

netgen-6 (n=8000, e=15000)
network_simplex     : 4.495
capacity_scaling    : 118.151

netgen-7 (n=3000, e=35000)
network_simplex     : 3.603
capacity_scaling    : 97.404

netgen-8 (n=3000, e=23000)
network_simplex     : 2.374
capacity_scaling    : 43.525
```

As noted in #1106, the existing implementation is much too slow for these cases.