#iterator #algorithm #graph-traversal #tree-traversal #line-segment

shiftnanigans

This library contains different iteration data structures for either iterating or for shifting iteratively forward and backward

1 unstable release

0.3.3 Jun 7, 2023
0.3.2 Apr 30, 2023
0.3.1 Mar 29, 2023
0.3.0 Mar 29, 2023

#1030 in Data structures

Download history 76/week @ 2024-01-02 93/week @ 2024-01-09 89/week @ 2024-01-16 76/week @ 2024-01-23 79/week @ 2024-01-30 40/week @ 2024-02-06 47/week @ 2024-02-13 75/week @ 2024-02-20 74/week @ 2024-02-27 99/week @ 2024-03-05 102/week @ 2024-03-12 137/week @ 2024-03-19 126/week @ 2024-03-26 119/week @ 2024-04-02 96/week @ 2024-04-09 105/week @ 2024-04-16

462 downloads per month

MIT/Apache

645KB
11K SLoC

Shiftnanigans

This crate contains useful, generic, commonly needed functionality, data structures, and algorithms for iterating sequentially forward and backward via "shifting". These "shifters" allow for controlled traversal of tree-like data structures in a manner that permits easier detection of fast-failing scenarios, rather than checking collections of items.

Features

Shifters

  • SegmentPermutationShifter
    • Transforms unpositioned line segments into localized line segments
  • IndexShifter
    • Traverses a tree-like structure of items, indexing over them
  • ScalingSquareBreadthFirstSearchShifter
    • Progressively shifts over all possible depths of the internal tree of integers, only permitting reaching deeper children after first iterating over all permutations of children closer to the root in a square-like pattern
  • ShiftingSquareBreadthFirstSearchShifter
    • Similar to the ScalingSquareBreadthFirstSearchShifter, but the integers are now the items at the respective index
  • HyperGraphClicheShifter
    • Returns the fully connected cliche graphs as they exist in the provided hypergraph, but each stateful node is provided singularly as the shifter is traversed over

Incrementers

  • BinaryDensityIncrementer
    • Returns a collection of boolean values such that each subsequent iteration increases the total number of ones progressively starting from having zero true values to having all true values
  • BinaryValueIncrementer
    • Returns the binary representation of all integers from zero to the provided maximum power of two based on the provided length
  • LimitedIncrementer
    • A wrapper over another incrementer, only permitting a certain number of iterations as provided to the constructor
  • RoundRobinIncrementer
    • A wrapper over other incrementers that traverses around to each incrementer internally, giving each a chance to return a sequence of items
  • ShifterIncrementer
    • A wrapper over a shifter that traverses iteratively in a depth-first search pattern
  • ShiftingCellGroupDependencyIncrementer
    • A rather complex incrementer that compares groups of cell (pixels) to each other, disallowing overlaps (specific and general), and ensuring adjacency between non-wall cell groups and wall cell groups

PixelBoard

  • PixelBoardRandomizer
    • When provided a PixelBoard, it randomizes where the pixels (cell groups) are located while avoiding overlap and maintaining adjacency between detected cell groups

Usage

Coming soon

Examples

None (at the moment)

Dependencies

~1.5MB
~33K SLoC