generalized mst