Skip to content
Ron Fredericks edited this page Dec 13, 2013 · 8 revisions

Welcome to the visualizeTree wiki!

The project home page is located here: http://www.embeddedcomponents.com/blogs/2013/12/visualizing-software-tree-structures/

Initial comments in source code

Animate a Binary Search Tree using Python, GraphViz, and ffmeg utility Input: A binary search tree with a known root node Output: This demo sofware presents two forms of graphic animation, 1) A png graphic image file showing the tree structure, or 2) A series of png images to create video animations.

Project home: http://www.embeddedcomponents.com/blogs/2013/12/visualizing-software-tree-structures/

Inspired by MITx 6.00.1x "Introduction to Computer Science and Programming" As taught by Professor Eric Grimson, Chairman of EECS Department, MIT Fall 2013, http://www.edx.org

Developed by Ron Fredericks, Video Technologist, at LectureMaker LLC, http://www.LectureMaker.com MIT License, Copyright (c) 2013, Ron Fredericks Free to use following these terms: http://opensource.org/licenses/MIT

This project allows you to do the following:

  1. design any searchable tree class, then instantiate the tree with data, see "class binaryTree(object)" in this demo.
  2. Use the provided "class visualizeTree(object)" to create a PNG image of the tree as well as to create a sequence of PNG images for use in generating a video of the search path. 2-a) Helper functions "DFS()" and "BFS()" can be used to animate searching the tree by depth or breadth, or use the code to create your own helper functions to test your own search algorithms.
  3. The code completes with a PNG graphical display of the last image generated by this program, to help you determine if this run of the program is useful for creation of mpeg4 video.
  4. Generate an mpeg-4 video using the PNG image sequence generated by the "visualizeTree object", Command line example (use double "%%" if this command is in a Windows batch file): ffmpeg -f image2 -r 1 -start_number 00001 -i bst_graph%05d.png -vcodec mpeg4 -r 12 -y movie.mp4

The following free open source programs should be installed on your computer: GraphViz: Graph visualization tool: http://www.graphviz.org/ FFmpeg: Cross-platform solution to record, convert and stream audio and video: http://www.ffmpeg.org/

The following python module should be installed into your environment: pydot: a python interface to Graphvize's Dot language: https://code.google.com/p/pydot/

The following phyton modules are used for display of individual PNG images: Tkinter: standard python GUI: https://wiki.python.org/moin/TkInter Image and ImageTk: the python image library: http://www.pythonware.com/products/pil/

Clone this wiki locally