add test for dist on same segment
add type alias FlowNetwork