Git Product home page Git Product logo

rbtree-gif's Introduction

Visualization of a red-black tree data structure

This project aims at visualizing the different rebalancing steps that happen during insertions and deletions in a binary search tree of red-black type. The rbtree.c contains a simple version of the red-black tree data structure, and main.c is the program that does insertions and deletions step-by-step and then outputs a series of dot files which can then be converted into a nice gif using dot_to_gif.sh.

dot_to_gif.sh was initially meant to help me debug my red-tree rebalancing algorithm. It uses dot (from graphviz) and convert (from imagemagick). The script translates a series of .dot files into a single .gif by making a small readjustment of the nodes so that it looks good. Readjustments are made by a script written by Emden R. Gansner(stackoverflow).

This project is the result of a home assignment I had for the course "Data Structures" during my second year of computer science at Université de Toulouse III - Paul Sabatier. A special thank you to Professor Mathias Paulin for his excellent teachings.

Animation of the behavior of a red-black search tree

Instructions for generating the gif

To test all of this, do:

sudo apt install graphviz # Linux
brew install graphviz     # macOS

make
./rbtree_to_dot -d point -r "step_"
./dot_to_gif.sh $ (find dot -name "* .dot" | sort -n -t_ -k2)

The file animation.gif will get generated (similar as to the one above) can be opened! An example of it is displayed at the top of this readme.

rbtree-gif's People

Contributors

maelvls avatar

Stargazers

 avatar

Watchers

 avatar  avatar  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.