Answers.Body: <p>I can't think of an easy and clean way to visualize this kind of structure in a default list. So if you want to be able to display the structure from your diagram dynamically you'll have much work to calculate the positions correctly in a clear way.</p>
  
  <p>So I would suggest you to use easy Craft methods. You could create an entries field to relate your children with all the upper level parents, in your case you would have </p>
  
  <pre><code>Parent 1 - no relation
  Parent 2 - no relation
      Child - related to [Parent 1, Parent 2]
          Grand Child - related To [ Child ]
      Sub Parent 1 - related to [Parent 1, Parent 2]
      Sub Parent 2 - related to [Parent 1, Parent 2]
           Grand Child 1 - related To [Sub Parent 1, Sub Parent 2]
           Grand Child 2 - related To [Sub Parent 1, Sub Parent 2]
           Grand Child 3 - related To [Sub Parent 1, Sub Parent 2]
  </code></pre>
  
  <p>So you can get each parent of an entry with <code>entry.fieldHandle.find()</code>
  and you can iterate through the tree. But this will only work well when don't mix trees.. So when you have a Parent 3 and 4 with another tree like in the diagram and one of those entries can be the parent of one of the grand children in the first tree you could have trouble (performance wise) to iterate to the beginning. You can collect <code>all</code> parents with no problem but if you have 5+ levels you'll need many queries and it could take a lot of time in Craft2 with default <code>ElementCriteriaModels</code>. But that's always the case in those NxN tree connections</p>
  
  <p>I don't see any issues as long as your trees are separated from each other and as long as you use custom code to fetch the entries.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-02T10:21:23.853Z
Answers.Text: "that's always the case in those NxN tree connections" -- this is what I am realising. Thanks Robin.
Answers.UserDisplayName: Adam George
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-02T09:15:01.450Z
Answers.LastActivityDate: 2018-03-02T14:34:41.970Z
Answers.LastEditDate: 2018-03-02T14:34:41.970Z
Answers.UserDisplayName: Robin Schambach
Answers.Body: <p>Create a regular channel where the entries have a relationship to the parent and not the child.</p>
  
  <p>That means that each child can have any number of parents and each parent can be related to as many children as needed.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-02T11:12:35.913Z
Answers.LastActivityDate: 2018-03-02T11:12:35.913Z
Answers.UserDisplayName: foamcow
Body: <p>I'm struggling to think of a way to create a family tree hierarchy in Craft. </p>
  
  <p>I've tried using categories and structures, but run into the problem of needing child nodes to have two parent nodes.</p>
  
  <p>I.e.</p>
  
  <p><a href="https://i.sstatic.net/sijdH.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/sijdH.png" alt="enter image description here"></a></p>
  
  <p>Generally, what's the best way of achieving this?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-03-02T05:51:46.077Z
Comments.Text: One child can always have only one parent in a tree hierarchy. Why don't you use a structured section and relate your two "parents" with the real parent for that. Isn't that enough for you? Or you can just use a single and relate your parents with the entry. Its just not so obvious in the list
Comments.UserDisplayName: Robin Schambach
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-03-02T09:01:37.563Z
Comments.Text: Hi Robin, thanks for your comment. My diagram wasn't clear in explaining what I'm after. I've updated it.
Comments.UserDisplayName: Adam George
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-03-02T09:14:02.830Z
Comments.Text: How about creating a structure per generation, and then using an entry-picker-field for defining the relations? Ie. Parent1 and Parent2 are both entries in the "Parents"-section, Child is a entry in the "Children"-section and through a field on the Child-entry you pick two parents and so forth and so on?
Comments.UserDisplayName: Fuglsetrampen
Tags: <structure><children><parents>
Title: How can I create a family tree hierarchy in Craft?
ThreadText: # How can I create a family tree hierarchy in Craft?
  
  (Asked by: username_0 on 2018-03-02)
  
  I'm struggling to think of a way to create a family tree hierarchy in Craft.
  
  I've tried using categories and structures, but run into the problem of needing child nodes to have two parent nodes.
  
  I.e.
  
  [![enter image description here](https://i.sstatic.net/sijdH.png)](https://i.sstatic.net/sijdH.png)
  
  Generally, what's the best way of achieving this?
  
  **Tags:** structure, children, parents
  
  > **Comments:**
  > **username_1**: One child can always have only one parent in a tree hierarchy. Why don't you use a structured section and relate your two "parents" with the real parent for that. Isn't that enough for you? Or you can just use a single and relate your parents with the entry. Its just not so obvious in the list  
  > **username_0**: Hi username_1, thanks for your comment. My diagram wasn't clear in explaining what I'm after. I've updated it.  
  > **username_2**: How about creating a structure per generation, and then using an entry-picker-field for defining the relations? Ie. Parent1 and Parent2 are both entries in the "Parents"-section, Child is a entry in the "Children"-section and through a field on the Child-entry you pick two parents and so forth and so on?  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-03-02. Score: 3
  
  I can't think of an easy and clean way to visualize this kind of structure in a default list. So if you want to be able to display the structure from your diagram dynamically you'll have much work to calculate the positions correctly in a clear way.
  
  So I would suggest you to use easy Craft methods. You could create an entries field to relate your children with all the upper level parents, in your case you would have
  
  ```
  Parent 1 - no relation
  Parent 2 - no relation
      Child - related to [Parent 1, Parent 2]
          Grand Child - related To [ Child ]
      Sub Parent 1 - related to [Parent 1, Parent 2]
      Sub Parent 2 - related to [Parent 1, Parent 2]
           Grand Child 1 - related To [Sub Parent 1, Sub Parent 2]
           Grand Child 2 - related To [Sub Parent 1, Sub Parent 2]
           Grand Child 3 - related To [Sub Parent 1, Sub Parent 2]
  
  ```
  
  So you can get each parent of an entry with `entry.fieldHandle.find()`
  and you can iterate through the tree. But this will only work well when don't mix trees.. So when you have a Parent 3 and 4 with another tree like in the diagram and one of those entries can be the parent of one of the grand children in the first tree you could have trouble (performance wise) to iterate to the beginning. You can collect `all` parents with no problem but if you have 5+ levels you'll need many queries and it could take a lot of time in Craft2 with default `ElementCriteriaModels`. But that's always the case in those NxN tree connections
  
  I don't see any issues as long as your trees are separated from each other and as long as you use custom code to fetch the entries.
  
  > **Comments:**
  > **username_0**: "that's always the case in those NxN tree connections" -- this is what I am realising. Thanks username_1.  
  
  ---
  
  ### Answer by username_3 on 2018-03-02. Score: 1
  
  Create a regular channel where the entries have a relationship to the parent and not the child.
  
  That means that each child can have any number of parents and each parent can be related to as many children as needed.
  
  
  ---
  
  