Implemented Simplified Greedy Search Algorithm for Public Transport Routing#29
Merged
Implemented Simplified Greedy Search Algorithm for Public Transport Routing#29
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements a simplified greedy search algorithm for public transport routing with supporting API endpoints and a basic interactive map for testing the route display.
- Introduces the SimpleGreedySearch algorithm and associated route-building logic.
- Adds new URL routes, views, and templates for routing and map testing.
- Updates dependency configuration to include networkx.
Reviewed Changes
Copilot reviewed 15 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Adds networkx dependency for graph operations. |
| logicway/routing/views.py | Implements API view for transit routing. |
| logicway/routing/urls.py | Adds URL routing for the transit route API. |
| logicway/routing/typedef.py | Provides type definitions for routing segments. |
| logicway/routing/simple_greedy_search.py | Implements the greedy search algorithm. |
| logicway/map/views.py & logicway/map/urls.py | Introduces map views and associated endpoints. |
| logicway/map/templates/map/map4test.html | Provides a test map template. |
| logicway/map/static/map/js/map4test.js | Contains map initialization and route logic. |
| logicway/logicway/urls.py | Integrates routing URL patterns into main URLs. |
| logicway/database/views.py | Refactors stop and route retrieval into helper functions. |
Files not reviewed (3)
- http-client.env.json: Language not supported
- logicway/map/api_manual_testing.http: Language not supported
- logicway/routing/tests.http: Language not supported
Comments suppressed due to low confidence (1)
logicway/routing/simple_greedy_search.py:92
- [nitpick] The loop variable 'start_stop' shadows the earlier usage of the same name for the chosen start stop. Consider renaming the loop variable to something like 'current_start_stop' to improve clarity.
for start_stop, _ in start_stops:
| to_stop=Point(lat=end_lat, lon=end_lon) | ||
| )] | ||
|
|
||
| def __del__(self): |
There was a problem hiding this comment.
[nitpick] Relying on del to close the database session may not guarantee timely resource release. Consider using a context manager or explicit session management to ensure proper closing of the connection.
Suggested change
| def __del__(self): | |
| def __enter__(self): | |
| return self | |
| def __exit__(self, exc_type, exc_value, traceback): |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.