Implemented how to choose the next edge to expand.