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.
-
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.pycreates diverse input files for testing both algorithms.
├── 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
- Python 3.x installed
- Python libraries:
matplotlib,networkx,pydot - GraphViz command-line utility (for
pydotlayouts) – download from graphviz.org
- Clone the repository
git clone https://github.com/YOUR_USERNAME/YOUR_REPO_NAME.git
cd YOUR_REPO_NAME- Install required Python libraries
pip install matplotlib networkx pydotUse the “Generate Random Files” button in the GUI to create input files.
- Output directory:
RandomFiles/ - Files:
integers_*.txt– for Karatsuba Multiplicationpoints_*.txt– for Closest Pair of Points
python Integer_Multiplication.pypython Closest_Pair.pyFollow the GUI prompts to select files and view the animated visualizations.
Contributions are welcome! Open an issue or submit a pull request.
This project is licensed under the MIT License.