GitHub - parthadevs/indextree: Interactive B-Tree and B+ Tree visualizer and implementation web app with customizable degrees, real-time operation steps, pseudocode tracking, and a sleek Shopify-inspired dark UI. · GitHub
Skip to content
parthadevsPublic

About

Interactive B-Tree and B+ Tree visualizer and implementation web app with customizable degrees, real-time operation steps, pseudocode tracking, and a sleek Shopify-inspired dark UI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

🌳 Index Tree Lab

An interactive, step-by-step visualizer for B-Trees and B+ Trees

Build, inspect, and replay every structural change that happens during insert, delete, and search operations one step at a time.

Next.js React TypeScript Tailwind CSS License

Live Demo · Features · Getting Started · Algorithm Details


📸 Preview

B+ Tree insert operation

B+ Tree insert operation step-through

B+ Tree search operation

B+ Tree search operation with leaf links

B+ Tree Delete operation

B+ Tree search operation with leaf links

🚀 Live Demo

🔗 indextree.vercel.app

No installation needed — open the link above and start building trees in the browser.


✨ Features

Category Details
🌲 Two tree structures Switch between B-Tree and B+ Tree modes
⚙️ Configurable degree Choose t = 2, t = 3, or t = 4 to control max keys per node
▶️ Step-by-step replay Every insert/delete/search is broken into discrete, replayable steps
📖 Live algorithm reference Side panel shows pseudocode with the active line highlighted per step
🎨 Rich visual states Color-coded nodes/cells for visits, splits, inserts, deletes, merges, borrows, and predecessor/successor swaps
🖱️ Interactive canvas Pan by dragging, zoom via wheel/buttons, fit-to-screen, fullscreen toggle
📊 Live tree stats Total keys, tree height, minimum degree, and max keys per node
🎲 Random data generator Populate the tree with random values in one click
🔗 B+ leaf links Sibling leaves are connected to visualize the ordered leaf layer

🏁 Getting Started

Prerequisites

  • Node.js >= 18.18
  • npm / yarn / pnpm

Installation

git clone https://github.com/parthadevs/indextree.git
cd indextree
npm install

Run the development server

npm run dev
# or
yarn dev
# or
pnpm dev

Open http://localhost:3000 in your browser. Changes hot-reload automatically.


🕹️ Usage

  1. Pick a structure — use the Structure dropdown in the header to choose B-Tree or B+ Tree.
  2. Set the minimum degree — use the Minimum degree dropdown to set t.
  3. Insert a value — type a number in the Insert value field and click Insert.
  4. Search or delete — use the Search value or Delete value fields.
  5. Populate randomly — choose a count and click Random Data.
  6. Replay an operation — use the player controls (previous / play-pause / next) and the speed slider to watch the tree transform step by step.
  7. Explore the canvas — drag to pan, scroll to zoom, or use the floating controls (zoom in/out, reset view, fit tree, fullscreen).

📂 Project Structure

indextree/
├── app/
│   ├── layout.tsx          # Root layout
│   ├── page.tsx            # Main visualizer component
│   └── globals.css         # Global styles
├── public/
│   └── screenshots/        # screenshots / GIFs
├── next.config.ts
├── postcss.config.mjs      # Tailwind CSS configuration
├── tsconfig.json
├── eslint.config.mjs
├── package.json
└── README.md

All tree logic, step generation, SVG rendering, and UI currently live in app/page.tsx.


🧠 Algorithm Details

B-Tree

Operation Behavior
Insert Descends from the root to a leaf, splitting any full node along the way. If the root is full, a new root is created and tree height increases by one.
Delete Finds the key, removes it from a leaf, or replaces it with its predecessor/successor when found in an internal node. Underflow is repaired by borrowing from a sibling or merging nodes.
Search Walks from the root, comparing the key against each node's keys and following the matching child until found or a leaf is reached.

B+ Tree

Operation Behavior
Insert Values live only in leaves; internal keys act as separators. Full leaves/internal nodes are split, with separators promoted (copied for leaves, moved for internal nodes).
Delete Removes the key from the leaf, then rebuilds the tree from the remaining leaf keys so separators stay consistent.
Search Follows separators down to the leaf layer, then scans the leaf keys.

🛠️ Tech Stack


☁️ Deploy

Build and run in production mode:

npm run build
npm run start

Or deploy instantly with Vercel:

Deploy with Vercel

See the Next.js deployment docs for other hosting options.


🤝 Contributing

Contributions, issues, and feature requests are welcome!

  1. Fork the repo
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

Distributed under the MIT License. See LICENSE for more information.


Made with ❤️ using Next.js & TypeScript

About

Interactive B-Tree and B+ Tree visualizer and implementation web app with customizable degrees, real-time operation steps, pseudocode tracking, and a sleek Shopify-inspired dark UI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages