-
Notifications
You must be signed in to change notification settings - Fork 75
CyNetDiff blog post #733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
eliotwrobson
wants to merge
2
commits into
pyOpenSci:main
Choose a base branch
from
eliotwrobson:cynetdiff_post
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
CyNetDiff blog post #733
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
layout: single | ||
title: "CyNetDiff: A Python Library for Accelerated Implementation of Network Diffusion Models" | ||
excerpt: CyNetDiff is a new Python package for accelerating network diffusion simulations, recently accepted into the pyOpenSci ecosystem. | ||
author: Eliot W. Robson | ||
permalink: /blog/cynetdiff | ||
header: | ||
overlay_image: images/headers/pyopensci-floral.png | ||
categories: | ||
- blog-post | ||
- cynetdiff | ||
- network-diffusion | ||
- pyos-accepted | ||
classes: wide | ||
comments: true | ||
last_modified: 2025-09-15 | ||
--- | ||
|
||
In recent years, network diffusion models, which are used to study how information and epidemics spread over social networks, have garnered increasing interest. Two of the most widely used models are the **independent cascade (IC)** and **linear threshold (LT) models**. These models simulate spread through a network by starting with a set of seed nodes that are | ||
designated as "active", and all other nodes are "inactive". Then, in each iteration, some inactive nodes become active, | ||
and the iterations continue until no other nodes can be activated. | ||
|
||
Many tasks related to these models, particularly influence maximization, require a significant number of simulations on large graphs, which can be computationally expensive. There has been significant prior work on | ||
reducing the number of simulations needed for these tasks, demonstrating the importance of an efficient implementation. | ||
|
||
While researchers often prefer high-level languages like Python for their flexibility and quick development, these computationally intensive tasks are better suited for low-level, compiled languages. To bridge this gap, we've developed **CyNetDiff**, a Python library that uses components written in Cython to provide the performance of a compiled language with the flexibility of a high-level language. | ||
|
||
--- | ||
|
||
## Package Features | ||
|
||
The performance-critical parts of CyNetDiff are written in **Cython**, a language extension that compiles to C++ while remaining callable from Python. To take advantage of Cython's speed, the library uses the **compressed sparse row (CSR) format** in an array-based representation. This data structure has low memory overhead and allows for efficient, repeated traversals, making it ideal for simulations of the diffusion processes. | ||
|
||
The implementation also uses a **BFS-based traversal algorithm** that only explores the out-neighbors of nodes that were activated in the previous iteration. This means the work done is proportional to the number of edges connected to activated nodes, which can be much smaller than the size of the entire graph, especially when there are few seed nodes. | ||
|
||
The package also includes utility functions to easily convert well-established NetworkX graphs into the CSR format, allowing for seamless integration into existing research pipelines. | ||
|
||
--- | ||
|
||
## Development | ||
|
||
The development and review process for CyNetDiff was long, partly due to the complex packaging requirements for Cython. | ||
After trying many different tools, we eventually settled on PDM and Meson as the packaging tools for this project. | ||
Our greatest difficulty in converting from prior tools was reasoning through the configuration files necessary | ||
for building and releasing our package. For this task, Google Gemini was an invaluable tool that made packaging with | ||
Meson understandable for our project, even with a long configuration file. | ||
|
||
TODO mention the new AI policy | ||
|
||
--- | ||
|
||
## Citing | ||
|
||
This post is adapted from our [VLDB paper](https://dl.acm.org/doi/abs/10.14778/3685800.3685887), which | ||
should be used for citations. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/pyOpenSci/pyopensci.github.io/blob/main/_data/authors.yml
if you add your name to the authors file the image will then display next to the post :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm already in the author's file