Version: latest
agrag.common.data_models.structure.ancestors
ancestors(sections:list[DocumentSection], index:int) -> list[int]
Return the index of a section and of each section above it.
Parameters:
- sections (
list[DocumentSection]) – The sections of a document. - index (
int) – The index of the section.
Returns:
list[int]– The indexes from the outermost ancestor down to the section itself.
Raises:
ValueError– The index is outsidesections, or the parent links form a cycle or leavesections.