Package org.gephi.graph.dhns.edge

Examples of org.gephi.graph.dhns.edge.MetaEdgeImpl


        Node leaf9 = graphGlobal2Directed.getChildren(metaNode2).toArray()[1];

        //Get meta edges
        Edge[] metaEdges = graphGlobal2Directed.getMetaEdges().toArray();
        assertEquals(3, metaEdges.length);
        MetaEdgeImpl metaEdge01 = (MetaEdgeImpl) metaEdges[0];
        MetaEdgeImpl metaEdge12 = (MetaEdgeImpl) metaEdges[1];
        MetaEdgeImpl metaEdge21 = (MetaEdgeImpl) metaEdges[2];

        assertSame(metaNode0, metaEdge01.getSource());
        assertSame(metaNode1, metaEdge01.getTarget());
        assertSame(metaNode1, metaEdge12.getSource());
        assertSame(metaNode2, metaEdge12.getTarget());
        assertSame(metaNode2, metaEdge21.getSource());
        assertSame(metaNode1, metaEdge21.getTarget());

        //Meta edge content
        /*Edge[] metaEdge01content = graphGlobal2Directed.getMetaEdgeContent(metaEdge01).toArray();
        assertEquals(3, metaEdge01content.length);
        assertSame(metaEdge01content[0], graphGlobal2Directed.getEdge(leaf2, leaf5));
View Full Code Here


        Node leaf9 = graphGlobal2Undirected.getChildren(metaNode2).toArray()[1];

        //Get meta edges
        Edge[] metaEdges = graphGlobal2Undirected.getMetaEdges().toArray();
        assertEquals(2, metaEdges.length);
        MetaEdgeImpl metaEdge01 = (MetaEdgeImpl) metaEdges[0];
        MetaEdgeImpl metaEdge12 = (MetaEdgeImpl) metaEdges[1];

        assertSame(metaNode0, metaEdge01.getSource());
        assertSame(metaNode1, metaEdge01.getTarget());
        assertSame(metaNode1, metaEdge12.getSource());
        assertSame(metaNode2, metaEdge12.getTarget());

        //Degree
        assertEquals(2, graphGlobal2Undirected.getMetaDegree(metaNode1));
        assertEquals(1, graphGlobal2Undirected.getMetaDegree(metaNode0));
        assertEquals(1, graphGlobal2Undirected.getMetaDegree(metaNode2));
View Full Code Here

        int rangeStart = rangeNode.getPre();
        int rangeLimit = rangeStart + rangeNode.size;
        if (enabledNode.getMetaEdgesOutTree().getCount() > 0) {
            edgeIterator.setNode(enabledNode.getMetaEdgesOutTree());
            while (edgeIterator.hasNext()) {
                MetaEdgeImpl metaEdge = (MetaEdgeImpl) edgeIterator.next();
                AbstractNode target = metaEdge.getTarget(viewId);
                int targetPre = target.getPre();
                if (targetPre >= rangeStart && targetPre <= rangeLimit) {
                    //The meta edge has to be removed because it's in the range
                    if (!metaEdge.isSelfLoop() && target.getEdgesInTree().hasNeighbour(enabledNode)) {
                        enabledNode.decMutualMetaEdgeDegree();
                        target.decMutualMetaEdgeDegree();
                        view.decMutualMetaEdgesTotal(1);
                    }
                    edgeIterator.remove();
                    target.getMetaEdgesInTree().remove(metaEdge);
                    view.decMetaEdgesCount(1);
                }
            }
        }

        if (enabledNode.getMetaEdgesInTree().getCount() > 0) {
            edgeIterator.setNode(enabledNode.getMetaEdgesInTree());
            while (edgeIterator.hasNext()) {
                MetaEdgeImpl metaEdge = (MetaEdgeImpl) edgeIterator.next();
                int sourcePre = metaEdge.getSource(viewId).getPre();
                if (sourcePre >= rangeStart && sourcePre <= rangeLimit) {
                    //The meta edge has to be removed because it's in the range
                    edgeIterator.remove();
                    metaEdge.getSource(viewId).getMetaEdgesOutTree().remove(metaEdge);
                    view.decMetaEdgesCount(1);
                }
            }
        }
    }
View Full Code Here

        }
        if (source == target) {
            return;
        }

        MetaEdgeImpl metaEdge = getMetaEdge(source, target);
        if (metaEdge == null) {
            metaEdge = createMetaEdge(source, target);
        }
        if (metaEdge != null) {
            if (metaEdge.addEdge(edge)) {
                dhns.getSettingsManager().getMetaEdgeBuilder().pushEdge(edge, edgeSource, edgeTarget, metaEdge);
            }
        }
    }
View Full Code Here

    private MetaEdgeImpl createMetaEdge(AbstractNode source, AbstractNode target) {
        if (source == target) {
            return null;
        }
        MetaEdgeImpl newEdge = dhns.factory().newMetaEdge(source, target);
        source.getMetaEdgesOutTree().add(newEdge);
        target.getMetaEdgesInTree().add(newEdge);
        if (!newEdge.isSelfLoop() && target.getEdgesInTree().hasNeighbour(source)) {
            source.incMutualMetaEdgeDegree();
            target.incMutualMetaEdgeDegree();
            view.incMutualMetaEdgesTotal(1);
        }
        view.incMetaEdgesCount(1);
View Full Code Here

        if (edge.isSelfLoop()) {
            return;
        }


        MetaEdgeImpl metaEdge = getMetaEdge(edge);
        if (metaEdge != null) {
            if (metaEdge.removeEdge(edge)) {
                AbstractNode edgeSource = edge.getSource(viewId);
                AbstractNode edgeTarget = edge.getTarget(viewId);
                dhns.getSettingsManager().getMetaEdgeBuilder().pullEdge(edge, edgeSource, edgeTarget, metaEdge);
            }
            if (metaEdge.isEmpty()) {
                AbstractNode source = metaEdge.getSource(viewId);
                AbstractNode target = metaEdge.getTarget(viewId);
                if(!metaEdge.isSelfLoop() && source.getMetaEdgesInTree().hasNeighbour(target)) {
                    source.decMutualMetaEdgeDegree();
                    target.decMutualMetaEdgeDegree();
                    view.decMutualMetaEdgesTotal(1);
                }
                source.getMetaEdgesOutTree().remove(metaEdge);
View Full Code Here

        if (source == null || target == null) {
            throw new NullPointerException();
        }
        AbstractNode nodeSource = (AbstractNode) source;
        AbstractNode nodeTarget = (AbstractNode) target;
        MetaEdgeImpl edge = new MetaEdgeImpl(idGen.newEdgeId(), nodeSource, nodeTarget);
        edge.setAttributes(newEdgeAttributes(edge.getEdgeData()));
        edge.getEdgeData().setTextData(newTextData());
        edge.getEdgeData().setId("" + edge.getId());
        return edge;
    }
View Full Code Here

TOP

Related Classes of org.gephi.graph.dhns.edge.MetaEdgeImpl

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.