#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

#1531 in Algorithms

Download history 23/week @ 2024-07-21 34/week @ 2024-07-28 2/week @ 2024-08-04 11/week @ 2024-08-11 14/week @ 2024-08-18 33/week @ 2024-08-25 32/week @ 2024-09-01 31/week @ 2024-09-08 17/week @ 2024-09-15 26/week @ 2024-09-22 21/week @ 2024-09-29 8/week @ 2024-10-06 50/week @ 2024-10-13 34/week @ 2024-10-20 8/week @ 2024-10-27 13/week @ 2024-11-03

106 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