Multiple partners in a family tree in d3.js?

I have a family tree from Cyril's amazing answer but I'm trying to figure out how to adjust it to support multiple partners. In this case, I added a "Mistress" node and am trying to denote that "Mistress" and "John" had a child named "Hidden Son".

The current data structure works like this:

In that, the root object stores everything. It has a children array which contains the up most "generation" with no parents. It also contains an object that contains the children of these sibling objects/nodes. In the example above, this is root.children[2].

I'm thinking I would have to refactor the data structure's children and inject information about whos parents the child is from. Just having trouble conceptualizing this, as well as the line

The end would would be something like this, except mistress would be on the left side:


@medder thanks for the appreciation!

To do that I have added a hidden node between john and mistress.

And added a child to that hidden node, so it appears as if john and mistress have a child "Hidden Son" So the JSON looks like

    name: "Mistress",
    id: 9000,
    no_parent: true
  }, {
    name: "",//this is the new node between Mistress and John
    id: 100,
    no_parent: true,//it has no parents
    hidden: true,
    children: [{
      // so this hidden node will have a child 
      // which will make it appear as if john and mistress has a child.
      name: "Hidden Son",
      id: 9001
  }, {
    name: "John",
    id: 16,
    no_parent: true

Working code here

Hope this helps!

Need Your Help

Simple Injector in its own project

c# model-view-controller simple-injector

I'm trying to use Simple Injector in a project which has the following architecture :

Best field type for storing Facebook Access Token

mysql facebook-graph-api database-design facebook-access-token

Regarding to this answer to a question on SO a Facebook representative is making me a bit confused. He actually says, that there should be no upper limit on the length on the field storing a Facebook