1 25 41 package org.jgrapht.alg; 42 43 import java.util.*; 44 45 import org.jgrapht.*; 46 import org.jgrapht.graph.*; 47 48 49 54 public class DijkstraShortestPathTest 55 extends ShortestPathTestCase 56 { 57 58 60 63 public void testConstructor() 64 { 65 DijkstraShortestPath<String , DefaultWeightedEdge> path; 66 Graph<String , DefaultWeightedEdge> g = create(); 67 68 path = 69 new DijkstraShortestPath<String , DefaultWeightedEdge>( 70 g, 71 V3, 72 V4, 73 Double.POSITIVE_INFINITY); 74 assertEquals( 75 Arrays.asList(new DefaultEdge [] { 76 e13, 77 e12, 78 e24 79 }), 80 path.getPathEdgeList()); 81 assertEquals(10.0, path.getPathLength(), 0); 82 83 path = 84 new DijkstraShortestPath<String , DefaultWeightedEdge>( 85 g, 86 V3, 87 V4, 88 7); 89 assertNull(path.getPathEdgeList()); 90 assertEquals(Double.POSITIVE_INFINITY, path.getPathLength(), 0); 91 } 92 93 protected List findPathBetween( 94 Graph<String , DefaultWeightedEdge> g, 95 String src, 96 String dest) 97 { 98 return DijkstraShortestPath.findPathBetween(g, src, dest); 99 } 100 } 101 | Popular Tags |