def reconstruct_path(came_from, cost_so_far, start, goal):
    """Create a least cost path from :func:`~dijkstra_search` output

    Args:
        came_from (dict): Result of :func:`~dijkstra_search` containing traversal paths
        cost_so_far (dict): Result of :func:`~dijkstra_search` containing traversal costs
        start (str): H3 index of starting point
        goal (str): H3 index of search goal

    Returns:
        dict: Dictionary of hexagons with cost so far as value"""

    current = goal
    path = {}
    while current != start:
        cost = cost_so_far.get(current, 0)
        path[current] = cost
        current = came_from[current]
    path[start] = 0
    return path