Bug fixes for looping in graph.
Bug fix in checkEdge.