/bst_pretty_print_with-graphviz

Demonstration of how to visualize BST pretty-printing in Graphviz using the dot program. SEE: https://stevengharms.com/posts/2020-01-19-using-dot-to-help-visualize-data-structures-richly

Primary LanguageJavaScript

Demonstrate a Binary Search Tree Graphically

Graph to demonstrate node deletion

Motivation

When trying to test whether you've managed to figure out an algorithm's implementation, it's darn difficult to judge using standard console output tools. Here's a template for generating source files that can be used to visually validate that you're code Did The Right Thing.

Generate A Directed Graph File

npm -s run dev > simple.dot

...And turn it into a PDF

dot -Tpdf -o simple.pdf simple.dot

...And View It

open -a "Preview" simple.pdf

All-In-One

npm -s run dev > simple.dot && dot -Tpdf -o simple.pdf simple.dot && open -a "Preview" simple.pdf