Giter Club home page Giter Club logo

huffman-tree-visualization's Introduction

Huffman-Tree-Visualization

哈夫曼树可视化 Huffman Tree Visualization

A tiny software visualizing how Huffman coding is generated, written in Python plus C++:

  • Special arrangement of node posistions for better visualization effect.
  • Include an interactive interface that shows the dynamic process.
  • Use C++ for low-level calculations.

使用 Python和 C++ 开发,动态展示哈夫曼编码的产生过程

  • 合理安排节点位置,使得节点间的位置展示不冲突
  • 使用 tkinter实现友好的交互界面,动态展示哈夫曼森林的变化
  • 底层使用C++实现,包括各步骤中各节点的位置等

可视化时保证节点不冲突的方法:

哈弗曼树的本质属于一种二叉树。考虑一棵满二叉树,最密集的节点分布在 其叶子节点一层。每一层节点个数成二的幂次递增。为了树形保证在任何情况下不会出现节点冲突,只需保证满二叉树最下层节点间距即可。

纵坐标直接使用简单的深度×单位长度,而横坐标通过维护哈弗曼树双亲节点的坐标和每一层的步长即可得到。如哈夫曼树深度为 n,则根节点横坐标为 $ 2^{n-1} $ ,第一层步长为 $ 2^n $ 。 每层步长减少一倍,直至叶子节点步长为 1。

huffman-tree-visualization's People

Contributors

lemon-412 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.