add an optional min distance in select edges