Flow-based distributionally robust optimization