A fast network diffusion library
Project description
CyNetDiff
- Documentation: https://eliotwrobson.github.io/CyNetDiff/
A performance-focused library implementing algorithms for simulating network diffusion processes, written in Cython.
Quick Start
Installation
pip install cynetdiff
Note: The installation includes a build step that requires having a C++ complier installed.
Usage
We can run models over graphs we define, using pre-defined weighting schemes. Here is a simple example
import random
import networkx as nx
from cynetdiff.utils import networkx_to_ic_model
# Randomly generate the graph
n = 1_000
p = 0.05
graph = nx.fast_gnp_random_graph(n, p)
# Randomly choose seed nodes
k = 10
nodes = list(graph.nodes)
seeds = random.sample(nodes, k)
# Set the activation probability uniformly and set seeds
model = networkx_to_ic_model(graph, activation_prob=0.2)
model.set_seeds(seeds)
# Run the diffusion process
model.advance_until_completion()
# Get the number of nodes activated
model.get_num_activated_nodes()
Project Status
This project is still considered in an alpha stage of development. As such, the API is still relatively undocumented, not yet fully featured, and could still change.
All feedback is greatly appreciated!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cynetdiff-0.1.6.tar.gz
(320.0 kB
view hashes)
Built Distribution
Close
Hashes for cynetdiff-0.1.6-cp311-cp311-manylinux_2_31_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b3bc58c0afc0cbd4f874ce16d98459284565404d726f725b757aca038a833ec |
|
MD5 | 58c69d70f19eb15862f6c19e09e3de1e |
|
BLAKE2b-256 | 0cd5297208ea230b27a564b1f77fbe4483475682e88b096d391572fd1129f620 |