Added method for deducing the cost of an edge after traversing it