Python3 program to reach a prime number from another by changing single digits and using only prime numbers .
import queue NEW_LINE class Graph : NEW_LINE INDENT def __init__ ( self , V ) : NEW_LINE INDENT self . V = V ; NEW_LINE self . l = [ [ ] for i in range ( V ) ] NEW_LINE DEDENT def addedge ( self , V1 , V2 ) : NEW_LINE INDENT self . l [ V1 ] . append ( V2 ) ; NEW_LINE self . l [ V2 ] . append ( V1 ) ; NEW_LINE DEDENT DEDENT