Example #1
0
def p082(matrix=None):
    if not matrix:
        matrix = p081.readmatrix(filename)
    g = buildgraph(matrix)
    return g.shortestpath('source', 'sink')
Example #2
0
def p083(matrix=None):
    if not matrix:
        matrix = p081.readmatrix(filename)
    g = buildgraph(matrix)
    return g.shortestpath((0,0), (len(matrix)-1,len(matrix[0])-1))
Example #3
0
def p082(matrix=None):
    if not matrix:
        matrix = p081.readmatrix(filename)
    g = buildgraph(matrix)
    return g.shortestpath('source', 'sink')
Example #4
0
def p083(matrix=None):
    if not matrix:
        matrix = p081.readmatrix(filename)
    g = buildgraph(matrix)
    return g.shortestpath((0, 0), (len(matrix) - 1, len(matrix[0]) - 1))