Return to App by Caleb Evans

B-Sketcher Instructions

Introduction

B-Sketcher is a tool for drawing static B-trees and B+ trees. This means that you are still responsible for knowing how to properly add keys to your B-tree; this tool merely aids in drawing the B-trees you create.

Defining the tree

To draw a B-tree with this tool, you must first define it. To begin, choose whether this tree is a B-Tree or a B+ Tree via the respective dropdown menu. Then, enter the value of m (number of pointers per node) for the tree you wish to draw. Finally, you must provide the description of the tree in the following format:

  1. Rows in the tree are separated by blank lines
  2. Nodes on the same row are separated by forward slashes (/)
  3. Keys are represented as numbers or Unicode strings
  4. Keys on the same node are separated by commas

B-tree example (m = 4)

26
8, 20, 22 / 28, 55
2 / 15 / 21 / 23, 24, 25 / 27 / 51 / 71, 80
B-tree rendered image

B+ tree example (m = 3)

5
3 / 7, 8
1, 3 / 5 / 6, 7 / 8 / 9, 12
B+ tree rendered image

If you need the leaf nodes of your B+ tree to be doubly-linked, then check the "Doubly-linked?" checkbox.

B+ tree (doubly-linked) rendered image

Drawing the tree

Once you've set m and you've correctly entered your tree description, press the button to draw the tree. You can also press command-enter or ctrl-enter while an input field is focused to draw the tree.

Exporting the tree

When you're finished defining your tree, you can export it to a PNG image using the button. You can then follow the on-screen instructions to either copy/paste the image, or save it to your device.