Package rinde.sim.core.graph

Examples of rinde.sim.core.graph.Point


    }
  }

  @Test
  public void testFindNotFullyConnectedNodes1() {
    Point a, b, c, d, e;
    Graph<E> graph = createGraph();
    a = new Point(0, 0);
    b = new Point(10, 0);
    c = new Point(0, 10);
    d = new Point(10, 10);
    e = new Point(15, 5);

    graph.addConnection(a, b);
    graph.addConnection(a, c);
    graph.addConnection(b, c);
    graph.addConnection(c, a);
View Full Code Here


  }

  @Test
  public void testFindNotFullyConnectedNodes2() {
    Point a, b, c, d, e;
    Graph<E> graph = createGraph();
    a = new Point(0, 0);
    b = new Point(10, 0);
    c = new Point(0, 10);
    d = new Point(10, 10);
    e = new Point(15, 5);

    graph.addConnection(a, b);
    graph.addConnection(a, c);
    graph.addConnection(b, c);
    graph.addConnection(c, a);
View Full Code Here

    assertTrue(unconnectedSet.containsAll(asList(a, b, c, d)));
  }

  @Test
  public void testConnect() {
    Point a, b, c, d, e;
    Graph<E> graph = createGraph();
    a = new Point(0, 0);
    b = new Point(10, 0);
    c = new Point(0, 10);
    d = new Point(10, 10);
    e = new Point(15, 5);

    graph.addConnection(a, b);
    graph.addConnection(a, c);
    graph.addConnection(b, c);
    graph.addConnection(c, a);
View Full Code Here

    }
  }

  @Test
  public void testConnect2() {
    Point a, b, c, d, e;
    Graph<E> graph = createGraph();
    a = new Point(0, 0);
    b = new Point(10, 0);
    c = new Point(0, 10);
    d = new Point(10, 10);
    e = new Point(15, 5);

    graph.addConnection(a, b);
    graph.addConnection(a, c);
    graph.addConnection(b, c);
    graph.addConnection(c, a);
View Full Code Here

  }

  // TODO extend these tests, also check all EdgeData stuff!
  @Test
  public void testSimplify1() {
    Point a, b, c;
    a = new Point(0, 0);
    b = new Point(1, 0);
    c = new Point(2, 0);
    Graph<E> graph = createGraph();

    Graphs.addPath(graph, a, b, c, a);
    //    System.out.println(graph.getConnections());
    if (WRITE_TO_FILE) {
View Full Code Here

  }

  @Test
  public void testSimplify3() {
    Graph<E> graph = createGraph();
    Point a, b, c, d, e, f;
    a = new Point(0, 0);
    b = new Point(1, 0);
    c = new Point(2, 0);
    d = new Point(6, 0);
    e = new Point(6, 2);
    f = new Point(2, 2);
    Graph<E> out;
    //    Graphs.addPath(graph, a, b, c, d, e, f);
    //    DotUtils.saveToDot(graph, "files/test/mapfixer/simplify-3-in");
    //    Graph out = MapFixer.simplify(graph);
    //    DotUtils.saveToDot(out, "files/test/mapfixer/simplify-3-out");
View Full Code Here

    assertEquals(12.0, out.connectionLength(a, f), 0.0002);
  }

  @Test
  public void testIsContractableZero() {
    Point a, b, c;
    Graph<E> graph = createGraph();
    a = new Point(0, 0);
    b = new Point(1, 0);
    c = new Point(2, 0);

    Graphs.addPath(graph, a, b, c);
    if (WRITE_TO_FILE) {
      DotUtils.saveToDot(graph, "files/test/mapfixer/contractable-zero-1", true);
    }
    assertEquals(MapPreprocessor.ContractType.RIGHT, MapPreprocessor.isContractable(graph, a, b));
    assertEquals(MapPreprocessor.ContractType.LEFT, MapPreprocessor.isContractable(graph, b, a));
    assertEquals(MapPreprocessor.ContractType.LEFT, MapPreprocessor.isContractable(graph, b, c));
    assertEquals(MapPreprocessor.ContractType.RIGHT, MapPreprocessor.isContractable(graph, c, b));

    Graphs.addPath(graph, c, b, a);
    if (WRITE_TO_FILE) {
      DotUtils.saveToDot(graph, "files/test/mapfixer/contractable-zero-2", true);
    }
    assertEquals(MapPreprocessor.ContractType.RIGHT, MapPreprocessor.isContractable(graph, a, b));
    assertEquals(MapPreprocessor.ContractType.LEFT, MapPreprocessor.isContractable(graph, b, a));
    assertEquals(MapPreprocessor.ContractType.LEFT, MapPreprocessor.isContractable(graph, b, c));
    assertEquals(MapPreprocessor.ContractType.RIGHT, MapPreprocessor.isContractable(graph, c, b));

    Point d = new Point(3, 0);
    graph.addConnection(b, d);
    if (WRITE_TO_FILE) {
      DotUtils.saveToDot(graph, "files/test/mapfixer/contractable-zero-3", true);
    }
    assertEquals(MapPreprocessor.ContractType.NO, MapPreprocessor.isContractable(graph, a, b));
View Full Code Here

  }

  @Test(expected = IllegalArgumentException.class)
  public void testIsContractableIllegal() {
    Point a, b, c;
    Graph<E> graph = createGraph();
    a = new Point(0, 0);
    b = new Point(1, 0);
    c = new Point(2, 0);

    Graphs.addPath(graph, a, b, c);
    assertEquals(MapPreprocessor.ContractType.NO, MapPreprocessor.isContractable(graph, a, c));
  }
View Full Code Here

    assertEquals(MapPreprocessor.ContractType.NO, MapPreprocessor.isContractable(graph, a, c));
  }

  @Test
  public void testIsContractableOneAndOne() {
    Point a, b, c, d;
    Graph<E> graph = createGraph();
    a = new Point(0, 0);
    b = new Point(1, 0);
    c = new Point(2, 0);
    d = new Point(3, 0);

    Graphs.addPath(graph, a, b, c, d);
    if (WRITE_TO_FILE) {
      DotUtils.saveToDot(graph, "files/test/mapfixer/contractable-one-and-one-1", true);
    }
View Full Code Here

  }

  @Test
  public void testIsContractableMoreThanOne() {
    Point a, b, c, d, e, f;
    Graph<E> graph = createGraph();
    a = new Point(0, 0);
    b = new Point(1, 0);
    c = new Point(2, 0);
    d = new Point(3, 0);
    e = new Point(4, 0);
    f = new Point(5, 0);

    Graphs.addPath(graph, a, c, d, f);
    Graphs.addPath(graph, a, b, c);
    if (WRITE_TO_FILE) {
      DotUtils.saveToDot(graph, "files/test/mapfixer/contractable-more-than-one-1", true);
View Full Code Here

TOP

Related Classes of rinde.sim.core.graph.Point

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.