Package com.tinkerpop.furnace.generators

Examples of com.tinkerpop.furnace.generators.Distribution


        int numNodes = 100;
        int numEdges = 1000;
        long seed = System.currentTimeMillis();
        Random random = new Random(seed);
        //normal
        Distribution n = new NormalDistribution(2);
        n = n.initialize(numNodes,numEdges);
        int degreeSum = 0;
        for (int i=0;i<numNodes;i++) {
            int degree=n.nextValue(random);
            degreeSum+=degree;
        }
        System.out.println(degreeSum);

        random = new Random(seed);
        n = new NormalDistribution(2);
        n = n.initialize(numNodes,numEdges);
        for (int i=0;i<numNodes;i++) {
            degreeSum-=n.nextValue(random);
        }
        assertEquals(0,degreeSum);

        //scale free
        n = new PowerLawDistribution(2.9);
        n = n.initialize(numNodes,numEdges);
        degreeSum = 0;
        for (int i=0;i<numNodes;i++) {
            int degree=n.nextValue(random);
            //System.out.println(degree);
            degreeSum+=degree;
        }
        System.out.println(degreeSum);
View Full Code Here

TOP

Related Classes of com.tinkerpop.furnace.generators.Distribution

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.