Welcome to our Tree Data Structures Visualization Project!
This interactive desktop application allows users to visualize operations and algorithms on various tree data structures in real-time. Designed as the Capstone Project for the IT3100E: Object-Oriented Programming course (Class 162060 - Semester 2025.1) at Hanoi University of Science and Technology (HUST), this tool serves as an educational companion for students and developers mastering data structures.
If you find this project useful for learning Data Structures, please give it a โญ on GitHub!
- Binary Search Tree (BST): The fundamental tree structure.
- AVL Tree: A self-balancing binary search tree.
- Red-Black Tree: A complex self-balancing structure used in many system libraries.
- Generic Tree (N-ary Tree): A tree where nodes can have an arbitrary number of children.
- Insert: Add nodes dynamically (supports auto-balancing for AVL/RB Trees).
- Delete: Remove nodes and observe structural repairs.
- Search: Visualize the path taken to find a value.
- Update: Modify node values (visualized as delete + insert for BST variants).
- Predecessor / Successor: Find the in-order predecessor or successor of a node.
- Real-time Rendering: Smooth JavaFX animations for traversals, rotations, and color flips.
- Playback Controls:
โถ๏ธ Play / โธ๏ธ Pause- โฎ๏ธ Skip to Start / โญ๏ธ Skip to End
- โช Step Backward / โฉ Step Forward
- โก Speed Slider (0.1x to 5.0x)
- Timeline Scrubbing: Drag the timeline slider to jump to any point in the operation.
- Pseudo-code Panel: Displays the algorithm logic side-by-side, highlighting the exact line of code currently executing.
- Tree Statistics: Real-time updates on tree Height, Size, and Leaf count.
- Traversals: Animated Pre-Order, In-Order, and Post-Order traversals.
- Undo / Redo: Navigate through your entire history of tree states.
- Example Generators: One-click generation of Random, Balanced, Skewed, or Perfect trees.
- Export: Save the current visualization as a transparent PNG image.
- Language: Java (JDK 21)
- GUI Framework: JavaFX (Modular architecture)
- Build Tool: Apache Maven
- Design Pattern: MVC (Model-View-Controller)
- Styling: CSS (Modern, flat UI design)
OOP.20251-10
โโโ .github/
โ โโโ workflows/
โ โโโ build.yml # CI/CD pipeline configuration (GitHub Actions)
โ
โโโ design/ # Design artifacts (UML Use Case and Class Diagrams)
โ
โโโ report/
โ โโโ DemoTreeviz.mp4 # Demonstration video
โ โโโ OOPReport.pdf # Final project report
โ
โโโ src/main/
โ โโโ java/
โ โ โโโ controller/ # [Controller Layer] Logic and Animation Orchestration
โ โ โ โโโ animation/ # Animation Strategy implementations
โ โ โ โ โโโ BaseAnimationStrategy.java
โ โ โ โ โโโ BSTAnimationStrategy.java
โ โ โ โ โโโ AVLAnimationStrategy.java
โ โ โ โ โโโ RBAnimationStrategy.java
โ โ โ โ โโโ GenericTreeAnimationStrategy.java
โ โ โ โ โโโ RotationAnimator.java
โ โ โ โ โโโ TreeAnimationStrategy.java
โ โ โ โ โโโ TreeVisualizer.java
โ โ โ โ
โ โ โ โโโ TreeController.java # Main bridge between Model and View
โ โ โ
โ โ โโโ model/ # [Model Layer] Core Data Structures
โ โ โ โโโ pseudocode/ # Logic for algorithm step tracking
โ โ โ โ โโโ AlgoStep.java
โ โ โ โ โโโ PseudoCodeData.java
โ โ โ โ
โ โ โ โโโ AVLTree.java # Self-balancing AVL Tree implementation
โ โ โ โโโ BinarySearchTree.java # Standard BST implementation
โ โ โ โโโ GenericTree.java # N-ary Tree implementation
โ โ โ โโโ RedBlackTree.java # Red-Black Tree implementation
โ โ โ โโโ Node.java # Generic Node entity (data + visual coords)
โ โ โ โโโ TraversalStep.java # Snapshot for traversal animations
โ โ โ โโโ TreeOperation.java # Interface defining common tree behaviors
โ โ โ
โ โ โโโ util/ # [Utilities] Shared helper classes
โ โ โ โโโ ExportImage.java # Snapshot generation tool
โ โ โ โโโ PseudoCodeLib.java # Repository of algorithm text strings
โ โ โ โโโ TreeGenerator.java # Factory for creating random/preset trees
โ โ โ
โ โ โโโ view/ # [View Layer] JavaFX UI Components
โ โ โ โโโ AnimatePanel.java # Playback controls (Play, Pause, Speed)
โ โ โ โโโ CodePanel.java # Pseudocode display and highlighting
โ โ โ โโโ ControlPanel.java # User inputs (Buttons, TextFields)
โ โ โ โโโ DrawingPanel.java # Main canvas for rendering trees
โ โ โ โโโ RightPanel.java # Container for Code and Statistics
โ โ โ โโโ StatisticPanel.java # Metrics display (Height, Size, etc.)
โ โ โ โโโ HelpWindow.java # Popup for About Us
โ โ โ โโโ MainWindow.java # Main application layout
โ โ โ โโโ WelcomeWindow.java # Landing screen
โ โ โ
โ โ โโโ demo/
โ โ โโโ App.java
โ โ โโโ Main.java
โ โ โโโ style.css
โ โ
โ โโโ resources/ # Static assets (images, backgrounds)
โ
โโโ pom.xml # Maven dependencies and build configuration
โโโ dependency-reduced-pom.xml # Generated by Maven Shade plugin (Build artifact)
โโโ icon.ico # Application Icon
โโโ .gitignore
โโโ LICENSE
โโโ README.md
Before installing the application, ensure your system meets the following specifications:
- Operating System: Windows 10/11, macOS 11+, or Linux (Ubuntu 20.04+).
- Java Runtime: JDK 21 or later is required to support modern JavaFX features.
- Build Tool: Apache Maven 3.8+ (required only if building from source).
- Hardware: Minimum 4 GB RAM and 1280x720 display resolution.
There are two ways to install and run the application: building from the source code or downloading the pre-built application via GitHub.
This method ensures you have the absolute latest changes and allows for code modification.
Step 1: Clone the repository Open your terminal or command prompt and run:
git clone https://github.com/nvtkienn/OOP.20251-10.git
cd OOP.20251-10Step 2: Ensure JDK 21 is active
java -version
# Output should indicate version "21" or higherStep 3: Build the project
mvn clean installStep 4: Launch the application
mvn javafx:runAlternatively, you can run the main class from your IDE (IntelliJ/Eclipse) located at: src/main/java/demo/App.java
If you do not wish to set up a coding environment, you can download the latest executable version generated by our CI/CD pipeline.
-
Navigate to the GitHub repository page.
-
Click on the Actions tab in the top navigation bar.
-
Select the latest workflow run on the
main(orrelease) branch. -
Scroll down to the Artifacts section at the bottom of the workflow page. Download the package suitable for your operating system:
TreeVizApp-windows-latest(for Windows .exe)TreeVizApp-macos-latest(for macOS .dmg/.app)TreeVizApp-ubuntu-latest(for Linux .deb/binary)
-
Extract the downloaded zip file and double-click the executable to launch.
- Start: Launch the app and click "Start Visualization".
- Select Mode: Choose your desired Tree Type (e.g., AVL Tree).
- Generate Data:
- Click Create โ Random to generate a random tree.
- Or use Create โ Examples โ Perfect AVL for a demo scenario.
- Execute:
- Type a number in the input box.
- Click Insert, Delete, or Search.
- Control: Use the bottom animation bar to pause or slow down the animation to understand the logic (e.g., watch how an AVL tree rotates).
This project was developed by Team 10.
| No. | Member Name | Student ID | Role |
|---|---|---|---|
| 1 | Nguyแป n Vลฉ Trung Kiรชn | 202416713 | Project Lead, Architecture, Refactoring |
| 2 | Phแบกm Tiแบฟn Dลฉng | 202416680 | UI/UX Design, Animation Logic |
| 3 | Trแบงn Nam Hแบฃi | 202400103 | Data Structures, Algorithms |
This project is licensed under the MIT License - see the LICENSE file for details. However, it is intended for educational reference and demonstration purposes only.
For Students: If you are currently taking the Object-Oriented Programming (IT3100E) course or similar subjects:
- You may view the code to understand the concepts.
- You MUST NOT copy-paste this source code and submit it as your own coursework.
- Plagiarism is a serious academic offense and is easily detected by university code-checking tools.
We would like to express our sincere gratitude to:
- Ph.D. Nguyen Thi Thu Trang - Our course lecturer.
- Mr. Le Nhat Son - Our teaching assistant.
Their expertise and dedication provided us with the invaluable knowledge required to complete this project.
For any inquiries or feedback, please contact us via GitHub Issues or LinkedIn:
We highly value your feedback and every contribution to make this project better!
