public static Set<Railway> getSpanningTree(Set<Mission> missions, Set<Railway> railways, Set<Railway> zeroCostRailways) {
		Set<Railway> tree = EnumSet.noneOf(Railway.class);
		if(missions.isEmpty())
			return tree;
		Set<Set<Mission>> missionClusters = clusterMissions(missions);
		for (Set<Mission> cluster: missionClusters) {
			Set<Railway> subtree = EnumSet.noneOf(Railway.class);
			for (Mission m: cluster) {
				List<Railway> rs;
				if(subtree.isEmpty()) {
					rs = shortestPath(m.source, m.destination, railways, zeroCostRailways);
					if (rs != null) subtree.addAll(rs);
				} else {
					rs = shortestPath(m.source, getClosestCity(subtree, m.source), railways, zeroCostRailways);
					if (rs != null) subtree.addAll(rs);
					rs = shortestPath(m.destination, getClosestCity(subtree, m.destination), railways, zeroCostRailways);
					if (rs != null) subtree.addAll(rs);
				}
			}
			tree.addAll(subtree);
		}
		return tree;
	}