@@ -92,6 +92,8 @@ class TreeIndex:
92
92
This class provides efficient forward and backward iteration through
93
93
the trees in a tree sequence. It provides the tree interval,
94
94
edge changes to create the current tree, along with its sites and mutations.
95
+ A full pass over the trees using repeated `next` or `prev` requires O(E + M + S) time
96
+ complexity.
95
97
96
98
It should not be instantiated directly, but is returned by the `tree_index` method
97
99
of `NumbaTreeSequence`.
@@ -447,7 +449,9 @@ def tree_index(self):
447
449
448
450
def child_index (self ):
449
451
"""
450
- Create child index array for finding child edges of nodes.
452
+ Create child index array for finding child edges of nodes. This operation
453
+ requires a linear pass over the edge table and therefore has a time
454
+ complexity of O(E).
451
455
452
456
:return: A numpy array (dtype=np.int32, shape=(num_nodes, 2)) where each row
453
457
contains the [start, stop) range of edges where this node is the parent.
@@ -475,7 +479,9 @@ def child_index(self):
475
479
476
480
def parent_index (self ):
477
481
"""
478
- Create a :class:`ParentIndex` for finding parent edges of nodes.
482
+ Create a :class:`ParentIndex` for finding parent edges of nodes. This
483
+ operation requires sorting the edges by child ID and left coordinate,
484
+ and therefore requires O(E log E) time complexity.
479
485
480
486
:return: A new parent index container that can be used to
481
487
efficiently find all edges where a given node is the child.
0 commit comments