# mincluster
mincluster is a package that allows to minimize the maximum intercluster distance
## Overview
The problem of clustering a set of points so as to minimize the maximum intercluster distance is studied. An O(kn) approximation algorithm, where n is the number of points and k is the number of clusters, that guarantees solutions with an objective function value within two times the optimal solution value is presented. This approximation algorithm succeeds as long as the set of points satisfies the triangular inequality. We also show that our approximation algorithm is best possible, with respect to the approximation bound, if P ≠ NP.
## Installation
```python
pip install mincluster
```
## Usage
```python
from mincluster.cluster import ClusterMinimization
k = 3
data = [231, 22, 73, 54, 60, 29, 10, 192, 115]
c = ClusterMinimization(k, data)
clusters, cluster_heads = c.expand_clusters(c.clusters, c.cluster_heads)
try:
for i in range(k):
print(f'Cluster {i + 1}: Head = {cluster_heads[i]}, Elements = {clusters[i]}')
except IndexError as e:
print(e)
```
### Output
```output
Cluster 1: Head = 60, Elements = {192, 231, 73, 10, 115, 54, 22, 29}
Cluster 2: Head = 231, Elements = {192, 231, 73, 10, 115, 54, 22, 60, 29}
Cluster 3: Head = 115, Elements = {192, 231, 73, 10, 115, 54, 22, 60, 29}
```
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
## References
Gonzalez, Teofilo F. “Clustering to Minimize the Maximum Intercluster Distance.” Theoretical Computer Science, vol. 38, Elsevier BV, Jan. 1985, pp. 293–306, https://doi.org/10.1016/0304-3975(85)90224-5. Accessed 26 Oct. 2023.
Raw data
{
"_id": null,
"home_page": "",
"name": "mincluster",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "python,theoretical computer science,cluster",
"author": "Khushiyant",
"author_email": "<khushiyant2002@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/b2/6e/8bd8477a51993768a6875e9e1d6328352dbfd97382637a8d8c60e1f38044/mincluster-0.0.1.tar.gz",
"platform": null,
"description": "\n# mincluster\n\nmincluster is a package that allows to minimize the maximum intercluster distance\n\n## Overview\n\nThe problem of clustering a set of points so as to minimize the maximum intercluster distance is studied. An O(kn) approximation algorithm, where n is the number of points and k is the number of clusters, that guarantees solutions with an objective function value within two times the optimal solution value is presented. This approximation algorithm succeeds as long as the set of points satisfies the triangular inequality. We also show that our approximation algorithm is best possible, with respect to the approximation bound, if P \u2260 NP.\n\n## Installation\n\n```python\npip install mincluster\n```\n\n## Usage\n\n```python\nfrom mincluster.cluster import ClusterMinimization\n\nk = 3\ndata = [231, 22, 73, 54, 60, 29, 10, 192, 115]\nc = ClusterMinimization(k, data)\nclusters, cluster_heads = c.expand_clusters(c.clusters, c.cluster_heads)\n\ntry:\n for i in range(k):\n print(f'Cluster {i + 1}: Head = {cluster_heads[i]}, Elements = {clusters[i]}')\nexcept IndexError as e:\n print(e)\n```\n\n### Output\n```output\nCluster 1: Head = 60, Elements = {192, 231, 73, 10, 115, 54, 22, 29}\nCluster 2: Head = 231, Elements = {192, 231, 73, 10, 115, 54, 22, 60, 29}\nCluster 3: Head = 115, Elements = {192, 231, 73, 10, 115, 54, 22, 60, 29}\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n\n## References\n\nGonzalez, Teofilo F. \u201cClustering to Minimize the Maximum Intercluster Distance.\u201d Theoretical Computer Science, vol. 38, Elsevier BV, Jan. 1985, pp. 293\u2013306, https://doi.org/10.1016/0304-3975(85)90224-5. Accessed 26 Oct. 2023.\n",
"bugtrack_url": null,
"license": "",
"summary": "Cluster minimization package",
"version": "0.0.1",
"project_urls": null,
"split_keywords": [
"python",
"theoretical computer science",
"cluster"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b5cd0d5d51ea2e2c0dad46f19139300d69fd8e7ce4104d164836b778fa501d0e",
"md5": "dcf9770d780b17afde3fa182a0c14a92",
"sha256": "69f6be4e0e1e8cc6afbcf84a1e08d1cfbe0b4dd5ccde7f91cdc172c937f47e3b"
},
"downloads": -1,
"filename": "mincluster-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dcf9770d780b17afde3fa182a0c14a92",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4290,
"upload_time": "2023-10-26T10:24:29",
"upload_time_iso_8601": "2023-10-26T10:24:29.363336Z",
"url": "https://files.pythonhosted.org/packages/b5/cd/0d5d51ea2e2c0dad46f19139300d69fd8e7ce4104d164836b778fa501d0e/mincluster-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b26e8bd8477a51993768a6875e9e1d6328352dbfd97382637a8d8c60e1f38044",
"md5": "01fcad7c490c3cccb91db20bc1e8d81b",
"sha256": "a7090f842b83a7db1b57aa96f866e169ebe5edacb5fa7791cecf1c835490f7f1"
},
"downloads": -1,
"filename": "mincluster-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "01fcad7c490c3cccb91db20bc1e8d81b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3944,
"upload_time": "2023-10-26T10:24:30",
"upload_time_iso_8601": "2023-10-26T10:24:30.831279Z",
"url": "https://files.pythonhosted.org/packages/b2/6e/8bd8477a51993768a6875e9e1d6328352dbfd97382637a8d8c60e1f38044/mincluster-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-26 10:24:30",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "mincluster"
}