Merge the core nodes and assign new node labels