title: Implementing a graph with multiple parents and children
body: <p>I need to implement a tree-like data structure where each node has multiple parents and children and therefore multiple roots. </p>
  
  <p>New nodes will only be added to the tree with as either a root with no parents or a child of one or more parents. </p>
  
  <p>Nodes will not start with children, but any existing node can gain another child node with any number of other parent nodes</p>
  
  <p><a href="https://i.stack.imgur.com/rWLL9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rWLL9.png" alt="tree example"></a></p>