level: computing edge distances.