What is py3plex?

py3plex is a Python library for scalable analysis and visualization of multilayer and multiplex networks.

Key Features

Multilayer Network Structures

py3plex provides native support for:

  • Multiplex networks — Same nodes across multiple layers (e.g., social networks with friendship, collaboration, and family ties)

  • Heterogeneous networks — Different node types across layers (e.g., author-paper-venue networks)

  • Temporal networks — Networks that evolve over time with temporal attributes

All network types are first-class citizens with consistent APIs.

SQL-like DSL for Network Queries

Query networks using intuitive SQL-inspired syntax:

from py3plex.dsl import execute_query

# String DSL: readable and concise
result = execute_query(network,
    'SELECT nodes WHERE layer="social" AND degree > 5 '
    'COMPUTE betweenness_centrality'
)

Or use the type-safe builder API:

from py3plex.dsl import Q, L

# Builder API: with IDE autocompletion
result = (
    Q.nodes()
     .from_layers(L["social"])
     .where(degree__gt=5)
     .compute("betweenness_centrality")
     .execute(network)
)

The DSL makes complex network analyses readable and maintainable.

Comprehensive Algorithm Suite

py3plex includes 17+ multilayer-specific algorithms:

  • Community detection: Louvain, Infomap, multilayer modularity

  • Centrality measures: Multilayer PageRank, betweenness, versatility

  • Random walks: Node2Vec, DeepWalk for network embeddings

  • Dynamics: SIR/SIS epidemic models, diffusion processes

All algorithms handle multilayer structure natively without flattening.

Publication-Ready Visualizations

Create professional network diagrams with:

  • Automatic multilayer layouts

  • Customizable styling and colors

  • Support for large networks (1000+ nodes)

  • Export to multiple formats (PNG, PDF, SVG)

High-Performance I/O

  • Apache Arrow/Parquet support for large datasets

  • NetworkX compatibility for easy integration

  • Multiple input formats (edge lists, adjacency matrices, JSON)

What Makes py3plex Unique?

Native Multilayer Representation

Unlike tools that flatten multilayer networks into single-layer graphs, py3plex preserves the multilayer structure throughout the analysis pipeline. This leads to more accurate results for multilayer-specific properties.

Node-Layer Pair Abstraction

py3plex represents multilayer networks using node-layer pairs: a node in layer A is distinct from the same node in layer B. This clean abstraction enables:

  • Layer-specific queries

  • Inter-layer and intra-layer edge differentiation

  • Efficient supra-adjacency matrix operations

Production-Ready Design

py3plex is designed for both research and production:

  • Sklearn-style pipelines for reproducible workflows

  • Comprehensive type hints and documentation

  • Extensive test suite (500+ tests)

  • CLI and Docker deployment options

When to Use py3plex?

py3plex is ideal when you have:

  • Multiple relationship types between entities (e.g., email + phone + in-person contacts)

  • Heterogeneous networks with different node types (e.g., users, posts, hashtags)

  • Temporal networks where relationships change over time

  • Need for layer-specific analysis (e.g., comparing community structure across layers)

If you only need single-layer network analysis, NetworkX or igraph might be simpler choices.

Next Steps