Examples of VertexMemory


Examples of com.tinkerpop.furnace.algorithms.vertexcentric.VertexMemory

        DegreeRankProgram program = DegreeRankProgram.create().build();
        SerialGraphComputer computer = new SerialGraphComputer(graph, program, GraphComputer.Isolation.BSP);
        computer.execute();

        VertexMemory results = computer.getVertexMemory();
        assertEquals(results.getProperty(graph.getVertex(1), DegreeRankProgram.DEGREE), 0l);
        assertEquals(results.getProperty(graph.getVertex(2), DegreeRankProgram.DEGREE), 1l);
        assertEquals(results.getProperty(graph.getVertex(3), DegreeRankProgram.DEGREE), 3l);
        assertEquals(results.getProperty(graph.getVertex(4), DegreeRankProgram.DEGREE), 1l);
        assertEquals(results.getProperty(graph.getVertex(5), DegreeRankProgram.DEGREE), 1l);
        assertEquals(results.getProperty(graph.getVertex(6), DegreeRankProgram.DEGREE), 0l);
    }
View Full Code Here

Examples of com.tinkerpop.furnace.algorithms.vertexcentric.VertexMemory

        DegreeRankProgram program = DegreeRankProgram.create().degreeQuery(new VertexQueryBuilder().direction(Direction.OUT)).build();
        SerialGraphComputer computer = new SerialGraphComputer(graph, program, GraphComputer.Isolation.BSP);
        computer.execute();

        VertexMemory results = computer.getVertexMemory();
        assertEquals(results.getProperty(graph.getVertex(1), DegreeRankProgram.DEGREE), 3l);
        assertEquals(results.getProperty(graph.getVertex(2), DegreeRankProgram.DEGREE), 0l);
        assertEquals(results.getProperty(graph.getVertex(3), DegreeRankProgram.DEGREE), 0l);
        assertEquals(results.getProperty(graph.getVertex(4), DegreeRankProgram.DEGREE), 2l);
        assertEquals(results.getProperty(graph.getVertex(5), DegreeRankProgram.DEGREE), 0l);
        assertEquals(results.getProperty(graph.getVertex(6), DegreeRankProgram.DEGREE), 1l);
    }
View Full Code Here

Examples of com.tinkerpop.furnace.algorithms.vertexcentric.VertexMemory

        DegreeRankProgram program = DegreeRankProgram.create().degreeQuery(new VertexQueryBuilder().direction(Direction.BOTH).labels("created")).build();
        SerialGraphComputer computer = new SerialGraphComputer(graph, program, GraphComputer.Isolation.BSP);
        computer.execute();

        VertexMemory results = computer.getVertexMemory();
        assertEquals(results.getProperty(graph.getVertex(1), DegreeRankProgram.DEGREE), 1l);
        assertEquals(results.getProperty(graph.getVertex(2), DegreeRankProgram.DEGREE), 0l);
        assertEquals(results.getProperty(graph.getVertex(3), DegreeRankProgram.DEGREE), 3l);
        assertEquals(results.getProperty(graph.getVertex(4), DegreeRankProgram.DEGREE), 2l);
        assertEquals(results.getProperty(graph.getVertex(5), DegreeRankProgram.DEGREE), 1l);
        assertEquals(results.getProperty(graph.getVertex(6), DegreeRankProgram.DEGREE), 1l);
    }
View Full Code Here

