Package com.tinkerpop.furnace.algorithms.vertexcentric.computers

Examples of com.tinkerpop.furnace.algorithms.vertexcentric.computers.SerialGraphComputer.execute()


        Graph graph = TinkerGraphFactory.createTinkerGraph();

        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);
View Full Code Here


        Graph graph = TinkerGraphFactory.createTinkerGraph();

        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);
View Full Code Here

        Graph graph = TinkerGraphFactory.createTinkerGraph();

        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);
View Full Code Here

        //Graph graph = new TinkerGraph();
        //GraphMLReader.inputGraph(graph, "/Users/marko/software/tinkerpop/gremlin/data/graph-example-2.xml");

        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);
View Full Code Here

        //Graph graph = new TinkerGraph();
        //GraphMLReader.inputGraph(graph, "/Users/marko/software/tinkerpop/gremlin/data/graph-example-2.xml");

        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);
View Full Code Here

    public void testWeightedPageRankDegenerateToPageRank() throws Exception {
        Graph graph = TinkerGraphFactory.createTinkerGraph();

        WeightedPageRankProgram program1 = WeightedPageRankProgram.create().vertexCount(6).build();
        SerialGraphComputer computer1 = new SerialGraphComputer(graph, program1, GraphComputer.Isolation.BSP);
        computer1.execute();

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

        SerialGraphComputer computer1 = new SerialGraphComputer(graph, program1, GraphComputer.Isolation.BSP);
        computer1.execute();

        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()) {
View Full Code Here

        //Graph graph = new TinkerGraph();
        //GraphMLReader.inputGraph(graph, "/Users/marko/software/tinkerpop/gremlin/data/graph-example-2.xml");

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

        VertexMemory results = computer.getVertexMemory();

        System.out.println(results);
View Full Code Here

            public int hashCode() {
                return 1;
            }
        }).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

        TraversalProgram program = TraversalProgram.create().iterations(1)
                .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

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.