-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
49 lines (41 loc) · 1.39 KB
/
Copy pathmain.py
File metadata and controls
49 lines (41 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python3
"""
Closest Pair of Points Algorithm
=================================
This script implements a divide-and-conquer algorithm to find the closest pair of points
in a 2D space. It reads input from a file containing X and Y coordinates, processes the data,
and visualizes the results using matplotlib.
Features:
---------
- Parses input files containing X and Y coordinates.
- Implements a nearest pair algorithm to find the closest points.
- Logs execution details and errors to a log file.
- Handles user interruptions (Ctrl + C) gracefully.
- Provides a command-line interface for specifying input files.
Usage:
------
Run the program from the command line with the following syntax:
python3 main.py -f <path_to_file>
Example:
--------
python3 main.py -f points.txt
Dependencies:
-------------
- Python 3.6 or higher
- External library: `pwn` (for logging progress)
- External library: `matplotlib` (for creating visualizations)
Notes:
------
- The input file must contain exactly two lines of comma-separated values.
- The program gracefully handles user interruptions (Ctrl + C).
References:
-----------
- "Divide and Conquer Algorithm for Closest Pair of Points", GeeksforGeeks.
- "Computational Geometry: Algorithms and Applications", Mark de Berg et al.
Author:
-------
Ch4rum
"""
from Modules.main_app import MainApp
if __name__ == "__main__":
MainApp().start_and_show_result()