Added in_place option to merge_nodes

This is in relation to the discussion that happaned in #1100. After this is merged, I will make the appropriate changes in #1100 


Why random? I think the new id should be the max id + 1.