Scheduling flows and coflows in networks