Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const fxFn = getFFn(['lr', 'rl'].indexOf(state.dagMode) !== -1, state.dagMode === 'rl');
const fyFn = getFFn(['td', 'bu'].indexOf(state.dagMode) !== -1, state.dagMode === 'td');
const fzFn = getFFn(['zin', 'zout'].indexOf(state.dagMode) !== -1, state.dagMode === 'zout');
state.graphData.nodes.forEach(node => {
node.fx = fxFn(node);
node.fy = fyFn(node);
node.fz = fzFn(node);
});
}
// Use radial force for radial dags
state.d3ForceLayout.force('dagRadial',
['radialin', 'radialout'].indexOf(state.dagMode) !== -1
? d3ForceRadial(node => {
const nodeDepth = nodeDepths[node[state.nodeId]];
return (state.dagMode === 'radialin' ? maxDepth - nodeDepth : nodeDepth) * dagLevelDistance;
})
.strength(1)
: null
);
} else {
// ngraph
const graph = ngraph.graph();
state.graphData.nodes.forEach(node => { graph.addNode(node[state.nodeId]); });
state.graphData.links.forEach(link => { graph.addLink(link.source, link.target); });
layout = ngraph['forcelayout' + (state.numDimensions === 2 ? '' : '3d')](graph);
layout.graph = graph; // Attach graph reference to layout
}
for (let i = 0; i < state.warmupTicks; i++) { layout[isD3Sim ? 'tick' : 'step'](); } // Initial ticks before starting to render
? undefined
: (nodeDepths[node[state.nodeId]] - maxDepth / 2) * dagLevelDistance * (invert ? -1 : 1);
const fxFn = getFFn(['lr', 'rl'].indexOf(state.dagMode) !== -1, state.dagMode === 'rl');
const fyFn = getFFn(['td', 'bu'].indexOf(state.dagMode) !== -1, state.dagMode === 'bu');
state.graphData.nodes.forEach(node => {
node.fx = fxFn(node);
node.fy = fyFn(node);
});
}
// Use radial force for radial dags
state.forceLayout.force('dagRadial',
['radialin', 'radialout'].indexOf(state.dagMode) !== -1
? d3ForceRadial(node => {
const nodeDepth = nodeDepths[node[state.nodeId]];
return (state.dagMode === 'radialin' ? maxDepth - nodeDepth : nodeDepth) * dagLevelDistance;
})
.strength(1)
: null
);
for (let i=0; i