Skip to content

Commit 8540e35

Browse files
forest: some minor doc fixes
Co-authored-by: Codex <codex@openai.com>
1 parent dbf6fba commit 8540e35

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/forest.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ Check if there are any nodes in the forest. This function returns
143143
Reinitialize an existing :any:`Forest` object.
144144
145145
This function reinitializes an existing :any:`Forest` object so that it is in
146-
the same state as if it had just be constructed as ``Forest(n)``.
146+
the same state as if it had just been constructed as ``Forest(n)``.
147147
148148
:param n: the number of nodes, defaults to ``0``.
149149
:type n: int
@@ -218,8 +218,7 @@ then node *i* is a root node.
218218
thing.def("number_of_nodes",
219219
&Forest::number_of_nodes,
220220
R"pbdoc(
221-
Returns the number of nodes in the forest. Returns the number of nodes
222-
in the forest.
221+
Returns the number of nodes in the forest.
223222
224223
:returns:
225224
The number of nodes in the forest.
@@ -559,7 +558,7 @@ This function returns the number of paths in the range.
559558
R"pbdoc(
560559
Returns the underlying Forest object.
561560
562-
This function returns the :any:`Forest` object used to constructor or
561+
This function returns the :any:`Forest` object used to construct or
563562
initialise *self*.
564563
565564
:returns: A :any:`Forest` object.
@@ -744,18 +743,18 @@ does nothing.
744743
Range object for iterating through paths in a :any:`Forest`.
745744
746745
This class represents a range object that facilitates
747-
iterating through the paths from every node to the root of its subtree in a
746+
iterating through the paths from the root of each subtree to every node in a
748747
:any:`Forest` object. These nodes are taken in numerical order, so the first value
749748
returned by :any:`get` is the word to a root from node ``0``, after :any:`next`
750749
is called, :any:`get` returns the word to a root from node ``1``, and so on.
751750
The point of this class is to permit more efficient iteration over many paths
752751
in a :any:`Forest` object than :any:`path_from_root` (and its
753752
associated helper functions). :any:`path_from_root` traverses
754-
the :any:`Forest` from the given node to the root of its tree. If the path from
755-
nodes ``m`` and ``n`` to the root of their tree share a long common suffix, then
756-
this suffix will be traversed twice in two calls to :any:`path_from_root`.
753+
the :any:`Forest` from the root of a tree to a given node. If the paths to
754+
nodes ``m`` and ``n`` share a long common prefix, then this prefix will be
755+
traversed twice in two calls to :any:`path_from_root`.
757756
:any:`PathsFromRoots` avoids this by finding the least common ancestor of ``m`` and
758-
``n``, so that the suffix is not re-traversed. This works best when the nodes in
757+
``n``, so that the prefix is not re-traversed. This works best when the nodes in
759758
the :any:`Forest` are specified in a sensible order (such as via a depth-first or
760759
breadth-first traversal).)pbdoc");
761760

0 commit comments

Comments
 (0)