In this algorithm,
is a set of cells being processed, while
is a set of cells to be processed in the next iteration.
is the ``level'' of cells, or the distance from a destination.
is the initial set of destination cells.
is a set of
reachable neighbors of cell
.
is the value assigned to
cell
,
is undefined for all cells initially.