spanning tree path cost calculation