This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Line { | |
private final String name; | |
private final int time; | |
Line( String name,int time ) { | |
this.name = name; | |
this.time = time; | |
} | |
public String getName() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jgrapht.Graph; | |
import org.jgrapht.GraphPath; | |
import org.jgrapht.graph.WeightedMultigraph; | |
import org.jgrapht.alg.interfaces.ShortestPathAlgorithm.SingleSourcePaths; | |
import org.jgrapht.alg.shortestpath.DijkstraShortestPath; | |
public class ShortestPath { | |
public static void main( String args[] ) { | |
// グラフオブジェクトを作成 | |
Graph<Station,Line> graph = new WeightedMultigraph<>(Line.class); |
OlderNewer