#subset #gray #codes

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

#1732 in Algorithms

Download history 45/week @ 2023-11-20 35/week @ 2023-11-27 131/week @ 2023-12-04 85/week @ 2023-12-11 84/week @ 2023-12-18 32/week @ 2024-01-01 7/week @ 2024-01-08 15/week @ 2024-01-15 38/week @ 2024-01-22 36/week @ 2024-01-29 15/week @ 2024-02-05 36/week @ 2024-02-12 44/week @ 2024-02-19 137/week @ 2024-02-26 121/week @ 2024-03-04

339 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