partition function

Partition data according to the MAP tree