function a_star(graph, start, goal, heuristic):

   open_set = min_heap([(heuristic(start, goal), start)])
   cost_so_far = {start: 0}
   while open_set:
      _, current = open_set.pop_min()
      if current == goal:
        return cost_so_far[current]

      for neighbor, weight in graph[current]:
        new_cost = cost_so_far[current] + weight
        if neighbor not in cost_so_far or new_cost < cost_so_far[neighbor]:
           cost_so_far[neighbor] = new_cost
           priority = new_cost + heuristic(neighbor, goal) # cost + estimate

           open_set.push((priority, neighbor))
   report an unsupported case # no path found
