Open 9bcdc8ae-e33c-4bbe-ae30-d4371d8a45d0 opened 6 years ago
For a given frequency distribution, Huffman code is not unique. May be you are expecting a canonical Huffman code ?
Oh ok, it's my fault.
However, is there any way to re-create the same Huffman code from the existing Huffman object?
Maybe should i replace the _tree and the _index of the new object, it is right?
Thanks.
Replying to @dcoudert:
For a given frequency distribution, Huffman code is not unique. May be you are expecting a canonical Huffman code ?
I don't understand what you want to do. You should ask on https://ask.sagemath.org/, it's the right place for such questions.
Way to reproduce:
Sage version:
I think the problem is with enumerate and items calls inside the _build_code function of Huffman class because there is no a standard order of the elements.
Component: coding theory
Keywords: Huffman
Issue created by migration from https://trac.sagemath.org/ticket/25798