src/components/graph/graph.helper.js
function _tagOrphanNodes(nodes, linksMatrix) {
    return Object.keys(nodes).reduce((acc, nodeId) => {
        const { inDegree, outDegree } = computeNodeDegree(nodeId, linksMatrix);
        const node = nodes[nodeId];
        const taggedNode = inDegree === 0 && outDegree === 0 ? { ...node, _orphan: true } : node;

        acc[nodeId] = taggedNode;

        return acc;
    }, {});
}
function _tagOrphanNodes(nodes, linksMatrix) {
    return Object.keys(nodes).reduce((acc, nodeId) => {
        const { inDegree, outDegree } = computeNodeDegree(nodeId, linksMatrix);
        const node = nodes[nodeId];
        const taggedNode = inDegree === 0 && outDegree === 0 ? { ...node, _orphan: true } : node;

        acc[nodeId] = taggedNode;

        return acc;
    }, {});
}
function _tagOrphanNodes ( nodes , linksMatrix ) { return Object . keys ( nodes ) . reduce ( ( acc , nodeId ) => { const { inDegree , outDegree } = computeNodeDegree ( nodeId , linksMatrix ) ; const node = nodes [ nodeId ] ; const taggedNode = inDegree === 0 && outDegree === 0 ? { ... node , _orphan : true } : node ; acc [ nodeId ] = taggedNode ; return acc ; } , { } ) ; }
Tags orphan nodes with a `_orphan` flag.
@param {Object.<string, Object>} nodes - nodes mapped by their id.
@param {Object.<string, Object>} linksMatrix - an object containing a matrix of connections of the graph, for each nodeId,
there is an object that maps adjacent nodes ids (string) and their values (number).
@returns {Object.<string, Object>} same input nodes structure with tagged orphans nodes where applicable.
@memberof Graph/helper
Tags orphan nodes with a _orphan flag .