def __build_path(start_node, goal_node, nodes):
    """Builds a path from start to goal node based on graph of nodes"""
    # Build path array based on path mapping
    current_node = goal_node
    path = list()

    while current_node != start_node:
        # If node is not in mapping, no path exists
        if current_node in nodes:
            path.append(current_node)
            current_node = nodes[current_node]
        else:
            # Set path to empty if no path exists and exit
            path = list()
            break

    path.reverse()

    return path