Python3 program to check if there is exist a path between two vertices of an undirected graph .
from collections import deque NEW_LINE def addEdge ( v , w ) : NEW_LINE INDENT global adj NEW_LINE adj [ v ] . append ( w ) NEW_LINE adj [ w ] . append ( v ) NEW_LINE DEDENT