Package org.jamesii.core.util.graph

Examples of org.jamesii.core.util.graph.SimpleGraph.addEdge()


  /**
   * Tests the cycle detection.
   */
  public void testCycleDetection() {
    SimpleGraph simpleGraph = new SimpleGraph(5);
    simpleGraph.addEdge(new AnnotatedEdge<Integer, Double, Object>(0, 1));
    simpleGraph.addEdge(new AnnotatedEdge<Integer, Double, Object>(1, 2));
    simpleGraph.addEdge(new AnnotatedEdge<Integer, Double, Object>(2, 3));
    simpleGraph.addEdge(new AnnotatedEdge<Integer, Double, Object>(3, 4));
    List<Integer> cycle = CycleDetection.detectCycle(simpleGraph);
    assertTrue("There is no cycle in the given graph.", cycle.isEmpty());
View Full Code Here


   * Tests the cycle detection.
   */
  public void testCycleDetection() {
    SimpleGraph simpleGraph = new SimpleGraph(5);
    simpleGraph.addEdge(new AnnotatedEdge<Integer, Double, Object>(0, 1));
    simpleGraph.addEdge(new AnnotatedEdge<Integer, Double, Object>(1, 2));
    simpleGraph.addEdge(new AnnotatedEdge<Integer, Double, Object>(2, 3));
    simpleGraph.addEdge(new AnnotatedEdge<Integer, Double, Object>(3, 4));
    List<Integer> cycle = CycleDetection.detectCycle(simpleGraph);
    assertTrue("There is no cycle in the given graph.", cycle.isEmpty());
    simpleGraph.addEdge(new AnnotatedEdge<Integer, Double, Object>(4, 2));
View Full Code Here

   */
  public void testCycleDetection() {
    SimpleGraph simpleGraph = new SimpleGraph(5);
    simpleGraph.addEdge(new AnnotatedEdge<Integer, Double, Object>(0, 1));
    simpleGraph.addEdge(new AnnotatedEdge<Integer, Double, Object>(1, 2));
    simpleGraph.addEdge(new AnnotatedEdge<Integer, Double, Object>(2, 3));
    simpleGraph.addEdge(new AnnotatedEdge<Integer, Double, Object>(3, 4));
    List<Integer> cycle = CycleDetection.detectCycle(simpleGraph);
    assertTrue("There is no cycle in the given graph.", cycle.isEmpty());
    simpleGraph.addEdge(new AnnotatedEdge<Integer, Double, Object>(4, 2));
    cycle = CycleDetection.detectCycle(simpleGraph);
View Full Code Here

  public void testCycleDetection() {
    SimpleGraph simpleGraph = new SimpleGraph(5);
    simpleGraph.addEdge(new AnnotatedEdge<Integer, Double, Object>(0, 1));
    simpleGraph.addEdge(new AnnotatedEdge<Integer, Double, Object>(1, 2));
    simpleGraph.addEdge(new AnnotatedEdge<Integer, Double, Object>(2, 3));
    simpleGraph.addEdge(new AnnotatedEdge<Integer, Double, Object>(3, 4));
    List<Integer> cycle = CycleDetection.detectCycle(simpleGraph);
    assertTrue("There is no cycle in the given graph.", cycle.isEmpty());
    simpleGraph.addEdge(new AnnotatedEdge<Integer, Double, Object>(4, 2));
    cycle = CycleDetection.detectCycle(simpleGraph);
    assertTrue(
View Full Code Here

    simpleGraph.addEdge(new AnnotatedEdge<Integer, Double, Object>(1, 2));
    simpleGraph.addEdge(new AnnotatedEdge<Integer, Double, Object>(2, 3));
    simpleGraph.addEdge(new AnnotatedEdge<Integer, Double, Object>(3, 4));
    List<Integer> cycle = CycleDetection.detectCycle(simpleGraph);
    assertTrue("There is no cycle in the given graph.", cycle.isEmpty());
    simpleGraph.addEdge(new AnnotatedEdge<Integer, Double, Object>(4, 2));
    cycle = CycleDetection.detectCycle(simpleGraph);
    assertTrue(
        "There is a cycle (2,3,4) in the given graph.",
        cycle.size() == 3 && cycle.contains(2) && cycle.contains(3)
            && cycle.contains(4));
View Full Code Here

   * @return the graph
   */
  private SimpleGraph createTestGraph() {
    SimpleGraph testGraph = new SimpleGraph(6);

    testGraph.addEdge(new AnnotatedEdge<>(0, 1, 7.));
    testGraph.addEdge(new AnnotatedEdge<>(0, 2, 9.));
    testGraph.addEdge(new AnnotatedEdge<>(0, 5, 14.));

    testGraph.addEdge(new AnnotatedEdge<>(1, 2, 10.));
    testGraph.addEdge(new AnnotatedEdge<>(1, 3, 15.));
View Full Code Here

   */
  private SimpleGraph createTestGraph() {
    SimpleGraph testGraph = new SimpleGraph(6);

    testGraph.addEdge(new AnnotatedEdge<>(0, 1, 7.));
    testGraph.addEdge(new AnnotatedEdge<>(0, 2, 9.));
    testGraph.addEdge(new AnnotatedEdge<>(0, 5, 14.));

    testGraph.addEdge(new AnnotatedEdge<>(1, 2, 10.));
    testGraph.addEdge(new AnnotatedEdge<>(1, 3, 15.));

View Full Code Here

  private SimpleGraph createTestGraph() {
    SimpleGraph testGraph = new SimpleGraph(6);

    testGraph.addEdge(new AnnotatedEdge<>(0, 1, 7.));
    testGraph.addEdge(new AnnotatedEdge<>(0, 2, 9.));
    testGraph.addEdge(new AnnotatedEdge<>(0, 5, 14.));

    testGraph.addEdge(new AnnotatedEdge<>(1, 2, 10.));
    testGraph.addEdge(new AnnotatedEdge<>(1, 3, 15.));

    testGraph.addEdge(new AnnotatedEdge<>(2, 3, 11.));
View Full Code Here

    testGraph.addEdge(new AnnotatedEdge<>(0, 1, 7.));
    testGraph.addEdge(new AnnotatedEdge<>(0, 2, 9.));
    testGraph.addEdge(new AnnotatedEdge<>(0, 5, 14.));

    testGraph.addEdge(new AnnotatedEdge<>(1, 2, 10.));
    testGraph.addEdge(new AnnotatedEdge<>(1, 3, 15.));

    testGraph.addEdge(new AnnotatedEdge<>(2, 3, 11.));
    testGraph.addEdge(new AnnotatedEdge<>(2, 5, 2.));
View Full Code Here

    testGraph.addEdge(new AnnotatedEdge<>(0, 1, 7.));
    testGraph.addEdge(new AnnotatedEdge<>(0, 2, 9.));
    testGraph.addEdge(new AnnotatedEdge<>(0, 5, 14.));

    testGraph.addEdge(new AnnotatedEdge<>(1, 2, 10.));
    testGraph.addEdge(new AnnotatedEdge<>(1, 3, 15.));

    testGraph.addEdge(new AnnotatedEdge<>(2, 3, 11.));
    testGraph.addEdge(new AnnotatedEdge<>(2, 5, 2.));

    testGraph.addEdge(new AnnotatedEdge<>(3, 4, 6.));
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.