plugins/incub/visualizer/old/src/js/demo_vivagraph.js
function addRelToGraph(node){
    var children = [];
    for (var prop in node){
        if(node.hasOwnProperty(prop)){
            if (typeof node[prop] === 'object') {

                var linkedNodes = node[prop];
                // same for links
                if (colorsByLinkType[prop] == null) {
                    colorsByLinkType[prop] = getRandomColor();
                }
                
                for (var i = 0; i < linkedNodes.length; i++) {
                    //find node by id in the array (using jQuery)
                    const linkedNode = linkedNodes[i];
                    var nodeResult = getNodeFromId(linkedNode);
                    gChildrenNodes.push(nodeResult);
                    children.push(nodeResult);
                    //if the node is displayed, we add a link otherwise we will need to add it later
                    if (contains(gNodesDisplayed, nodeResult)){
                        g.addLink(node._id, nodeResult._id, prop);
                    } else {
                        nodesToBeLinked[nodeResult._id] = delayLinkCreation(node._id, nodeResult._id, prop);
                    }


                }
            }
        }
    }
    gNodesWithChildren[node._id] = children;
}
function addRelToGraph(node){
    var children = [];
    for (var prop in node){
        if(node.hasOwnProperty(prop)){
            if (typeof node[prop] === 'object') {

                var linkedNodes = node[prop];
                // same for links
                if (colorsByLinkType[prop] == null) {
                    colorsByLinkType[prop] = getRandomColor();
                }
                
                for (var i = 0; i < linkedNodes.length; i++) {
                    //find node by id in the array (using jQuery)
                    const linkedNode = linkedNodes[i];
                    var nodeResult = getNodeFromId(linkedNode);
                    gChildrenNodes.push(nodeResult);
                    children.push(nodeResult);
                    //if the node is displayed, we add a link otherwise we will need to add it later
                    if (contains(gNodesDisplayed, nodeResult)){
                        g.addLink(node._id, nodeResult._id, prop);
                    } else {
                        nodesToBeLinked[nodeResult._id] = delayLinkCreation(node._id, nodeResult._id, prop);
                    }


                }
            }
        }
    }
    gNodesWithChildren[node._id] = children;
}
function addRelToGraph ( node ) { var children = [ ] ; for ( var prop in node ) { if ( node . hasOwnProperty ( prop ) ) { if ( typeof node [ prop ] === 'object' ) { var linkedNodes = node [ prop ] ; // same for links if ( colorsByLinkType [ prop ] == null ) { colorsByLinkType [ prop ] = getRandomColor ( ) ; } for ( var i = 0 ; i < linkedNodes . length ; i ++ ) { //find node by id in the array (using jQuery) const linkedNode = linkedNodes [ i ] ; var nodeResult = getNodeFromId ( linkedNode ) ; gChildrenNodes . push ( nodeResult ) ; children . push ( nodeResult ) ; //if the node is displayed, we add a link otherwise we will need to add it later if ( contains ( gNodesDisplayed , nodeResult ) ) { g . addLink ( node . _id , nodeResult . _id , prop ) ; } else { nodesToBeLinked [ nodeResult . _id ] = delayLinkCreation ( node . _id , nodeResult . _id , prop ) ; } } } } } gNodesWithChildren [ node . _id ] = children ; }
Add the necessary nodes and the relationships to the graph
@param node
Add the necessary nodes and the relationships to the graph