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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dynamic_multiplex-1.0.0.tar.gz.
File metadata
- Download URL: dynamic_multiplex-1.0.0.tar.gz
- Upload date:
- Size: 17.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fadfce9db6b25009a6f6d3b02c69a4294bf6129e5a9190c0477d03c3f41ed69a
|
|
| MD5 |
f6accff10526c49b82a5fcc84ee47e27
|
|
| BLAKE2b-256 |
3db6ec1917bbdc1ba38b31a6941d255ac66a3265a180401e691b3c3277776478
|
File details
Details for the file dynamic_multiplex-1.0.0-py3-none-any.whl.
File metadata
- Download URL: dynamic_multiplex-1.0.0-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3551807f6b0dc869df9e65db1c79391a8b3bb71aa50a2d71fa0884852d115b4
|
|
| MD5 |
e1a8f8fac1474460fef25fa243928757
|
|
| BLAKE2b-256 |
6482c720447b7a3d49e0e789a53fb004c86df278373962717eb656e8f26f98fe
|