just suggestion. you can do `new_nodes.reserve(nNodes)` to improve speed. it is not necessary that final size of a vector becomes a size used in reserve().