fix: address code review findings
This commit is contained in:
@@ -418,7 +418,7 @@ func (g *Graph) FindRoute(originID, destID string, opts SearchOptions, closedSta
|
||||
newDurationWithMCT := newDuration + transferTime
|
||||
|
||||
// Check if we've visited this node with fewer transfers
|
||||
visKey := current.nodeID
|
||||
visKey := nextNode.ID
|
||||
if existingTransfers, ok := visited[visKey]; ok {
|
||||
if current.transfers+1 > existingTransfers {
|
||||
// Already visited this node with fewer transfers, skip
|
||||
@@ -880,7 +880,7 @@ type SearchResult struct {
|
||||
// route in all three metrics simultaneously. Routes are sorted according to the RankingMode
|
||||
// in SearchOptions: "fastest" (default, by duration), "fewest_transfers" (by transfers),
|
||||
// or "cheapest" (by cost).
|
||||
func (g *Graph) FindRoutesPareto(originID, destID string, opts SearchOptions) []*Itinerary {
|
||||
func (g *Graph) FindRoutesPareto(originID, destID string, opts SearchOptions, closedStations map[string]bool, neighbors map[string][]storage.StationNeighbor) []*Itinerary {
|
||||
// Run multiple searches with different strategies to find diverse routes
|
||||
var allItineraries []*Itinerary
|
||||
|
||||
@@ -889,7 +889,7 @@ func (g *Graph) FindRoutesPareto(originID, destID string, opts SearchOptions) []
|
||||
optsCopy := opts
|
||||
optsCopy.MaxTransfers = maxTransfers
|
||||
|
||||
result := g.FindRoute(originID, destID, optsCopy, nil, nil)
|
||||
result := g.FindRoute(originID, destID, optsCopy, closedStations, neighbors)
|
||||
if result != nil && result.TotalDuration > 0 {
|
||||
allItineraries = append(allItineraries, result)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user