def compute_path_cost(nxobject, path):
  """
    Compute cost of a path
  """
  cost = 0
  for index_station in range(len(path) - 1):
    cost += nxobject[path[index_station]][path[index_station + 1]]["weight"]
  return cost