public static void BFS(string End) { if (queue.Count() == 0) { return; } Tuple <String, Route> tuple = queue.Dequeue(); Vertex vertex = g.getVertex(tuple.Item1); Route route = tuple.Item2; if (vertex.Equals(g.getVertex(End))) { isFound = true; } if (!isFound) { /* 현재 vertex에서 이동 가능한 vertex들을 모드 Queue에 추가함 */ foreach (Edge e in vertex.getAdjList()) { //queue.Enqueue(g.getVertex(e.getTo())); Route newRoute = new Route(route); if (e.weight <= 0) { continue; } newRoute.AddRoute(e); Tuple <String, Route> nextTuple = new Tuple <String, Route>(e.to, newRoute); queue.Enqueue(nextTuple); } } else if (isFound) { if (MAXOFMIN < route.getMinEdge()) { MAXOFMIN = route.getMinEdge(); lastRoute = route; } } route.printRoute(); BFS(End); }
public Route(Route route) { this.minEdge = Math.Min(minEdge, route.getMinEdge()); _route = route.copyRoute(); }