#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

#1439 in Algorithms

Download history 16/week @ 2024-01-14 38/week @ 2024-01-21 36/week @ 2024-01-28 14/week @ 2024-02-04 36/week @ 2024-02-11 43/week @ 2024-02-18 137/week @ 2024-02-25 115/week @ 2024-03-03 104/week @ 2024-03-10 74/week @ 2024-03-17 31/week @ 2024-03-24 115/week @ 2024-03-31 118/week @ 2024-04-07 92/week @ 2024-04-14 42/week @ 2024-04-21 66/week @ 2024-04-28

331 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