Py3plex Documentation
py3plex enables scalable analysis and visualization of multilayer and multiplex networks in Python, supporting complex network modeling across diverse scientific and applied domains.
Overview
py3plex is a lightweight Python library designed specifically for analyzing and visualizing heterogeneous and multilayer networks. Unlike traditional network analysis tools that focus on homogeneous networks (single node and edge type), py3plex provides specialized capabilities for networks with:
Multiple node types
Multiple edge types
Multiple layers of interaction
Temporal dynamics
Heterogeneous attributes
Target Users: Researchers in network science, computational biology, complex systems, social network analysis, and applied network modeling.
Key Features:
Native support for multiplex and multilayer network structures
Diagonal projection visualization for large multilayer networks
Comprehensive multilayer centrality measures
Community detection across network layers
Network decomposition and feature extraction
Semantic enrichment with external knowledge bases
Integration with NetworkX, igraph, and other graph libraries
Installation
Install from GitHub
pip install git+https://github.com/SkBlaz/py3plex.git
Docker Installation (Alternative)
py3plex is also available as a Docker container with all dependencies pre-installed:
# Clone and build
git clone https://github.com/SkBlaz/py3plex.git
cd py3plex
docker build -t py3plex:latest .
# Run commands
docker run --rm py3plex:latest --version
docker run --rm py3plex:latest selftest
See Docker Usage Guide for complete Docker documentation.
Install from source for development
git clone https://github.com/SkBlaz/py3plex.git
cd py3plex
pip install -e .
Optional Dependencies
# Advanced community detection with Infomap
pip install git+https://github.com/SkBlaz/py3plex.git#egg=py3plex[infomap]
# Additional algorithms (Louvain, cdlib)
pip install git+https://github.com/SkBlaz/py3plex.git#egg=py3plex[algos]
# Advanced visualization (plotly, igraph)
pip install git+https://github.com/SkBlaz/py3plex.git#egg=py3plex[viz]
# For development (includes testing and linting tools)
pip install -e ".[dev]"
Requirements
Python 3.8 or higher
NetworkX, NumPy, SciPy (automatically installed)
Optional: Matplotlib, Plotly for visualization
Quick Start
Create a simple multilayer network:
from py3plex.core import multinet
# Create a new multilayer network
network = multinet.multi_layer_network()
# Add edges within layers
network.add_edges([
['A', 'layer1', 'B', 'layer1', 1],
['B', 'layer1', 'C', 'layer1', 1],
['A', 'layer2', 'B', 'layer2', 1],
], input_type="list")
# Display basic statistics
network.basic_stats()
# Visualize
from py3plex.visualization.multilayer import draw_multilayer_default
draw_multilayer_default([network], display=True)
Load from file and analyze:
# Load from edge list
network = multinet.multi_layer_network().load_network(
"data.edgelist", input_type="edgelist", directed=False)
# Compute multilayer statistics
from py3plex.algorithms.statistics import multilayer_statistics as mls
density = mls.layer_density(network, 'layer1')
versatility = mls.versatility_centrality(network, centrality_type='degree')
# Community detection
from py3plex.algorithms.community_detection import community_wrapper
communities = community_wrapper.best_partition(network.core_network)
Why py3plex?
vs. NetworkX
NetworkX excels at single-layer homogeneous networks but lacks native multilayer support. py3plex builds on NetworkX while adding:
Native multilayer data structures
Layer-aware algorithms
Specialized multilayer visualizations
Heterogeneous network decomposition
vs. Other Multilayer Tools
py3plex provides:
Lightweight and easy to integrate
Comprehensive statistical measures (17+ multilayer metrics)
Publication-ready visualizations
Active development and research backing
Use Cases
py3plex is particularly well-suited for:
Biological networks: Protein-protein interactions with multiple evidence types, gene regulatory networks
Social networks: Multi-platform analysis (Twitter + Facebook), relationship type analysis
Citation networks: Author-paper-venue multilayer structures, knowledge graphs
Transportation: Multi-modal networks (bus, train, air), urban mobility
Temporal networks: Evolving social networks, dynamic community evolution
What’s in this Documentation?
This documentation is organized to help different types of users find what they need quickly:
New to py3plex? Start with 5-Minute Quickstart for a 5-minute introduction, then explore 10-Minute Tutorial: Getting Started with py3plex for a comprehensive walkthrough.
Power users? Jump to the Working with Networks and other user guide sections for detailed how-tos, or browse the Examples for working code.
Want to understand the concepts? Check out Multilayer Networks 101 and py3plex Core Model for deep conceptual explanations.
Deploying in production? See the Docker Usage Guide and Performance and Scalability Best Practices guides.
Contributing? Read the Development Guide and Contributing to py3plex pages.
Documentation Contents
Getting Started
- 5-Minute Quickstart
- 10-Minute Tutorial: Getting Started with py3plex
- What You Will Learn
- Prerequisites
- 1. Creating Your First Multilayer Network (2 minutes)
- 2. Loading Networks from Files (1 minute)
- 3. Exploring Network Structure (2 minutes)
- 4. Computing Network Metrics (2 minutes)
- 5. Multilayer Network Statistics (2 minutes)
- 6. Community Detection (2 minutes)
- 7. Random Walks (1 minute)
- 8. Basic Visualization (1 minute)
- Complete Example: Putting It All Together
- Next Steps
- Common Issues
- Tips for Success
- Installation and Setup
- Common Issues and Troubleshooting
Concepts & Architecture
User Guide
Environments & Deployment
Py3plex GUI
Developer & Contributor Docs
- Development Guide
- Architecture and Design
- Repository Layout
- Overview
- Main Package (py3plex/)
- Documentation (docfiles/)
- Examples (examples/)
- Tests (tests/)
- GUI (gui/)
- Datasets (datasets/)
- Benchmarks (benchmarks/)
- CI/CD (.github/)
- Configuration Files
- Working with the Repository
- Finding Things
- File Naming Conventions
- Important Files
- Directory Conventions
- Package Distribution
- Related Documentation
- Contributing to py3plex
Examples
Reference & Citation
- Algorithm Roadmap
- Algorithm Categories
- Community Detection Algorithms
- Centrality Measures
- Network Statistics
- Node Ranking & Classification
- Random Walks & Embeddings
- Visualization Algorithms
- Benchmark & Utilities
- Algorithm Selection Guide
- Algorithm Dependencies
- Common Algorithm Workflows
- Further Reading
- Citation Information
- API Documentation
- Core Modules
- Configuration and Utilities
- Algorithms
- Visualization
- Wrappers
- I/O Operations
- Profiling Utilities
- Logging Configuration
- I/O Schema and Validation
- Hedwig Rule Learning
- Force Atlas 2 Visualization
- Embedding Visualization
- Network Generation and Benchmarking
- Additional Statistics and Analysis
- Community Detection Advanced
- Node Ranking and Classification
- Embeddings and Wrappers
- Network Motifs and Patterns
- HINMINE Data Structures
- Command-Line Interface
- Validation Utilities
- Network Comparison and Testing
- Hedwig Learning Algorithms
- Hedwig Statistics and Scoring
- Hedwig Core Components
- Time Series and Temporal Analysis
- Advanced Visualization
- Link Prediction
- Citation and References
Examples
The best way to learn py3plex is through examples.
All examples are available in the examples/ directory.
Key examples:
tutorial_10min.py- Executable version of the 10-minute tutorialexample_random_walks.py- Random walk primitives (Node2Vec, DeepWalk)example_multilayer_visualization.py- Network visualizationexample_community_detection.py- Community detection with Louvain and Infomapexample_network_decomposition.py- Meta-path feature extractionexample_multilayer_statistics.py- Computing multilayer metricsexample_n2v_embedding.py- Node2Vec embeddingsexample_label_propagation.py- Semi-supervised learning
Citation
If you use py3plex in your research, please cite:
@Article{Skrlj2019,
author={Škrlj, Blaž and Kralj, Jan and Lavrač, Nada},
title={Py3plex toolkit for visualization and analysis of multilayer networks},
journal={Applied Network Science},
year={2019},
volume={4},
number={1},
pages={94},
doi={10.1007/s41109-019-0203-7}
}