You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit adds one-directional A* pathfinding; it also adds an
image to aid with one of the explanations. I wasn't 100% confident on
where these types of images should reside.
I also noticed this dijkstra pathfinding algorithm rechecks nodes in the
open list many times. I left it because dijkstra is mostly just an example
algorithm (though you do use similiar algorithms for precomputing paths).
I did change it to name the dict so it's slightly easier to read.
* docs/Pathfinding.rst - Add astar documentation
+ imgs/onedirectionalastar_riverexample.png - referenced in comments
* pygorithm/pathfinding/__init__.py - add astar
+ pygorithm/pathfinding/astar.py - add one-directional astar
* pygorithm/pathfinding/dijkstra - add comments on reverse_path
* tests/test_pathing - add timing tests. This is the same test as before
but such a way that it can be reused for all graph-based pathfinding
algorithms. This method won't work for smarter algorithms like Theta*
because they won't work on these style of graphs (there require additional
assumptions like a square or octogonal grid), but the TimedTestCase is
reusable.
I updated the test to check based on total weight rather than a specific
path which is more accurate to what is being tested. This indirectly
ensures that there is a way between each node in the path (otherwise
get_edge_weight would return None and an exception would be raised).
- **pygorithm.data_structures.WeightedUndirectedGraph** : acts like an object with `graph` and `get_edge_weight` (see WeightedUndirectedGraph)
87
+
- **vertex** : any hashable type for the start of the path
88
+
- **vertex** : any hashable type for the end of the path
89
+
- **function** : `function(graph, vertex, vertex)` returns numeric - a heuristic function for distance between two vertices
90
+
- **Return Value** : returns a `List` of vertexes (of the same type of the graph) starting from from and going to to. This algorithm respects weights, but is only guarranteed to be optimal if the heuristic is admissable. An admissable function will never *overestimate* the cost from one node to another (in other words, it is optimistic).
0 commit comments