prunecost function

Compute cost of prune each edge