# **Complex Network Link Prediction**
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![PyPi](https://badge.fury.io/py/complex-network-link-prediction.svg)](https://badge.fury.io/py/complex-network-link-prediction) [![Documentation](https://img.shields.io/badge/Documentation-blue.svg)](https://typing-monkeys.github.io/social-network-link-prediction/) [![Downloads](https://pepy.tech/badge/complex-network-link-prediction/month)](https://pepy.tech/project/complex-network-link-prediction) [![Wiki](https://img.shields.io/badge/howTo-Wiki-blue.svg)](https://github.com/Typing-Monkeys/social-network-link-prediction/wiki) [![GitHubIssues](https://img.shields.io/badge/issue_tracking-github-blue.svg)](https://github.com/Typing-Monkeys/social-network-link-prediction/issues) [![GitTutorial](https://img.shields.io/badge/PR-Welcome-%23FF8300.svg?)](https://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project)
#### **Complex Network Link Prediction** is a python library that implements some of the main techniques and algorithms to perform link predictions.
<img src="https://raw.githubusercontent.com/Typing-Monkeys/social-network-link-prediction/develop/imgs/logo.png" alt="logo" width="70%" />
This library, implemented in python, allows you to use some of the main algorithms and methods to perform link predictions. It was designed to carry out these tasks in **Complex Networks** and, specifically, in **Social Networks**. Each method has its own specific documentation available on the [official documentation page](https://typing-monkeys.github.io/social-network-link-prediction/), where it is possible to see the required parameters and the output of the method itself. <br>
The methods are distinguished by belonging to categories and subcategories, below is an example image with all the categories.
<img src="https://raw.githubusercontent.com/Typing-Monkeys/social-network-link-prediction/develop/imgs/methods_list.jpg" alt="methods list" width="70%" />
The speed of computation differs both from the type of method and from the input graph. However, for convention and efficiency, we have chosen to use the `csr_matrix` sparse matrix structure from the ***scipy*** library in each algorithm.
## Install
```
pip install complex-network-link-prediction
```
<hr>
## How to use
```python
import networkx as nx
import matplotlib.pyplot as plt
from cnlp.similarity_methods.local_similarity import common_neighbors
from cnlp.utils import nodes_to_indexes, get_top_predicted_link
G = nx.karate_club_graph()
name_index_map = list(nodes_to_indexes(G).items())
predicted_adj_matrix_common_neighbors = common_neighbors(G)
new_links = get_top_predicted_link(predicted_adj_matrix_common_neighbors, G.number_of_nodes(), pct_new_link=5, name_index_map=name_index_map, verbose=True)
```
You can also check [this project](https://github.com/CristianCosci/ComplexNetworkAnalysis/) to see a real case study for Social Network Analysis and link prediction, with the use of our Python Library.
<hr>
### Contribute 💥
As there are still many methods to implement and, at the same time, maintaining a library takes up a lot of time, we are always happy to accept new willing and able people to contribute and support our project.
If you want to contribute or you've found a bug, you can open a **Pull Request**.
Check this [tutorial](https://github.com/Typing-Monkeys/social-network-link-prediction/wiki/monkeflow-Workflow-🦍) if you want to use our preferred *Workflow* 🦍 for developing.
Otherwise you can open a normal Pull Request using `git` and help us to make this project even better!
### Help ❓
If you encounter any bug or you have some problem with this package you can open an [issue](https://github.com/Typing-Monkeys/social-network-link-prediction/wiki/monkeflow-Workflow-🦍) to report it, we will resolve that asap.
<hr>
### Building From Source
Download the repository and run:
```
pip install -e .
```
### Dependencies
If your system does not have some or all of this requirements they will be installed during the istallation of the library
- networkx
- scipy
- numpy
<hr>
## References
- ***Ajay Kumar, Shashank Sheshar Singh, Kuldeep Singh, Bhaskar Biswas. 2020.***
[Link prediction techniques, applications, and performance: A survey](https://www.sciencedirect.com/science/article/pii/S0378437120300856)
*Physica A: Statistical Mechanics and its Applications*,
ISSN 0378-4371, https://doi.org/10.1016/j.physa.2020.124289.
- ***David Liben-Nowell and Jon Kleinberg. 2003.***
[The link prediction problem for social networks](https://dl.acm.org/doi/10.1145/956863.956972)
*In Proceedings of the twelfth international conference on Information and knowledge management (CIKM '03). Association for Computing Machinery, New York, NY, USA*, 556–559, https://doi.org/10.1145/956863.956972.
- ***Víctor Martínez, Fernando Berzal, and Juan-Carlos Cubero. 2016.***
[A Survey of Link Prediction in Complex Networks](https://dl.acm.org/doi/10.1145/3012704)
*ACM Comput. Surv. 49, 4, Article 69 (December 2017), 33 pages*. https://doi.org/10.1145/3012704
<hr>
### ***Authors***
| ![cosci](https://avatars.githubusercontent.com/u/44636000?s=250) | ![vescera](https://avatars.githubusercontent.com/u/10250769?s=250)| ![fagiolo](https://avatars.githubusercontent.com/u/44865237?v=47&size=250) | ![romani](https://avatars.githubusercontent.com/u/44830726?v=4&size=250)| ![posta](https://avatars.githubusercontent.com/u/44830740?v=4&size=250)
| - | - | - | - | - |
| [Cristian Cosci](https://github.com/CristianCosci) 🐔 | [Nicolò Vescera](https://github.com/ncvescera) 🦧 | [Fabrizio Fagiolo](https://github.com/F-a-b-r-i-z-i-o) 🐛 | [Tommaso Romani](https://github.com/TommasoRomani) 🦍 | [Nicolò Posta](https://github.com/NicoloPosta) 🐒
Raw data
{
"_id": null,
"home_page": "https://github.com/Typing-Monkeys/social-network-link-prediction",
"name": "complex-network-link-prediction",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "Link Prediction,Social Network,Complex Network Analisys",
"author": "Cristian Cosci, Fabrizio Fagiolo, Nicol\u00f2 Vescera, Nicol\u00f2 Posta, Tommaso Romani",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/3c/47/d15fe7b26101046db803c31b72613e11288cc90767a9cc5f63b8d67c10b4/complex-network-link-prediction-1.3.tar.gz",
"platform": null,
"description": "# **Complex Network Link Prediction**\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![PyPi](https://badge.fury.io/py/complex-network-link-prediction.svg)](https://badge.fury.io/py/complex-network-link-prediction) [![Documentation](https://img.shields.io/badge/Documentation-blue.svg)](https://typing-monkeys.github.io/social-network-link-prediction/) [![Downloads](https://pepy.tech/badge/complex-network-link-prediction/month)](https://pepy.tech/project/complex-network-link-prediction) [![Wiki](https://img.shields.io/badge/howTo-Wiki-blue.svg)](https://github.com/Typing-Monkeys/social-network-link-prediction/wiki) [![GitHubIssues](https://img.shields.io/badge/issue_tracking-github-blue.svg)](https://github.com/Typing-Monkeys/social-network-link-prediction/issues) [![GitTutorial](https://img.shields.io/badge/PR-Welcome-%23FF8300.svg?)](https://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project)\n\n\n#### **Complex Network Link Prediction** is a python library that implements some of the main techniques and algorithms to perform link predictions.\n\n<img src=\"https://raw.githubusercontent.com/Typing-Monkeys/social-network-link-prediction/develop/imgs/logo.png\" alt=\"logo\" width=\"70%\" />\n\nThis library, implemented in python, allows you to use some of the main algorithms and methods to perform link predictions. It was designed to carry out these tasks in **Complex Networks** and, specifically, in **Social Networks**. Each method has its own specific documentation available on the [official documentation page](https://typing-monkeys.github.io/social-network-link-prediction/), where it is possible to see the required parameters and the output of the method itself. <br>\nThe methods are distinguished by belonging to categories and subcategories, below is an example image with all the categories.\n\n<img src=\"https://raw.githubusercontent.com/Typing-Monkeys/social-network-link-prediction/develop/imgs/methods_list.jpg\" alt=\"methods list\" width=\"70%\" />\n\nThe speed of computation differs both from the type of method and from the input graph. However, for convention and efficiency, we have chosen to use the `csr_matrix` sparse matrix structure from the ***scipy*** library in each algorithm.\n\n\n## Install\n```\npip install complex-network-link-prediction\n```\n\n<hr>\n\n\n## How to use\n```python\nimport networkx as nx\nimport matplotlib.pyplot as plt\nfrom cnlp.similarity_methods.local_similarity import common_neighbors\nfrom cnlp.utils import nodes_to_indexes, get_top_predicted_link\n\nG = nx.karate_club_graph()\n\nname_index_map = list(nodes_to_indexes(G).items())\n\npredicted_adj_matrix_common_neighbors = common_neighbors(G)\n\nnew_links = get_top_predicted_link(predicted_adj_matrix_common_neighbors, G.number_of_nodes(), pct_new_link=5, name_index_map=name_index_map, verbose=True)\n```\n\nYou can also check [this project](https://github.com/CristianCosci/ComplexNetworkAnalysis/) to see a real case study for Social Network Analysis and link prediction, with the use of our Python Library.\n<hr>\n\n### Contribute \ud83d\udca5\nAs there are still many methods to implement and, at the same time, maintaining a library takes up a lot of time, we are always happy to accept new willing and able people to contribute and support our project.\n\nIf you want to contribute or you've found a bug, you can open a **Pull Request**.\n\nCheck this [tutorial](https://github.com/Typing-Monkeys/social-network-link-prediction/wiki/monkeflow-Workflow-\ud83e\udd8d) if you want to use our preferred *Workflow* \ud83e\udd8d for developing.\n\nOtherwise you can open a normal Pull Request using `git` and help us to make this project even better!\n\n### Help \u2753\nIf you encounter any bug or you have some problem with this package you can open an [issue](https://github.com/Typing-Monkeys/social-network-link-prediction/wiki/monkeflow-Workflow-\ud83e\udd8d) to report it, we will resolve that asap.\n\n<hr>\n\n### Building From Source\nDownload the repository and run:\n```\npip install -e .\n```\n\n### Dependencies\nIf your system does not have some or all of this requirements they will be installed during the istallation of the library\n- networkx\n- scipy\n- numpy\n\n<hr>\n\n## References\n\n- ***Ajay Kumar, Shashank Sheshar Singh, Kuldeep Singh, Bhaskar Biswas. 2020.***\n [Link prediction techniques, applications, and performance: A survey](https://www.sciencedirect.com/science/article/pii/S0378437120300856)\n *Physica A: Statistical Mechanics and its Applications*,\n ISSN 0378-4371, https://doi.org/10.1016/j.physa.2020.124289.\n- ***David Liben-Nowell and Jon Kleinberg. 2003.***\n [The link prediction problem for social networks](https://dl.acm.org/doi/10.1145/956863.956972)\n *In Proceedings of the twelfth international conference on Information and knowledge management (CIKM '03). Association for Computing Machinery, New York, NY, USA*, 556\u2013559, https://doi.org/10.1145/956863.956972.\n- ***V\u00edctor Mart\u00ednez, Fernando Berzal, and Juan-Carlos Cubero. 2016.***\n [A Survey of Link Prediction in Complex Networks](https://dl.acm.org/doi/10.1145/3012704)\n *ACM Comput. Surv. 49, 4, Article 69 (December 2017), 33 pages*. https://doi.org/10.1145/3012704\n\n<hr>\n\n### ***Authors***\n\n| ![cosci](https://avatars.githubusercontent.com/u/44636000?s=250) | ![vescera](https://avatars.githubusercontent.com/u/10250769?s=250)| ![fagiolo](https://avatars.githubusercontent.com/u/44865237?v=47&size=250) | ![romani](https://avatars.githubusercontent.com/u/44830726?v=4&size=250)| ![posta](https://avatars.githubusercontent.com/u/44830740?v=4&size=250) \n| - | - | - | - | - |\n| [Cristian Cosci](https://github.com/CristianCosci) \ud83d\udc14 | [Nicol\u00f2 Vescera](https://github.com/ncvescera) \ud83e\udda7 | [Fabrizio Fagiolo](https://github.com/F-a-b-r-i-z-i-o) \ud83d\udc1b | [Tommaso Romani](https://github.com/TommasoRomani) \ud83e\udd8d | [Nicol\u00f2 Posta](https://github.com/NicoloPosta) \ud83d\udc12\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A python library for link prediction in social networks",
"version": "1.3",
"project_urls": {
"Homepage": "https://github.com/Typing-Monkeys/social-network-link-prediction"
},
"split_keywords": [
"link prediction",
"social network",
"complex network analisys"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3c47d15fe7b26101046db803c31b72613e11288cc90767a9cc5f63b8d67c10b4",
"md5": "8d4dbf8dbaf94d9792c1b837af3e7143",
"sha256": "19e7be07ffd38788ac622c3fa3b6192fd2c5cb0e1bbba7973b1d98e1915ed419"
},
"downloads": -1,
"filename": "complex-network-link-prediction-1.3.tar.gz",
"has_sig": false,
"md5_digest": "8d4dbf8dbaf94d9792c1b837af3e7143",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 22397,
"upload_time": "2023-05-07T15:48:29",
"upload_time_iso_8601": "2023-05-07T15:48:29.897111Z",
"url": "https://files.pythonhosted.org/packages/3c/47/d15fe7b26101046db803c31b72613e11288cc90767a9cc5f63b8d67c10b4/complex-network-link-prediction-1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-07 15:48:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Typing-Monkeys",
"github_project": "social-network-link-prediction",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "complex-network-link-prediction"
}