Shortening code with avoidable logic check
Edges calculated by sorting cities' distances