Single Parent Scenario in genogram sample

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);
}

If I am understanding your question correctly, the design of Genogram sample and the GenogramLayout requires that every person have either zero or two parents. When there are two parents, there is a “marriage” link between the two parents and that link has a label node which is the Link.fromNode of each link that goes to each child node.

So it is not possible to have a person node that has exactly one parent node. Both the mother and the father nodes must be present and linked with each other.

Now that doesn’t mean both parent nodes need to be shown – you can certainly make one spouse node be unseen by making its opacity zero. This is actually done in commented-out code in the samples/genogram.html sample, at the end of the setupDiagram function.