def _cost_so_far(node):
    """ also referred to as `g' in the class notation """
    prev_cost = 0 if node.is_root() else node.parent.incremental_cost
    node.incremental_cost = prev_cost + node.cost
    return node.incremental_cost
