Version: latest
agrag.common.data_models.structure.common_ancestor
common_ancestor(sections:list[DocumentSection], indexes:list[int]) -> int | None
Return the lowest section that contains all the given sections.
Parameters:
- sections (
list[DocumentSection]) – The sections of a document. - indexes (
list[int]) – The indexes of the sections to contain. A section contains itself. Must not be empty.
Returns:
int | None– The index of the section, orNonewhen only the document contains them.
Raises:
ValueError–indexesis empty, or an index is outsidesections.