mincostflow tree