update method for update nodes' position