Move network_simplex out of mincost.py

This moves `network_simplex` out of `mincost.py` so that something similar to #1102 can be done for mincost flow problems in the future.