Package org.gephi.graph.dhns.node.iterators

Examples of org.gephi.graph.dhns.node.iterators.LevelIterator


    public void testEdgesCountingReseting() {
        GraphViewImpl view = dhnsGlobal2.getGraphStructure().getMainView();
        graphGlobal2Directed.resetViewToLeaves();
        assertEquals(2, view.getMutualEdgesEnabled());
        assertEquals(10, view.getEdgesCountEnabled());
        LevelIterator lvlIterator = new LevelIterator(view.getStructure(), 2, Tautology.instance);
        for (; lvlIterator.hasNext();) {
            AbstractNode node = lvlIterator.next();
            assertEquals(node.getEdgesInTree().getCount(), node.getEnabledInDegree());
            assertEquals(node.getEdgesOutTree().getCount(), node.getEnabledOutDegree());
            int expectedMutual = 0;
            ParamAVLIterator<AbstractEdge> edgeIterator = new ParamAVLIterator<AbstractEdge>();
            for (edgeIterator.setNode(node.getEdgesOutTree()); edgeIterator.hasNext();) {
                AbstractEdge edge = edgeIterator.next();
                AbstractNode target = edge.getTarget(view.getViewId());
                if (node != target && target.getEdgesOutTree().hasNeighbour(node)) {
                    expectedMutual++;
                }
            }
            assertEquals(expectedMutual, node.getEnabledMutualDegree());
        }
        graphGlobal2Directed.resetViewToTopNodes();
        assertEquals(0, view.getMutualEdgesEnabled());
        assertEquals(0, view.getEdgesCountEnabled());
        graphGlobal2Directed.resetViewToLevel(1);
        assertEquals(2, view.getMutualEdgesEnabled());
        assertEquals(10, view.getEdgesCountEnabled());
        LevelIterator lvlIterator2 = new LevelIterator(view.getStructure(), 2, Tautology.instance);
        for (; lvlIterator2.hasNext();) {
            AbstractNode node = lvlIterator2.next();
            assertEquals(node.getEdgesInTree().getCount(), node.getEnabledInDegree());
            assertEquals(node.getEdgesOutTree().getCount(), node.getEnabledOutDegree());
            int expectedMutual = 0;
            ParamAVLIterator<AbstractEdge> edgeIterator = new ParamAVLIterator<AbstractEdge>();
            for (edgeIterator.setNode(node.getEdgesOutTree()); edgeIterator.hasNext();) {
View Full Code Here


        int height = structure.getTreeHeight();
        if (level > height) {
            readUnlock();
            throw new IllegalArgumentException("Level must be between 0 and the height of the tree, currently height=" + (height - 1));
        }
        return dhns.newNodeIterable(new LevelIterator(structure, level, Tautology.instance));

    }
View Full Code Here

TOP

Related Classes of org.gephi.graph.dhns.node.iterators.LevelIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.