Skip to content

A Huffman encoding visualizer developed in Go, utilizing the m1gwings's treedrawer library. This tool provides a hands-on way to explore the inner workings of Huffman coding, making it an excellent resource for learning about data compression techniques.

Notifications You must be signed in to change notification settings

ml3m/Huffman-encoding-visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Huffman Encoding Visualizer

The Huffman Encoding Visualizer is a Go-based tool designed to visualize the Huffman encoding process. Utilizing the treedrawer library by m1gwings, this project allows users to explore the intricacies of Huffman coding, a popular algorithm for data compression.

Example Usage

Usage

To run the Huffman Encoding Visualizer, execute the following command in your terminal:

go run main.go <input_file> [--codes | --count | --tree]

Arguments

<input_file>: The path to a text file that contains the input data. The first line of the file will be read as the input string for Huffman encoding.

Flags

--codes: Displays the Huffman codes for each character in the input text.

--count: Displays the occurrence count of each character in the input text.

--tree: Visualizes the Huffman tree structure.

Requirements and Dependencies

Go 1.16 or later The github.com/m1gwings/treedrawer/tree package for visualizing the Huffman tree. Example Input File Make sure your input file (e.g., input.txt) contains text formatted as follows:

Make sure you add Dependencies:

go get github.com/m1gwings/treedrawer/tree

Example Commands

Display Huffman Codes:

go run main.go input.in --codes

This command will output the Huffman codes generated for each character based on the input text in input.txt.

Display Character Occurrences:

go run main.go input.in --count

This command will print the frequency of each character present in the input text.

Visualize the Huffman Tree:

go run main.go input.in --tree

This command will create a visual representation of the Huffman tree based on the input text.

About

A Huffman encoding visualizer developed in Go, utilizing the m1gwings's treedrawer library. This tool provides a hands-on way to explore the inner workings of Huffman coding, making it an excellent resource for learning about data compression techniques.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages