plugins/incub/visualizer/old/src/js/demo_vivagraph.js
function searchNodeInTree(treeRoot, nodeId){
    if (treeRoot.childNodes){
        for (var i = 0; i < treeRoot.childNodes.length; ++i){
            var currentNode = treeRoot.childNodes[i];
            if (currentNode._id == nodeId){
                return currentNode;
            } else {
                var found = searchNodeInTree(currentNode, nodeId);
                if (found) {
                    return found;
                }
            }
        }
    }
    return false;
}
function searchNodeInTree(treeRoot, nodeId){
    if (treeRoot.childNodes){
        for (var i = 0; i < treeRoot.childNodes.length; ++i){
            var currentNode = treeRoot.childNodes[i];
            if (currentNode._id == nodeId){
                return currentNode;
            } else {
                var found = searchNodeInTree(currentNode, nodeId);
                if (found) {
                    return found;
                }
            }
        }
    }
    return false;
}
function searchNodeInTree ( treeRoot , nodeId ) { if ( treeRoot . childNodes ) { for ( var i = 0 ; i < treeRoot . childNodes . length ; ++ i ) { var currentNode = treeRoot . childNodes [ i ] ; if ( currentNode . _id == nodeId ) { return currentNode ; } else { var found = searchNodeInTree ( currentNode , nodeId ) ; if ( found ) { return found ; } } } } return false ; }
Depth First Search algorithm that returns the node and its children with the id "nodeId"
@param treeRoot
@param nodeId
@returns {*}
Depth First Search algorithm that returns the node and its children with the id nodeId