Some conditional code optimized using else if (no more than one edge can be selected at same time)