Expand description
Walking a chain: from a start, on to the one next node, and the one after that, until the chain closes, ends, or runs into itself — a loop of coedges followed round its face, a tangent chain of edges, the arcs of one circle, a sketch’s curves joined end to end, a pattern’s joints driving each other.
What comes next is the caller’s (next, which may refuse with an error
where the chain forks); the walk promises to tell the three ways a chain
can end apart, and to end: no node is walked twice, so a walk over
finitely many nodes ends after at most that many steps, whatever next
does. A chain that runs into itself somewhere other than its start is
reported as such, never followed round again.
flood is the walk of a graph rather than a chain: from some nodes to
every node reachable from them, each visited once.
Structs§
- Walk
- A walk: its nodes in order, the start first, and how it ended.
Enums§
Functions§
- flood
- Visits
startsand every node reachable from them, each once:visitis asked for each node in turn, and hands on its neighbours, in order; a node not handed on before joins the pending ones, and which of those comes nexttakesays. Returns the nodes in the order visited. - walk
walk_byfor nodes that are their own keys.- walk_by
- Walks from
startalongnext: the node after each, orNonewhere there is none. Nodes are told apart bykey: a node with the key of the start closes the chain, one with the key of a node walked since runs into it.nextis asked once for each node, in order, so it may keep state of its own.