itacart.topology.grid_ring

itacart.topology.grid_ring(index, k_distance=1, metric='chebyshev', dedupe=False, flatten=False)[source]

Cells at exactly k grid steps, the hollow shell of a disk.

Parameters:
  • index (str) – Compositional index string.

  • k_distance (int, default: 1) – Ring radius in grid steps.

  • metric (Literal['chebyshev', 'manhattan'], default: "chebyshev") – Lattice metric to expand under.

  • dedupe (bool, default: False) – Drop cells shared between rings of different origins.

  • flatten (bool, default: False) – Return one flat list instead of one list per origin.

Return type:

list[str] | list[list[str]]

Returns:

A cell list for a single origin, or a positionally aligned list of lists. A ring of radius zero is the origin alone.

Raises:
  • ValueError – If k_distance is negative or metric is unknown.

  • DomainError – If the ring reaches the geometric exception set.

  • NonExistentCellError – If any cell of the index names no cell. The predicate is the arbiter and the contract ends there: a spelling it denies is refused rather than answered for the cell it would otherwise fold onto.