A parametric algorithm for convex cost network flow and related problems