This generalized Network Diffusion Model code provides a physics-inspired framework to analyze how perturbations or information spread across a network, under either continuous or discrete dynamics. It’s used in contexts like:
diffusion of signals or diseases,
entropy-based centrality and influence measures,
community detection and network comparison,
and recently, network thermodynamics.
You can plug in the Jacobian instead of Laplacian--- and make it a new function.
two small example of usage, more are found in the example directory:
first with continuos
importndmimportnetworkxasnxg=nx.erdos_renyi_graph(30,.2)
H=ndm.diffusion_operator_continuous(g)
tau=3rho , S , Z , F=ndm.network_thermodynamics(H, tau, continuous=True)Second discrete
importndmimportnetworkxasnxg=nx.erdos_renyi_graph(30,.2)
H=ndm.diffusion_operator_discrete(g)
tau=3rho , S , Z=ndm.network_thermodynamics(H, tau, continuous=False)This is the repository tree:
├── example
│ ├── animate_rho.py
│ ├── example_continuous.py
│ ├── example_discrete.py
│ ├── plot_density_matrix.py
│ └── plot_diffusion.py
├── LICENSE
├── pyproject.toml
├── README.md
└── src
└── ndm
├── generalizedNDM.py
├── __init__.py
├── operators.py
├── propagators.py
└── thermodynamics.py