Skip to main content

A Multilayer network analysis python3 library

Project description

py3plex logo

Tests Examples Tutorial Code Quality Benchmarks Documentation Formal Verification Fuzzing PyPI version CLI Tool Docker Lines of Code

Multilayer networks are complex networks with additional information assigned to nodes or edges (or both). This library includes some of the state-of-the-art algorithms for decomposition, visualization and analysis of such networks.

Key Features:

  • SQL-like DSL for intuitive network queries with smart defaults
  • Multilayer network visualization and analysis
  • Community detection and centrality measures
  • Network decomposition and embeddings
from py3plex.core import datasets
from py3plex.dsl import Q, UQ
from py3plex.algorithms.community_detection import multilayer_louvain

# 1. Load a built-in multilayer biological network (~500 nodes, 4 layers)
network = datasets.fetch_multilayer("human_ppi_gene_disease_drug")

# 2. Run multilayer community detection
partition_vector, Q_modularity = multilayer_louvain(network, gamma=1.2, random_state=42)
network.assign_partition(partition_vector)

# 3. Find master regulator candidates with uncertainty quantification
master_regulators = (
    Q.nodes()
     .node_type("gene")                        # Filter by node type
     .where(degree__gt=3)                      # Remove peripheral genes
     .uq(method="perturbation", n_samples=100, ci=0.95, seed=42)  # Quantify confidence
     .per_layer()                              # Group by layer
        .compute("degree_centrality", "betweenness_centrality")
        .top_k(20, "betweenness_centrality__mean")  # Top 20 per layer by mean
     .end_grouping()
     .sort(by="betweenness_centrality__mean", descending=True)
     .limit(20)                                # Final top 20 candidates
     .execute(network)
)

df = master_regulators.to_pandas(expand_uncertainty=True)
print(df[["id", "layer", "betweenness_centrality", "betweenness_centrality_std", 
          "betweenness_centrality_ci95_low", "betweenness_centrality_ci95_high"]].head(10))

Emits:

Found 287 communities, modularity = 0.649
    id  layer  betweenness_centrality  betweenness_centrality_std  betweenness_centrality_ci95_low  betweenness_centrality_ci95_high
0  252      0                0.025961                    0.002134                         0.021820                          0.030102
1   91      0                0.024918                    0.002051                         0.020902                          0.028934
2  419      0                0.024184                    0.001987                         0.020298                          0.028070
...

Py3plex Visualization Showcase

Getting Started

Citations

@Article{Skrlj2019,
author={Skrlj, Blaz
and Kralj, Jan
and Lavrac, Nada},
title={Py3plex toolkit for visualization and analysis of multilayer networks},
journal={Applied Network Science},
year={2019},
volume={4},
number={1},
pages={94},
abstract={Complex networks are used as means for representing multimodal, real-life systems. With increasing amounts of data that lead to large multilayer networks consisting of different node and edge types, that can also be subject to temporal change, there is an increasing need for versatile visualization and analysis software. This work presents a lightweight Python library, Py3plex, which focuses on the visualization and analysis of multilayer networks. The library implements a set of simple graphical primitives supporting intra- as well as inter-layer visualization. It also supports many common operations on multilayer networks, such as aggregation, slicing, indexing, traversal, and more. The paper also focuses on how node embeddings can be used to speed up contemporary (multilayer) layout computation. The library's functionality is showcased on both real and synthetic networks.},
issn={2364-8228},
doi={10.1007/s41109-019-0203-7},
url={https://doi.org/10.1007/s41109-019-0203-7}
}

and

@InProceedings{10.1007/978-3-030-05411-3_60,
author="{\v{S}}krlj, Bla{\v{z}}
and Kralj, Jan
and Lavra{\v{c}}, Nada",
editor="Aiello, Luca Maria
and Cherifi, Chantal
and Cherifi, Hocine
and Lambiotte, Renaud
and Li{\'o}, Pietro
and Rocha, Luis M.",
title="Py3plex: A Library for Scalable Multilayer Network Analysis and Visualization",
booktitle="Complex Networks and Their Applications VII",
year="2019",
publisher="Springer International Publishing",
address="Cham",
pages="757--768",
abstract="Real-life systems are commonly represented as networks of interacting entities. While homogeneous networks consist of nodes of a single node type, multilayer networks are characterized by multiple types of nodes or edges, all present in the same system. Analysis and visualization of such networks represent a challenge for real-life complex network applications. The presented Py3plex Python-based library facilitates the exploration and visualization of multilayer networks. The library includes a diagonal projection-based network visualization, developed specifically for large networks with multiple node (and edge) types. The library also includes state-of-the-art methods for network decomposition and statistical analysis. The Py3plex functionality is showcased on real-world multilayer networks from the domains of biology and on synthetic networks.",
isbn="978-3-030-05411-3"
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py3plex-1.0.2.tar.gz (999.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py3plex-1.0.2-py3-none-any.whl (749.2 kB view details)

Uploaded Python 3

File details

Details for the file py3plex-1.0.2.tar.gz.

File metadata

  • Download URL: py3plex-1.0.2.tar.gz
  • Upload date:
  • Size: 999.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for py3plex-1.0.2.tar.gz
Algorithm Hash digest
SHA256 dcc2b1a4ab670c680eef926fe2f021c27b1ba8d9600e4549a20bf8fb7f35562f
MD5 f9fffef5509d01ecb2568d1c1e3fe74a
BLAKE2b-256 7edb33c7e62a8cda642fd03c85640301c240c3937f4f617fef97ed7904c43814

See more details on using hashes here.

File details

Details for the file py3plex-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: py3plex-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 749.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for py3plex-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 88f223b67c8735ac4d8e02970444d5589aea33196033fb68224643ec1f7b0eed
MD5 30794b8347d3793e424107c343353b62
BLAKE2b-256 b5f83c6f85e2cb32b66b5e65bf81047c30f92d648a388c73b245a389f857fb18

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page