in src/models/RenderedGraph.js [82:125]
getAlignmentConstraints() {
const alignmentConstraints = [];
if (this.nodes.length > 0) {
const visitedNodes = this.nodes.map(() => false);
let queue = [this.nodes[0]];
while (queue.length > 0) {
const node = queue.shift();
const nodeIndex = node.id;
if (visitedNodes[nodeIndex]) continue;
visitedNodes[nodeIndex] = true;
const constraints = node.computeRightConstraints();
if (constraints) {
alignmentConstraints.push(constraints);
}
const rNodes = node.getRightNodes();
if (rNodes.length > 0) {
queue = queue.concat(rNodes);
}
}
for (let i = 0; i < this.nodes.length; i++) {
visitedNodes[i] = false;
}
queue = [this.nodes[0]];
while (queue.length > 0) {
const node = queue.shift();
const nodeIndex = node.id;
if (visitedNodes[nodeIndex]) continue;
visitedNodes[nodeIndex] = true;
const constraints = node.computeLeftConstraints();
if (constraints) {
alignmentConstraints.push(constraints);
}
const lNodes = node.getLeftNodes();
if (lNodes.length > 0) {
queue = queue.concat(lNodes);
}
}
}
return alignmentConstraints;
}