Package prefuse.data

Examples of prefuse.data.Edge


    /**
     * @see java.util.Iterator#next()
     */
    public Object next() {
        Edge e = (Edge)m_edges.next();
        return e.getAdjacentNode(m_node);
    }
View Full Code Here


            assertEquals(graph.getOutDegree(nrow), OUTDEGREE[nrow]);
           
            // check edges
            Iterator eiter = node.inEdges();
            while ( eiter.hasNext() ) {
                Edge edge = (Edge)eiter.next();
                int erow = edge.getRow();
                assertEquals(nrow, edge.getTargetNode().getRow());
                assertEquals(nrow, graph.getTargetNode(erow));
            }
            eiter = node.outEdges();
            while ( eiter.hasNext() ) {
                Edge edge = (Edge)eiter.next();
                int erow = edge.getRow();
                assertEquals(nrow, edge.getSourceNode().getRow());
                assertEquals(nrow, graph.getSourceNode(erow));
            }
        }
       
        // check all edges, basic data
        Iterator eiter = graph.edges();
        while ( eiter.hasNext() ) {
            Edge edge = (Edge)eiter.next();
            int erow = edge.getRow();
           
            // check data members
            for ( int i=0; i<NEDGECOLS; ++i ) {
                assertEquals(EDGES[i][erow], edge.get(EHEADERS[i]));
                assertEquals(EDGES[i][erow], edges.get(erow, EHEADERS[i]));
            }
           
            // check nodes
            Node s = edge.getSourceNode();
            int srow = s.getRow();
            assertEquals(srow, graph.getSourceNode(erow));
            int sk = nodes.getInt(srow, NHEADERS[0]);
            assertEquals(sk, edges.getInt(erow, EHEADERS[0]));
           
            Node t = edge.getTargetNode();
            int trow = t.getRow();
            assertEquals(trow, graph.getTargetNode(erow));
            int tk = nodes.getInt(trow, NHEADERS[0]);
            assertEquals(tk, edges.getInt(erow, EHEADERS[1]));
           
            assertEquals(srow, edge.getAdjacentNode(t).getRow());
            assertEquals(trow, edge.getAdjacentNode(s).getRow());
            assertEquals(srow, graph.getAdjacentNode(erow, trow));
            assertEquals(trow, graph.getAdjacentNode(erow, srow));
        }
    }
View Full Code Here

    public void testRemoveChild() {
        Tree tree = GraphLib.getBalancedTree(2,1);
        int size = tree.getNodeCount();
        Node r = tree.getRoot();
        Node c = r.getFirstChild();
        Edge e = c.getParentEdge();
       
        assertEquals(true, tree.removeChild(c));
        assertEquals(tree.getNodeCount(), size-1);
        assertEquals(false, c.isValid());
        assertEquals(false, e.isValid());
        assertEquals(true, r.getFirstChild() != c);
    }
View Full Code Here

TOP

Related Classes of prefuse.data.Edge

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.