Skip to content

This project visualizes two fundamental algorithms — Closest Pair of Points (Divide & Conquer) and Karatsuba Multiplication (Recursive Integer Multiplication) — using Python, Matplotlib, NetworkX, and Tkinter. It provides interactive visualizations to help and enthusiasts understand how recursive division and merging work in geometry.

Notifications You must be signed in to change notification settings

HussainS5/Algorithm-Visualization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

💻 Algorithm Visualization Project: Divide and Conquer

This project provides graphical visualizations for two classic algorithms implemented using the Divide and Conquer paradigm:

  • Karatsuba Multiplication Algorithm
  • Closest Pair of Points Algorithm

The visualizations are built with Python, using matplotlib and networkx, with a GUI provided via tkinter for easy interaction and file selection.


✨ Features

  • Karatsuba Multiplication Visualization: Animates the recursive steps of the Karatsuba algorithm using a directed graph (tree) structure, showing the breakdown and recombination of the multiplication problem.

  • Closest Pair of Points Visualization: Animates the divide and conquer process for finding the closest pair of points, including plane division and strip checking.

  • GUI for Interaction: Simplifies generating random input files and selecting files for visualization.

  • Random File Generation: RandomFile.py creates diverse input files for testing both algorithms.


📂 Project Structure

├── Integer_Multiplication.py      # Karatsuba visualization
├── Closest_Pair.py               # Closest pair visualization
├── RandomFile.py                  # Generates random input files
├── README.md                      # Project documentation
└── RandomFiles/                   # Directory with generated input files

🚀 Getting Started

Prerequisites

  • Python 3.x installed
  • Python libraries: matplotlib, networkx, pydot
  • GraphViz command-line utility (for pydot layouts) – download from graphviz.org

Installation

  1. Clone the repository
git clone https://github.com/YOUR_USERNAME/YOUR_REPO_NAME.git
cd YOUR_REPO_NAME
  1. Install required Python libraries
pip install matplotlib networkx pydot

⚙️ Usage

1. Generate Input Files

Use the “Generate Random Files” button in the GUI to create input files.

  • Output directory: RandomFiles/
  • Files:
    • integers_*.txt – for Karatsuba Multiplication
    • points_*.txt – for Closest Pair of Points

2. Run Visualization

Karatsuba Multiplication

python Integer_Multiplication.py

Closest Pair of Points

python Closest_Pair.py

Follow the GUI prompts to select files and view the animated visualizations.

🤝 Contributing

Contributions are welcome! Open an issue or submit a pull request.

📝 License

This project is licensed under the MIT License.

About

This project visualizes two fundamental algorithms — Closest Pair of Points (Divide & Conquer) and Karatsuba Multiplication (Recursive Integer Multiplication) — using Python, Matplotlib, NetworkX, and Tkinter. It provides interactive visualizations to help and enthusiasts understand how recursive division and merging work in geometry.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages