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

Examples of com.intel.hadoop.graphbuilder.graph.simplegraph.SimpleGraph.numEdges()


public class SimpleGraphTest {

  @Test
  public void testEmptyGraph() {
    SimpleGraph mygraph = new SimpleGraph();
    assertEquals(mygraph.numEdges(), 0);
  }

  @Test
  public void testSmallGraph() {
    SimpleGraph mygraph = new SimpleGraph();
View Full Code Here


    SimpleGraph mygraph = new SimpleGraph();
    List<Integer> sources = Arrays.asList(1, 2, 3, 4, 5);
    List<Integer> targets = Arrays.asList(5, 4, 3, 2, 1);
    List<Character> edata = Arrays.asList('a', 'b', 'c', 'd', 'e');

    assertEquals(mygraph.numEdges(), 0);
    for (int i = 0; i < sources.size(); i++) {
      mygraph.addEdge(sources.get(i), targets.get(i), edata.get(i));
    }
    assertEquals(mygraph.numEdges(), sources.size());
  }
View Full Code Here

    assertEquals(mygraph.numEdges(), 0);
    for (int i = 0; i < sources.size(); i++) {
      mygraph.addEdge(sources.get(i), targets.get(i), edata.get(i));
    }
    assertEquals(mygraph.numEdges(), sources.size());
  }

  @Test
  public void testGraphFormatter() {
    SimpleGraph mygraph = new SimpleGraph();
View Full Code Here

    SimpleGraph mygraph = new SimpleGraph();
    List<Integer> sources = Arrays.asList(1, 2, 3, 4, 5);
    List<Integer> targets = Arrays.asList(5, 4, 3, 2, 1);
    List<String> edata = Arrays.asList("a", "b", "c", "d", "e");

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

    SimpleJsonFormatter formatter = new SimpleJsonFormatter();
    String s = formatter.structWriter(mygraph).toString();
View Full Code Here

    List<Integer> targets = Arrays.asList(5, 4, 3, 2, 1);
    List<String> edata = Arrays.asList("a", "b", "c", "d", "e");

    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"
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.