LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I implement Huffman encoding trees?

Solved!
Go to solution

Greetings, 

 

This is my first time to the forum, I was hoping if anyone could help me out in generating 'Huffman Trees', I have already created a table that does the probability check for variable length coding, once the probabilities are added.

 

ThanksHuffman Table.PNG

0 Kudos
Message 1 of 3
(5,507 Views)
Solution
Accepted by topic author co2junkie_

@co2junkie_ wrote:

Greetings, 

 

This is my first time to the forum, I was hoping if anyone could help me out in generating 'Huffman Trees', I have already created a table that does the probability check for variable length coding, once the probabilities are added.

 

Thanks


Hey co2junkie_,

 

I've managed to produce a VI that can generate a string which defines the huffman tree from a given Frequency and Value 2D array, and I've fully documented the code to show the thought process and tools used in its production. This VI generates a string which is encoded to represent the full tree span, hopefully you'll be able to infer the Huffman Code required for a particular value from this string. I've never used a Huffman Tree before so I couldn't work out what sort of algorithm is required for it's implementation from the Front Panel you provided, so I used this website for reference; I hope this still suits your purpose even when created following this format. However if it doesn't suit your specification, I still firmly believe it will serve as a good guideline towards producing data which matches your specification. I've made sure that you can use double values as Frequency/Value input data similar to how you have usedin your example's arrays. If you wish to use this in a larger VI, you can just drag the icon from the connector pane located in the top right of the Front Panel/Block Diagram into your other block diagram.

 

Huffman Tree.png

 

Anyway, check out the VI I've attached, I hope the comments are clear enough although if you need to clarify any aspects of the code please ask away!


Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)

Message 2 of 3
(5,469 Views)
Thank you very much for your effort Sir, your vi did the job and documentation couldn't be more clear 🙂 thanks again.
0 Kudos
Message 3 of 3
(5,439 Views)