Skip to main content

Complex Network Link Prediction

License: MIT PyPi Documentation Downloads Wiki GitHubIssues GitTutorial

logo

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, where it is possible to see the required parameters and the output of the method itself.
The methods are distinguished by belonging to categories and subcategories, below is an example image with all the categories.

methods list

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

How to use

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 to see a real case study for Social Network Analysis and link prediction, with the use of our Python Library.


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 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 to report it, we will resolve that asap.


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

References


Authors

cosci vescera fagiolo romani posta
Cristian Cosci 🐔 Nicolò Vescera 🦧 Fabrizio Fagiolo 🐛 Tommaso Romani 🦍 Nicolò Posta 🐒

Metadata

Release files for complex-network-link-prediction 1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for complex-network-link-prediction 1.3
File Size Uploaded Provenance Actions
complex-network-link-prediction-1.3.tar.gz 22.4 kB Without provenance Details for complex-network-link-prediction-1.3.tar.gz

Security for complex-network-link-prediction 1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page