Package com.intel.hadoop.graphbuilder.graph.simplegraph

Examples of com.intel.hadoop.graphbuilder.graph.simplegraph.SimpleJsonFormatter


      myGraph.addEdges(evalue.sources(), evalue.targets(), evalue.edata());
    }

    // Switch to GLGraph by uncommenting the next line.
    // GLJsonFormatter formatter = new GLJsonFormatter();
    SimpleJsonFormatter formatter = new SimpleJsonFormatter();
    LOG.info("Write out graph " + pid + " with " + myGraph.numEdges()
        + " edges");
    graphOutput.writeAndClear(myGraph, formatter, out, reporter);

    LOG.info("Done reducing graph:" + pid + ".");
View Full Code Here


    assertEquals(mygraph.numEdges(), 0);
    mygraph.addEdges(sources, targets, edata);
    assertEquals(mygraph.numEdges(), sources.size());

    SimpleJsonFormatter formatter = new SimpleJsonFormatter();
    String s = formatter.structWriter(mygraph).toString();
    String expected = "{\"source\":1,\"targets\":[5]}\n"
        + "{\"source\":2,\"targets\":[4]}\n"
        + "{\"source\":3,\"targets\":[3]}\n"
        + "{\"source\":4,\"targets\":[2]}\n"
        + "{\"source\":5,\"targets\":[1]}\n";
    assertEquals(s, expected);

    s = formatter.edataWriter(mygraph).toString();
    expected = "[\"a\",\"b\",\"c\",\"d\",\"e\"]";
    assertEquals(expected, s);
  }
View Full Code Here

TOP

Related Classes of com.intel.hadoop.graphbuilder.graph.simplegraph.SimpleJsonFormatter

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.