#gray #codes #subset

gray-codes

Iterators over binary Gray codes; utilities for efficiently visiting all subsets of a collection

2 releases

Uses old Rust 2015

0.1.1 Dec 3, 2017
0.1.0 Jul 19, 2017

#1512 in Algorithms

Download history 115/week @ 2024-03-11 56/week @ 2024-03-18 33/week @ 2024-03-25 113/week @ 2024-04-01 121/week @ 2024-04-08 90/week @ 2024-04-15 42/week @ 2024-04-22 64/week @ 2024-04-29 22/week @ 2024-05-06 37/week @ 2024-05-13 29/week @ 2024-05-20 15/week @ 2024-05-27 7/week @ 2024-06-03 39/week @ 2024-06-10 15/week @ 2024-06-17 28/week @ 2024-06-24

90 downloads per month

MIT/Apache

19KB
219 lines

Rust crate for Gray codes

This crate provides iterators over Gray codes as well as utilities for efficiently visiting all subsets of a collection. See the rustdoc for more details and examples.

This crate is published on the https://crates.io/ repository as the "gray-codes" crate.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

Gray code iterators and related utilities.

A Gray code is a reordering of the integers such that adjacent codes differ by exactly one bit.

The GrayCode{8,16,32,64} structs provide iterators over binary reflected Gray codes in various unsigned integer sizes as well as direct conversions to and from the codes. The Subsets struct provides a convenient way to iterate over subsets of a slice. The InclusionExclusion struct provides a building block for visiting all subsets more efficiently.

No runtime deps