title: Store hierarchies in a way that is resistant to corruption
body: <p>I was thinking today about the best way to store a hierarchical set of nodes, e.g.</p>
  
  <p><a href="https://i.stack.imgur.com/ys6bQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ys6bQ.jpg" alt="alt text"></a><br>
  <sub>(source: <a href="http://www2002.org/CDROM/alternate/738/p738-brailsford-fig5.jpg" rel="nofollow noreferrer">www2002.org</a>)</sub>  </p>
  
  <p>The most obvious way to represent this (to me at least) would be for each node to have nextSibling and childNode pointers, either of which could be null.</p>
  
  <p>This has the following properties:</p>
  
  <ol>
  <li>Requires a small number of changes if you want to add in or remove a node somewhere</li>
  <li>Is highly susceptible to corruption. If one node was lost, you could potentially lose a large amount of other nodes that were dependent on being found through that node's pointers.</li>
  </ol>
  
  <p>Another method you might use is to come up with a system of coordinates, e.g. 1.1, 1.2, 1.2.1, 1.2.2. 1.2.3 would be the 3rd node at the 3rd level, with the 2nd node at the prior level as its parent. Unanticipated loss of a node would not affect the ability to resolve any other nodes. However, adding in a node somewhere has the potential effect of changing the coordinates for a large number of other nodes.</p>
  
  <p>What are ways that you could store a hierarchy of nodes that requires few changes to add or delete a node and is resilient to corruption of a few nodes? (not implementation-specific)</p>