def reconstruct_path(current, came_from):
    """
    Reconstruct path using last node and dictionary that maps each node on path
    to its predecessor.

    Args:
        current (int): Last node in discovered path
        came_from (dict): Dictionary mapping nodes on path to their predecessors

    Retuns:
        (tuple): Path in the form of a list and the same path encoded in an edge list
    """

    # Initialize path and add last found node.
    path = [current]

    # Reconstruct.
    while current in came_from:
        current = came_from[current]
        path.insert(0, current)
    
    # Construct edgelist.
    edgelist = [(path[idx], path[idx+1]) for idx in range(len(path)-1)]

    # Return path and edge list.
    return path, edgelist