Rollup merge of #93606 - JakobDegen:mischaracterized-preorder, r=oli-obk
Correct incorrect description of preorder traversals The internal documentation for the `Preorder` type gave an incorrect description (the description is not even correct for the example provided, since C is visited after one of its successors). This corrects the description, and adds in a sentence explaining more precisely how the traversals are performed.
This commit is contained in:
commit
38adea96c5
@ -4,8 +4,9 @@
|
|||||||
|
|
||||||
/// Preorder traversal of a graph.
|
/// Preorder traversal of a graph.
|
||||||
///
|
///
|
||||||
/// Preorder traversal is when each node is visited before any of its
|
/// Preorder traversal is when each node is visited after at least one of its predecessors. If you
|
||||||
/// successors
|
/// are familar with some basic graph theory, then this performs a depth first search and returns
|
||||||
|
/// nodes in order of discovery time.
|
||||||
///
|
///
|
||||||
/// ```text
|
/// ```text
|
||||||
///
|
///
|
||||||
@ -82,8 +83,9 @@ fn size_hint(&self) -> (usize, Option<usize>) {
|
|||||||
|
|
||||||
/// Postorder traversal of a graph.
|
/// Postorder traversal of a graph.
|
||||||
///
|
///
|
||||||
/// Postorder traversal is when each node is visited after all of its
|
/// Postorder traversal is when each node is visited after all of its successors, except when the
|
||||||
/// successors, except when the successor is only reachable by a back-edge
|
/// successor is only reachable by a back-edge. If you are familiar with some basic graph theory,
|
||||||
|
/// then this performs a depth first search and returns nodes in order of completion time.
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
/// ```text
|
/// ```text
|
||||||
|
Loading…
Reference in New Issue
Block a user