now working.
n_sweep vector to keep track of the nodes that are checked and removed them after every for loop.