shortest_path¶
- gtravyl.shortest_path(grid: ~numpy.ndarray[tuple[~typing.Any, ...], ~numpy.dtype[~numpy._typing._array_like._ScalarT]], si: tuple[int, int] | None = None, ti: tuple[int, int] | None = None, sv: ~typing.Any | None = None, tv: ~typing.Any | None = None, neighbors=<function vn_neighbors>, allowed=<function not_one>, wrap=<function no_wrap>, dist=<function unit_dist>, heuristic=<function no_heuristic>) list[tuple[int, int]]¶
Find shortest path from
stotin a given grid.- Parameters:
grid – grid (2d array) representation of the world to traverse.
si – The “source” index, i.e. where the path search starts.
ti – The “destination” index, i.e. where the path should end.
sv – The “source” value, i.e. the value of the start index.
tv – The “destination” value, i.e. the value of the end index.
neighbors – Computes the neighborhood of any choice of index in the grid.
wrap – Does the grid wrap around. Defaults to no wrap.
dist – The distance function used. Defaults to unit distance.