Examples of com.tinkerpop.furnace.algorithms.vertexcentric.VertexMemory

        PageRankProgram program = PageRankProgram.create().vertexCount(6).iterations(3).build();
        SerialGraphComputer computer = new SerialGraphComputer(graph, program, GraphComputer.Isolation.BSP);
        computer.execute();

        VertexMemory results = computer.getVertexMemory();

        System.out.println(results);

        double total = 0.0d;
        final Map<String, Double> map = new HashMap<String, Double>();
        for (Vertex vertex : graph.getVertices()) {
            double pageRank = Double.parseDouble(results.getProperty(vertex, PageRankProgram.PAGE_RANK).toString());
            assertTrue(pageRank > 0.0d);
            total = total + pageRank;
            map.put(vertex.getProperty("name") + " ", pageRank);
        }
        for (Map.Entry<String, Double> entry : ImmutableSortedMap.copyOf(map, new Comparator<String>() {
View Full Code Here

Examples of com.tinkerpop.furnace.algorithms.vertexcentric.VertexMemory

        WeightedPageRankProgram program = WeightedPageRankProgram.create().vertexCount(6).edgeWeightFunction(WeightedPageRankProgram.getEdgeWeightPropertyFunction("weight")).build();
        SerialGraphComputer computer = new SerialGraphComputer(graph, program, GraphComputer.Isolation.BSP);
        computer.execute();

        VertexMemory results = computer.getVertexMemory();

        System.out.println(results);

        double total = 0.0d;
        final Map<String, Double> map = new HashMap<String, Double>();
        for (Vertex vertex : graph.getVertices()) {
            double pageRank = Double.parseDouble(results.getProperty(vertex, WeightedPageRankProgram.PAGE_RANK).toString());
            assertTrue(pageRank > 0.0d);
            total = total + pageRank;
            map.put(vertex.getProperty("name") + " ", pageRank);
        }
        for (Map.Entry<String, Double> entry : ImmutableSortedMap.copyOf(map, new Comparator<String>() {
View Full Code Here

Examples of com.tinkerpop.furnace.algorithms.vertexcentric.VertexMemory

        PageRankProgram program2 = PageRankProgram.create().vertexCount(6).build();
        SerialGraphComputer computer2 = new SerialGraphComputer(graph, program2, GraphComputer.Isolation.BSP);
        computer2.execute();

        VertexMemory results1 = computer1.getVertexMemory();
        VertexMemory results2 = computer2.getVertexMemory();

        for (final Vertex vertex : graph.getVertices()) {
            assertEquals(results1.getProperty(vertex, WeightedPageRankProgram.PAGE_RANK), results2.getProperty(vertex, PageRankProgram.PAGE_RANK));
        }
    }
View Full Code Here

Examples of com.tinkerpop.furnace.algorithms.vertexcentric.VertexMemory

        PeerPressureProgram program = PeerPressureProgram.create().build();
        SerialGraphComputer computer = new SerialGraphComputer(graph, program, GraphComputer.Isolation.BSP);
        computer.execute();

        VertexMemory results = computer.getVertexMemory();

        System.out.println(results);

        final Map<String, Object> map = new HashMap<String, Object>();
        for (Vertex vertex : graph.getVertices()) {
            Object cluster = results.getProperty(vertex, PeerPressureProgram.CLUSTER);
            map.put(vertex.getProperty("name") + " ", cluster);
        }
        for (Map.Entry<String, Object> entry : ImmutableSortedMap.copyOf(map, new Comparator<String>() {
            public int compare(final String key, final String key2) {
                int c = ((String) map.get(key2)).compareTo((String) map.get(key));
View Full Code Here

Examples of com.tinkerpop.furnace.algorithms.vertexcentric.VertexMemory

            }
        }).build();
        SerialGraphComputer computer = new SerialGraphComputer(graph, program, GraphComputer.Isolation.BSP);
        computer.execute();

        VertexMemory results = computer.getVertexMemory();
        for (Vertex vertex : graph.getVertices()) {
            System.out.println(vertex.getProperty("name") + "\t" + results.getProperty(vertex, SwarmProgram.PARTICLES) + "\t" + results.getProperty(vertex, PageRankProgram.PAGE_RANK));
        }
    }
View Full Code Here

Examples of com.tinkerpop.furnace.algorithms.vertexcentric.VertexMemory

                .addQuery(new VertexQueryBuilder().direction(Direction.IN).labels("created"))
                .addQuery(new VertexQueryBuilder().direction(Direction.OUT).labels("created")).build();
        SerialGraphComputer computer = new SerialGraphComputer(graph, program, GraphComputer.Isolation.BSP);
        computer.execute();

        VertexMemory results = computer.getVertexMemory();
        for (Vertex vertex : graph.getVertices()) {
            System.out.println(vertex.getProperty("name") + "\t" + results.getProperty(vertex, TraversalProgram.COUNTS));
        }
    }
View Full Code Here

Examples of com.tinkerpop.furnace.algorithms.vertexcentric.VertexMemory

        for (int workers = 1; workers < 25; workers++) {
            for (int threads = 1; threads < 25; threads++) {
                DegreeRankProgram program = DegreeRankProgram.create().build();
                ParallelGraphComputer computer = new ParallelGraphComputer(graph, program, GraphComputer.Isolation.BSP);
                computer.execute();
                VertexMemory results = computer.getVertexMemory();
                testDegree(graph, results);
            }
        }

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.