Fix some bugs in GraphUtil.

- GraphUtil::snapVertex()
consider a loop edge
- GraphUtil::findNearestEdge()
use distance(), and skip the edges whose length is 0.
- Util::pointSegmentDistanceXY()
consider the case that the denominator is 0.