Function to Adjacency List Representation of a Graph
def makeGraph ( vp : list , m : int ) : NEW_LINE INDENT global graph NEW_LINE for i in range ( m ) : NEW_LINE INDENT a = vp [ i ] [ 0 ] [ 0 ] - 1 NEW_LINE b = vp [ i ] [ 0 ] [ 1 ] - 1 NEW_LINE cost = vp [ i ] [ 1 ] [ 0 ] NEW_LINE color = vp [ i ] [ 1 ] [ 1 ] NEW_LINE graph [ a ] [ b ] [ color == ' W ' ] = cost NEW_LINE graph [ b ] [ a ] [ color == ' W ' ] = cost NEW_LINE DEDENT DEDENT