# Community-Detection-Modularity
Eigenvector-based community detection is a method used to identify communities or groups within a network by analyzing the eigenvectors of the network's adjacency matrix. The basic idea behind this approach is that nodes that belong to the same community will be more strongly connected to each other than to nodes in other communities.
The method starts by calculating the adjacency matrix of the network, which represents the connections between nodes. Next, the eigenvalues and eigenvectors of this matrix are calculated. The eigenvectors with the largest eigenvalues are then used to assign nodes to communities.
The basic idea is that nodes that belong to the same community will have similar eigenvector values for these dominant eigenvectors. By grouping nodes with similar eigenvector values together, communities can be identified.
The method starts by calculating the adjacency matrix of the network, which represents the connections between nodes. Next, the eigenvalues and eigenvectors of this matrix are calculated. The eigenvectors with the largest eigenvalues are then used to assign nodes to communities.
The basic idea is that nodes that belong to the same community will have similar eigenvector values for these dominant eigenvectors. By grouping nodes with similar eigenvector values together, communities can be identified.
## Installation
### Install via PIP
```cmd
pip install apache-age-community-detection
```
### Build from Source
```cmd
sudo apt-get update
sudo apt-get install libeigen3-dev
git clone https://github.com/Munmud/Community-Detection-Modularity
cd Community-Detection-Modularity
python setup.py install
```
## Instruction
### import
```py
from age_community_detection import Graph
```
### Create Graph
```py
nodes = [0, 1, 2, 3, 4, 5]
edges = [[0, 1], [0, 2], [1, 2], [2, 3], [3, 4], [3, 5], [4, 5]]
g = Graph.Graph()
```
- Nodes : `0 to N-1`
- Edges :
- `2d array : adjacency list`
- `Each element between 0 to N-1`
### Generate Community Assignment
```py
res = g.get_community()
```
### Output Format
```
[1, 1, 1, 0, 0, 0, 2, 2, 0, 3, 3, 1, 3]
```
- Here each number represents the community number of corresponding node
### Reference
- [Finding community structure in networks using the eigenvectors of matrices](https://arxiv.org/pdf/physics/0605087.pdf)
- [Modularity and community structure in networks](https://www.pnas.org/doi/10.1073/pnas.0601602103)
- [Statistical Mechanics of Community Detection](https://ia903002.us.archive.org/33/items/arxiv-cond-mat0603718/cond-mat0603718.pdf)
Raw data
{
"_id": null,
"home_page": "https://github.com/Munmud/Community-Detection-Modularity",
"name": "age-community-detection",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "",
"keywords": "Community-Detection,Modularity,Reichardt and Bornholdt,Newman,partition network,k means cluster",
"author": "Moontasir Mahmood",
"author_email": "moontasir042@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/3d/7e/1a325af3e79f5bcf5158bd10f2937b8899a7036c69cb0bde908e0644813c/age_community_detection-0.0.2.tar.gz",
"platform": null,
"description": "# Community-Detection-Modularity\n\nEigenvector-based community detection is a method used to identify communities or groups within a network by analyzing the eigenvectors of the network's adjacency matrix. The basic idea behind this approach is that nodes that belong to the same community will be more strongly connected to each other than to nodes in other communities.\n\nThe method starts by calculating the adjacency matrix of the network, which represents the connections between nodes. Next, the eigenvalues and eigenvectors of this matrix are calculated. The eigenvectors with the largest eigenvalues are then used to assign nodes to communities.\n\nThe basic idea is that nodes that belong to the same community will have similar eigenvector values for these dominant eigenvectors. By grouping nodes with similar eigenvector values together, communities can be identified.\n\nThe method starts by calculating the adjacency matrix of the network, which represents the connections between nodes. Next, the eigenvalues and eigenvectors of this matrix are calculated. The eigenvectors with the largest eigenvalues are then used to assign nodes to communities.\n\nThe basic idea is that nodes that belong to the same community will have similar eigenvector values for these dominant eigenvectors. By grouping nodes with similar eigenvector values together, communities can be identified.\n\n## Installation\n\n### Install via PIP\n```cmd\npip install apache-age-community-detection\n```\n\n### Build from Source\n```cmd\nsudo apt-get update\nsudo apt-get install libeigen3-dev\ngit clone https://github.com/Munmud/Community-Detection-Modularity\ncd Community-Detection-Modularity\npython setup.py install\n```\n\n## Instruction\n\n### import\n```py\nfrom age_community_detection import Graph\n```\n\n### Create Graph\n```py\nnodes = [0, 1, 2, 3, 4, 5]\nedges = [[0, 1], [0, 2], [1, 2], [2, 3], [3, 4], [3, 5], [4, 5]]\ng = Graph.Graph()\n```\n- Nodes : `0 to N-1`\n- Edges : \n - `2d array : adjacency list`\n - `Each element between 0 to N-1`\n\n### Generate Community Assignment\n```py\nres = g.get_community()\n```\n\n### Output Format\n```\n[1, 1, 1, 0, 0, 0, 2, 2, 0, 3, 3, 1, 3]\n```\n- Here each number represents the community number of corresponding node\n\n### Reference\n- [Finding community structure in networks using the eigenvectors of matrices](https://arxiv.org/pdf/physics/0605087.pdf)\n- [Modularity and community structure in networks](https://www.pnas.org/doi/10.1073/pnas.0601602103)\n- [Statistical Mechanics of Community Detection](https://ia903002.us.archive.org/33/items/arxiv-cond-mat0603718/cond-mat0603718.pdf)\n",
"bugtrack_url": null,
"license": "Apache2.0",
"summary": "Detection of Community by maximizing modularity",
"version": "0.0.2",
"split_keywords": [
"community-detection",
"modularity",
"reichardt and bornholdt",
"newman",
"partition network",
"k means cluster"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "14d8ad4cabdc78567dff8ea1e212292d59b69cdd2ac4e82e3b3330509d8158d5",
"md5": "797cb92ade6377ba2a94e7497ce72910",
"sha256": "0d1c043cc483a4dd6f800066208c1f9d7c66f53e85c6a45e28bdbc8fded33616"
},
"downloads": -1,
"filename": "age_community_detection-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "797cb92ade6377ba2a94e7497ce72910",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 6387,
"upload_time": "2023-04-08T13:59:16",
"upload_time_iso_8601": "2023-04-08T13:59:16.590410Z",
"url": "https://files.pythonhosted.org/packages/14/d8/ad4cabdc78567dff8ea1e212292d59b69cdd2ac4e82e3b3330509d8158d5/age_community_detection-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3d7e1a325af3e79f5bcf5158bd10f2937b8899a7036c69cb0bde908e0644813c",
"md5": "f9366533eafc7511e613b9a034bc64b4",
"sha256": "05a628419be6a77bfe72bb0bc99951d127cbd495bfcc2ed108e6e70210a91c23"
},
"downloads": -1,
"filename": "age_community_detection-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "f9366533eafc7511e613b9a034bc64b4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 6181,
"upload_time": "2023-04-08T13:59:18",
"upload_time_iso_8601": "2023-04-08T13:59:18.584837Z",
"url": "https://files.pythonhosted.org/packages/3d/7e/1a325af3e79f5bcf5158bd10f2937b8899a7036c69cb0bde908e0644813c/age_community_detection-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-08 13:59:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "Munmud",
"github_project": "Community-Detection-Modularity",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "age-community-detection"
}