Exemplo n.º 1
0
  /** . */
  public void testConstructor() {
    DijkstraShortestPath<String, DefaultWeightedEdge> path;
    Graph<String, DefaultWeightedEdge> g = create();

    path =
        new DijkstraShortestPath<String, DefaultWeightedEdge>(g, V3, V4, Double.POSITIVE_INFINITY);
    assertEquals(Arrays.asList(new DefaultEdge[] {e13, e12, e24}), path.getPathEdgeList());
    assertEquals(10.0, path.getPathLength(), 0);

    path = new DijkstraShortestPath<String, DefaultWeightedEdge>(g, V3, V4, 7);
    assertNull(path.getPathEdgeList());
    assertEquals(Double.POSITIVE_INFINITY, path.getPathLength(), 0);
  }
Exemplo n.º 2
0
 protected List findPathBetween(Graph<String, DefaultWeightedEdge> g, String src, String dest) {
   return DijkstraShortestPath.findPathBetween(g, src, dest);
 }