Fixed exception throwing in addEdge removeEdge and DFS