main.py
def path2root(g, goal_amount):
    """ Returns the shortest path to the goal_amount as a list. """
    min_dis = len(g.getVertices())
    for i in g.getVertices():
        z = i[0]
        y = i[1]
        if (z == goal_amount or y == goal_amount) and g.getVertex(
                i).getDistance() < min_dis:
            x = g.getVertex(i)
            min_dis = g.getVertex(i).getDistance()
    path = []
    while x.getPred():
        path.insert(0, x.getId())
        x = x.getPred()
    path.insert(0, x.getId())
    return path
 Returns the shortest path to the goal_amount as a list. 
Returns the shortest path to the goal_amount as a list.
Returns the shortest path to the goal_amount as a list .
def path2root(g, goal_amount):
    min_dis = len(g.getVertices())
    for i in g.getVertices():
        z = i[0]
        y = i[1]
        if (z == goal_amount or y == goal_amount) and g.getVertex(
                i).getDistance() < min_dis:
            x = g.getVertex(i)
            min_dis = g.getVertex(i).getDistance()
    path = []
    while x.getPred():
        path.insert(0, x.getId())
        x = x.getPred()
    path.insert(0, x.getId())
    return path
def path2root ( g , goal_amount ) : min_dis = len ( g . getVertices ( ) ) for i in g . getVertices ( ) : z = i [ 0 ] y = i [ 1 ] if ( z == goal_amount or y == goal_amount ) and g . getVertex ( i ) . getDistance ( ) < min_dis : x = g . getVertex ( i ) min_dis = g . getVertex ( i ) . getDistance ( ) path = [ ] while x . getPred ( ) : path . insert ( 0 , x . getId ( ) ) x = x . getPred ( ) path . insert ( 0 , x . getId ( ) ) return path
Returns the shortest path to the goal_amount as a list.
Returns the shortest path to the goal_amount as a list .
""" Returns the shortest path to the goal_amount as a list. """
g
goal_amount