js/motifFinder/broadcastGatherFinder.js
// Finds disjoint groups of potential broadcasts/gathers
Finds disjoint groups of potential broadcasts/gathers
Finds disjoint groups of potential broadcasts / gathers
function findDisjoint() {
        var ret = [];
        var hosts = graph.getHosts();
        for (var h = 0; h < hosts.length; h++) {
            var host = hosts[h];
            var group = []; 
            var inBetween = 0;
            var inPattern = false;
            var curr = graph.getHead(host).getNext();
            while (curr != null) {
                var hasBadLink = context.broadcast ? curr.hasParents() : curr.hasChildren();
                var hasGoodLink = context.broadcast ? curr.hasChildren() : curr.hasParents();
                if (inBetween > context.maxInBetween || curr.isTail() || hasBadLink) {
                    if (inPattern && group.length != 0) {
                        ret.push(group);
                        group = [];
                        inPattern = false;
                    }
                }
                if (hasGoodLink) {
                    if (!inPattern) {
                        inPattern = true;
                        group = [];
                    }
                    inBetween = 1 - curr.getLogEventCount();
                }
                group.push(curr);
                inBetween += curr.getLogEventCount();
                curr = curr.getNext();
            }
        }
        return ret;
    }
function findDisjoint ( ) { var ret = [ ] ; var hosts = graph . getHosts ( ) ; for ( var h = 0 ; h < hosts . length ; h ++ ) { var host = hosts [ h ] ; var group = [ ] ; var inBetween = 0 ; var inPattern = false ; var curr = graph . getHead ( host ) . getNext ( ) ; while ( curr != null ) { var hasBadLink = context . broadcast ? curr . hasParents ( ) : curr . hasChildren ( ) ; var hasGoodLink = context . broadcast ? curr . hasChildren ( ) : curr . hasParents ( ) ; if ( inBetween > context . maxInBetween || curr . isTail ( ) || hasBadLink ) { if ( inPattern && group . length != 0 ) { ret . push ( group ) ; group = [ ] ; inPattern = false ; } } if ( hasGoodLink ) { if ( ! inPattern ) { inPattern = true ; group = [ ] ; } inBetween = 1 - curr . getLogEventCount ( ) ; } group . push ( curr ) ; inBetween += curr . getLogEventCount ( ) ; curr = curr . getNext ( ) ; } } return ret ; }
Finds disjoint groups of potential broadcasts/gathers
Finds disjoint groups of potential broadcasts / gathers
// The current disjoint group // If curr can't be part of the current group, push group and // start a new group for curr // if not currently in broadcast/gather pattern, clear group