Stefka Bouyuklieva, Iliya Bouyukliev, Valentin Bakoev, Maria Pashinska-Gadzheva
{"title":"Generating m-Ary Gray Codes and Related Algorithms","authors":"Stefka Bouyuklieva, Iliya Bouyukliev, Valentin Bakoev, Maria Pashinska-Gadzheva","doi":"10.3390/a17070311","DOIUrl":null,"url":null,"abstract":"In this work, we systematize several implementations of the Gray code over an alphabet with m≥2 elements, which we present in C code so that they can be used directly after copying from the text. We consider two variants—reflected and modular (or shifted) m-ary Gray codes. For both variants, we present the ranking and unranking functions, as well as algorithms for generating only a part of the code, more precisely the codewords between two given vectors. Finally, we give algorithms that generate a maximal set of non-proportional vectors of length n over the given alphabet in a Gray code.","PeriodicalId":7636,"journal":{"name":"Algorithms","volume":null,"pages":null},"PeriodicalIF":1.8000,"publicationDate":"2024-07-13","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Algorithms","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.3390/a17070311","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q3","JCRName":"COMPUTER SCIENCE, ARTIFICIAL INTELLIGENCE","Score":null,"Total":0}
引用次数: 0
Abstract
In this work, we systematize several implementations of the Gray code over an alphabet with m≥2 elements, which we present in C code so that they can be used directly after copying from the text. We consider two variants—reflected and modular (or shifted) m-ary Gray codes. For both variants, we present the ranking and unranking functions, as well as algorithms for generating only a part of the code, more precisely the codewords between two given vectors. Finally, we give algorithms that generate a maximal set of non-proportional vectors of length n over the given alphabet in a Gray code.
在这项工作中,我们对字母表上 m≥2 个元素的格雷码的几种实现方法进行了系统化,并用 C 代码将其呈现出来,以便从文本中复制后直接使用。我们考虑了两种变体--反射式和模块式(或移位式)m-ary 格雷码。对于这两种变体,我们都给出了排序和取消排序的函数,以及只生成部分代码的算法,更确切地说,是两个给定向量之间的码字。最后,我们给出了在给定字母表上生成最大长度为 n 的非比例向量集的格雷码算法。