No provision to add a single parent - child relation.
So far i have been able to add this, but when i add such relation where mother and father are same for child(no biological mother) are same i am not able to get a proper hierarchy, the node slides left to the father on same level.
function setupParents(diagram) {
var model = diagram.model;
var nodeDataArray = model.nodeDataArray;
for (var i = 0; i < nodeDataArray.length; i++) {
var data = nodeDataArray[i];
var key = data.key;
var mother = data.m;
var father = data.f;
if (mother !== undefined && father !== undefined) {
var link = findMarriage(diagram, mother, father);
if (link === null && mother != father) {
// or warn no known mother or no known father or no known marriage between them
if (window.console) window.console.log("unknown marriage: " + mother + " & " + father);
continue;
}
if (mother == father)
{
var cdata = { from: father, to: key };
}
else
{
var mdata = link.data;
var mlabkey = mdata.labelKeys[0];
var cdata = { from: mlabkey, to: key };
}
myDiagram.model.addLinkData(cdata);
}
}
}
How can i get vertex, when both parent aren’t present
if (!link.isLabeledLink) {
var parent = net.findVertex(link.fromNode); // should be a label node-- how to modify this line as this will be empty
var child = net.findVertex(link.toNode);
if (child !== null) { // an unmarried child
net.linkVertexes(parent, child, link);
}