dynamic_multiplex (Python)
dynamic_multiplex is a Python package for multiplex community modeling with customizable interlayer ties.
Why this package
Standard multislice approaches (Mucha et al. 2010) connect all layers to all layers, meaning community structure at distant time periods influences assignments everywhere. When applied to temporal data, this creates a pooling problem: the community configuration at 2010 affects the structure detected at 1950. dynamic_multiplex provides explicit control over which layers influence which layers via a layer_links argument (from, to, weight), defaulting to adjacent-only temporal coupling.
Functions
fit_multilayer_jaccard()- Fits Louvain or Leiden communities on each layer.
- Builds interlayer ties between communities using Jaccard similarity across selected layer pairs.
fit_multilayer_overlap()- Fits Louvain or Leiden communities on each layer.
- Builds interlayer ties between communities using overlap coefficient across selected layer pairs.
fit_multilayer_weighted_jaccard()- Fits Louvain or Leiden communities on each layer.
- Builds interlayer ties using node-strength weighted Jaccard similarity across selected layer pairs.
fit_multilayer_weighted_overlap()- Fits Louvain or Leiden communities on each layer.
- Builds interlayer ties using node-strength weighted overlap coefficient across selected layer pairs.
fit_multilayer_identity_ties()- Fits Louvain or Leiden communities on each layer.
- Builds interlayer ties only for the same node across selected adjacent layers.
simulate_and_fit_multilayer()- Simulates multiplex layers from a planted partition process and runs one of the three fitting strategies.
Installation (development)
pip install -e ./python_code
Optional algorithms:
pip install -e ./python_code[louvain]
pip install -e ./python_code[leiden]
Quick example
from dynamic_multiplex import simulate_and_fit_multilayer, fit_multilayer_overlap
sim = simulate_and_fit_multilayer(
directed=True,
n_nodes=50,
n_layers=4,
n_communities=3,
fit_type="jaccard",
algorithm="louvain",
seed=123,
)
print(sim["fit"]["interlayer_ties"].head())
custom_links = [
{"from": 1, "to": 2, "weight": 1.0},
{"from": 2, "to": 4, "weight": 0.6},
]
fit_overlap = fit_multilayer_overlap(
sim["layers"],
algorithm="leiden",
layer_links=custom_links,
min_similarity=0.1,
add_self_loops=True,
self_loop_multiplier=1.0,
)
Testing
pip install -e ./python_code[dev,louvain]
pytest
Release files for dynamic-multiplex 1.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dynamic_multiplex-1.3.1.tar.gz | 34.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dynamic_multiplex-1.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 65.5 kB
Release files / dynamic_multiplex-1.3.1.tar.gz
| Download URL | dynamic_multiplex-1.3.1.tar.gz |
|---|---|
| Size | 34.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9cea42cef4edb7637838cec734dd0bc5cc6584390f8b5d564540a94b35a496c2
|
|
BLAKE2b-256 checksum How to use checksums |
e92ee387ecdac43d72e4d389fe3d484408d79b8f3ff9974cdc69f323d3080be8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / dynamic_multiplex-1.3.1-py3-none-any.whl
| Download URL | dynamic_multiplex-1.3.1-py3-none-any.whl |
|---|---|
| Size | 31.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6523d988802d3e140c896bb0ace75969a25da819e9c17501f04e659a73ca22c3
|
|
BLAKE2b-256 checksum How to use checksums |
d0160f17961c536aae8900938e5c1426b2be39d30f94518a300097e73b185940
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|