optimizing Mtree graphs