src/components/graph/graph.helper.js
function _initializeNodes(graphNodes) {
    let nodes = {};
    const n = graphNodes.length;

    for (let i = 0; i < n; i++) {
        const node = graphNodes[i];

        node.highlighted = false;

        if (!node.hasOwnProperty("x")) {
            node.x = 0;
        }
        if (!node.hasOwnProperty("y")) {
            node.y = 0;
        }

        nodes[node.id.toString()] = node;
    }

    return nodes;
}
function _initializeNodes(graphNodes) {
    let nodes = {};
    const n = graphNodes.length;

    for (let i = 0; i < n; i++) {
        const node = graphNodes[i];

        node.highlighted = false;

        if (!node.hasOwnProperty("x")) {
            node.x = 0;
        }
        if (!node.hasOwnProperty("y")) {
            node.y = 0;
        }

        nodes[node.id.toString()] = node;
    }

    return nodes;
}
function _initializeNodes ( graphNodes ) { let nodes = { } ; const n = graphNodes . length ; for ( let i = 0 ; i < n ; i ++ ) { const node = graphNodes [ i ] ; node . highlighted = false ; if ( ! node . hasOwnProperty ( "x" ) ) { node . x = 0 ; } if ( ! node . hasOwnProperty ( "y" ) ) { node . y = 0 ; } nodes [ node . id . toString ( ) ] = node ; } return nodes ; }
Method that initialize graph nodes provided by rd3g consumer and adds additional default mandatory properties
that are optional for the user. Also it generates an index mapping, this maps nodes ids the their index in the array
of nodes. This is needed because d3 callbacks such as node click and link click return the index of the node.
@param  {Array.<Node>} graphNodes - the array of nodes provided by the rd3g consumer.
@returns {Object.<string, Object>} returns the nodes ready to be used within rd3g with additional properties such as x, y
and highlighted values.
@memberof Graph/helper
Method that initialize graph nodes provided by rd3g consumer and adds additional default mandatory properties that are optional for the user . Also it generates an index mapping this maps nodes ids the their index in the array of nodes . This is needed because d3 callbacks such as node click and link click return the index of the node .