This code is equal to that one of createGraph_tree_v2.cpp, but I changed vectors with pointer vectors in order to swap pointers instead of vector themselves. However this change leave the performance at the same level.