TOC Toolkit API - v0.1.0
    Preparing search index...

    toc-toolkit/structures

    The data structures and graph searches that the algorithms of the workspace share. Each structure works on dense integer ids. Structures that grow take an optional Budget and charge Resource.Cells.

    • Breadth-first reachability. Returns the roots and every node reachable from them in search order, in time linear in the nodes and edges. (reachableFrom)
    • Strongly connected components. Groups the nodes of a graph into components, listed in reverse topological order, using an explicit stack so that long paths do not overflow. (stronglyConnectedComponents)
    • Union-find. Keeps a partition of the integers into disjoint sets, with amortized inverse Ackermann time for find and union. It keeps its parents and ranks in typed arrays of the capacity that the caller states. (UnionFind)
    • Partition. Blocks of integers that a caller splits by marking members, with a refine that cuts each marked block in time linear in its marked members. (Partition)
    • Splitter queue. A bounded first-in first-out queue of distinct integers, which refinements use to hold the splitters that are still to run. (SplitterQueue)
    • Binary heap. A priority queue ordered by a comparator, with logarithmic push and pop. (BinaryHeap)
    • Bit set. A fixed-capacity set of integers with union, intersection, equality and a canonical key. (BitSet)
    • Sparse set. A fixed-capacity set that iterates in insertion order and also yields members added during the loop, so it serves as a work list and a visited set. (SparseSet)
    • Interner. Gives equal values the same dense id. (Interner)
    • Tuple table. Interns tuples of one arity. (TupleTable)
    • Tuple interner. Gives equal values the same dense id, where two values are equal when their tuples of integers are equal, so a hot loop builds no string key. (TupleInterner)
    • Cons pool. Hash-consed immutable lists with constant-time head, tail and length. (ConsPool)
    • Sequence pool. Immutable sequences that grow at the back and shrink at the front. (SequencePool)