title: Problems positioning nodes with d3.js force-layout. Nodes "re-entering" each data update, example inside
body: <p>I previously asked this question a few days ago, but I do not think anyone besides paxRoman actually figured out what I was asking, as it was hard to describe without an example.</p>
  
  <p>We did however manage to figure out what might be my problem, and I managed to put the code up on bl.ocks.org so you can see an example of what I mean!</p>
  
  <p><strong>Here is the example:</strong> <a href="http://bl.ocks.org/3020018" rel="nofollow noreferrer">http://bl.ocks.org/3020018</a></p>
  
  <p>Each time the data is refreshed (in this example, just read from a json file), all the nodes are re-created and re-added to the drawing. </p>
  
  <p><strong>What I want to happen</strong></p>
  
  <p>I want the nodes to update without moving at all.</p>
  
  <p>If a new node exists in the new array, it should just appear like they all do now, if something exists in the previous array but not in the new, it should simply disappear.</p>
  
  <p>As you see in the example, that is not what is happening and I have not been able to figure out why for the past week.</p>
  
  <p><strong>So my question is:</strong></p>
  
  <p>What am I actually doing wrong? Is it my lack of links? What is the problem? The two of us spent over an hour looking at this yesterday and could not make sense of it, I have spent a good week on it now without much progress :/</p>
  
  <p>My old question/post is <a href="https://stackoverflow.com/questions/11209847/problems-adding-and-removing-nodes-in-a-force-layout-using-d3-js">still up</a>, but it's badly formulated and I had no example to show.</p>
  
  <p>Thanks for helping me :)</p>