Simple Binary Tree

123456789

Tasks

add nodes 1-9. node 1 is the parent of both nodes 2 and 7. node 2 is the parent of both nodes 3 and 6. node 3 is the parent of both nodes 4 and 5. node 7 is the parent of both nodes 8 and 9. add a constraint that nodes 6 and 8 are at the same y-coordinate. set each node label to its name.

JSON Representation

{
"directed": false,
"hasParents": true,
"nodes": {
  "1": {
    "label": "1"
  },
  "2": {
    "label": "2"
  },
  "3": {
    "label": "3"
  },
  "4": {
    "label": "4"
  },
  "5": {
    "label": "5"
  },
  "6": {
    "label": "6"
  },
  "7": {
    "label": "7"
  },
  "8": {
    "label": "8"
  },
  "9": {
    "label": "9"
  }
},
"edges": {
  "12": {
    "source": "1",
    "target": "2"
  },
  "17": {
    "source": "1",
    "target": "7"
  },
  "23": {
    "source": "2",
    "target": "3"
  },
  "26": {
    "source": "2",
    "target": "6"
  },
  "34": {
    "source": "3",
    "target": "4"
  },
  "35": {
    "source": "3",
    "target": "5"
  },
  "78": {
    "source": "7",
    "target": "8"
  },
  "79": {
    "source": "7",
    "target": "9"
  }
},
"constraints": [
  {
    "meaning": "Nodes 6 and 8 are at the same y-coordinate",
    "constraints": [
      "'6'.y = '8'.y"
    ]
  }
]
}