All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cass.rollup.processors.v2.graph.collapser.CyclicGraphCollapser Maven / Gradle / Ivy

There is a newer version: 3.1.8
Show newest version
package cass.rollup.processors.v2.graph.collapser;

import cass.rollup.processors.v2.graph.util.*;
import org.stjs.javascript.Array;

public class CyclicGraphCollapser {

    private Array nodesProcessed;
    private Array visitedNodes;

    public CyclicGraphCollapser() {
    }

    private NodeRelationMap buildNarrowsIsRequiredByEqualsMap(NodeGraph graph) {
        NodeRelationMap relationMap = new NodeRelationMap();
        Node n;
        Array nodeList = graph.getNodeList();
        for (int i=0;i nodeList = graph.getNodeList();
        for (int i=0;i nodeList = relationMap.getNodeList();
        Array nodeRelations;
        NodeRelation nr;
        for (int i=0;i relationsToVisit = relationMap.getRelationsForNode(n);
            if (relationsToVisit == null || relationsToVisit.$length() == 0) return;
            else {
                visitedNodes.push(n);
                NodeRelation nr;
                for (int i=0;i nodeList = relationMap.getNodeList();
        for (int i=0;i();
            //this may be something we can change for efficiency...I was alternating between these two to see if there was any difference...
            //if (!nodesProcessed.contains(n)) findCycles(n,relationMap,npg,new ArrayList());
            findCycles(nodeList.$get(i),relationMap,npg);
        }
    }

    private NodePacketGraph buildNodePacketGraph(NodeRelationMap relationMap) {
        NodePacketGraph npg = new NodePacketGraph();
        npg.initNodePacketGraph(relationMap.getNodeList());
        mergeEquivalentNodes(relationMap,npg);
        nodesProcessed = new Array();
        startFindCycles(relationMap, npg);
        return npg;
    }

    public NodePacketGraph mergeNodePacketGraphs(NodePacketGraph nirbeNpg, NodePacketGraph breNpg) {
        NodePacketGraph mergedNpg = nirbeNpg;
        NodePacket np;
        Array nodePacketList = breNpg.getNodePacketList();
        for (int i=0;i 1) {
                NodePacket targetNodePacket = mergedNpg.getNodePacketForNode(np.getNodeList().$get(0));
                for (int j=1;j




© 2015 - 2024 Weber Informatics LLC | Privacy Policy