js/motifFinder/broadcastGatherFinder.js
// Creates a motif out of the groups
Creates a motif out of the groups
Creates a motif out of the groups
function toMotif(groups) {
        var motif = new Motif();
        for (var j = 0; j < groups.length; j++) {
            var curr = groups[j][0];
            var groupEnd = groups[j][1].getNext();
            var prev = null;
            var seenHosts = {};
            while (curr != groupEnd) {
                motif.addNode(curr);
                if (prev != null) {
                    motif.addEdge(curr, prev);
                }
                var links = context.broadcast ? curr.getChildren() : curr.getParents();
                for (var i = 0; i < links.length; i++) {
                    motif.addEdge(curr, links[i]);
                    motif.addNode(links[i]);
                    var linkHost = links[i].getHost();
                    if (!seenHosts[linkHost]) {
                        seenHosts[linkHost] = true;
                    }
                }
                prev = curr;
                curr = curr.getNext();
            }
        }
        return motif;
    }
function toMotif ( groups ) { var motif = new Motif ( ) ; for ( var j = 0 ; j < groups . length ; j ++ ) { var curr = groups [ j ] [ 0 ] ; var groupEnd = groups [ j ] [ 1 ] . getNext ( ) ; var prev = null ; var seenHosts = { } ; while ( curr != groupEnd ) { motif . addNode ( curr ) ; if ( prev != null ) { motif . addEdge ( curr , prev ) ; } var links = context . broadcast ? curr . getChildren ( ) : curr . getParents ( ) ; for ( var i = 0 ; i < links . length ; i ++ ) { motif . addEdge ( curr , links [ i ] ) ; motif . addNode ( links [ i ] ) ; var linkHost = links [ i ] . getHost ( ) ; if ( ! seenHosts [ linkHost ] ) { seenHosts [ linkHost ] = true ; } } prev = curr ; curr = curr . getNext ( ) ; } } return motif ; }
Creates a motif out of the groups
Creates a motif out of the groups