Implemented node partitioning algorithm.