title: D3.js Force Layout - showing only part of a graph
body: <p>Good morning,</p>
  
  <p>just starting with the awesome d3js library ...</p>
  
  <p>I want to show only a portion of a graph with the force directed layout. The idea is to have one node declared as the "center" and show all nodes within a distance of two (for example) from this center node, the neighbors of the center node and the neighbors of the neighbors.  If the user clicks on one of the displayed nodes it becomes the "new" center node and a different "subgraph" is displayed. I wonder if there is an example around implementing this kind of subgraph layout and if some kind of a "node-distance" algorithm is already implemented in d3js. </p>
  
  <p>Thanks a lot</p>
  
  <p>martin</p>
  
  <p>UPDATE:
  Just found the example <a href="http://bl.ocks.org/mbostock/1095795" rel="nofollow">Modifying a Force Layout</a> which illuminates how to add and remove nodes and edges from a force directed layout. </p>