5.22

周三

public static String shortest(User user) {

Connection connection = JDBCUtils.getConn();
String startingStation = user.getStarting_Station();
String terminusStation = user.getTerminus_Station();

// 1. 构建站点名称到ID的映射
Map<String, Integer> stationIdMap = buildStationIdMap();

// 2. 构建邻接矩阵
int[][] adjacencyMatrix = adjacency();

// 3. 计算最短路径长度
int shortestPathLength = calculateShortestPath(adjacencyMatrix, startingStation, terminusStation, stationIdMap);

System.out.println(shortestPathLength+startingStation+"erhjhgfdshjhgfds");

// 返回结果,这里可以根据需要将结果转换为字符串
return "Shortest path length from " + startingStation + " to " + terminusStation + " is: " + shortestPathLength;



}
posted @   yblll  阅读(5)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示