Subway construction problem (minimum spanning tree)