implement correct choosing of edges