itacart.hierarchy.is_ancestor

itacart.hierarchy.is_ancestor(parent_index, child_index)[source]

Whether one cell contains another in the hierarchy.

Strict, so a cell is not its own ancestor; the reflexive relation is contains(). A predicate over index strings that never consults geometry: the union of a cell’s children was measured to overrun the cell itself by about one part in a thousand, because the domain border is curved and each cell approximates it by a chord, so a geometric test would disagree at the border with the index that addresses the cell.

Parameters:
  • parent_index (str) – Candidate ancestor, a single atomic index.

  • child_index (str) – Candidate descendant, a single atomic index.

Return type:

bool

Returns:

True if parent_index is a strict prefix of child_index.