partition graph