Package org.gephi.graph.dhns.core

Examples of org.gephi.graph.dhns.core.GraphFactoryImpl


        graphGlobal = new HierarchicalDirectedGraphImpl(dhnsGlobal, dhnsGlobal.getGraphStructure().getMainView());
        nodeMap = new HashMap<String, Node>();
        edgeMap = new HashMap<String, Edge>();

        TreeStructure treeStructure = dhnsGlobal.getGraphStructure().getMainView().getStructure();
        GraphFactoryImpl factory = dhnsGlobal.factory();

        //Nodes
        //System.out.println("-----Global-----");
        for (int i = 0; i < 10; i++) {
            Node node = factory.newNode();
            node.getNodeData().setLabel("Node " + i);
            graphGlobal.addNode(node);
            nodeMap.put(node.getNodeData().getLabel(), node);
            //System.out.println("Node " + i + " added. Id = " + node.getId());
        }
        //System.out.println("---End Global---");

        //Edges
        Node node0 = nodeMap.get("Node 0");
        Node node1 = nodeMap.get("Node 1");
        Node node2 = nodeMap.get("Node 2");
        Node node3 = nodeMap.get("Node 3");
        Node node4 = nodeMap.get("Node 4");
        Node node5 = nodeMap.get("Node 5");
        Node node6 = nodeMap.get("Node 6");
        Node node7 = nodeMap.get("Node 7");
        Node node8 = nodeMap.get("Node 8");

        AbstractEdge edge1 = factory.newEdge("4-5", node4, node5, 1f, true);
        AbstractEdge edge2 = factory.newEdge("5-6", node5, node6, 4f, true);
        AbstractEdge edge3 = factory.newEdge("6-5", node6, node5, 3f, true);
        AbstractEdge edge4 = factory.newEdge("7-7", node7, node7, 5f, true);
        AbstractEdge edge5 = factory.newEdge("4-4", node4, node4, 2f, true);
        AbstractEdge edge6 = factory.newEdge("2-1", node2, node1, 1f, true);
        AbstractEdge edge7 = factory.newEdge("2-3", node2, node3, 10f, true);
        AbstractEdge edge8 = factory.newEdge("2-5", node2, node5, 12f, true);

        graphGlobal.addEdge(edge1);
        graphGlobal.addEdge(edge2);
        graphGlobal.addEdge(edge3);
        graphGlobal.addEdge(edge4);
View Full Code Here

TOP

Related Classes of org.gephi.graph.dhns.core.GraphFactoryImpl

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.