Minimal Matplotlib visualizations for TensorKrowch tensor networks.
Project description
Tensor-Network-Visualization
Minimal Matplotlib visualizations for TensorKrowch tensor networks.
Repository: https://github.com/DOKOS-TAYOS/Tensor-Network-Visualization
Features
- 2D and 3D plotting for TensorKrowch tensor networks
- Tensors rendered as nodes
- Contractions rendered as edges between tensors
- Dangling indices rendered as labeled stubs
- Self-contractions rendered as loops
- No UI; uses Matplotlib for rendering and NetworkX for graph layouts
Installation
As a dependency
Add to your project's pyproject.toml:
[project]
dependencies = ["tensor-network-visualization>=0.1.0"]
Or install with pip:
pip install tensor-network-visualization
Local development
Inside the project virtual environment:
.\.venv\Scripts\python -m pip install -e ".[dev]"
For runtime-only (editable install without dev tools):
.\.venv\Scripts\python -m pip install -e .
Usage
Networks must expose nodes or leaf_nodes (iterable or dict). Each node must have edges, axes_names, and name. Each edge must have node1, node2, and name.
from tensor_network_viz import PlotConfig, show_tensor_network
config = PlotConfig(figsize=(8, 6))
fig, ax = show_tensor_network(
network,
engine="tensorkrowch",
view="2d",
config=config,
)
You can also use the TensorKrowch-specific helpers directly:
from tensor_network_viz.tensorkrowch import plot_tensorkrowch_network_2d, plot_tensorkrowch_network_3d
Project layout
examples/— Demo scripts. Runpython examples/tensor_network_demo.py mps 2dfrom the project root.scripts/— Utility scripts (e.g.clean.pyto remove caches and build artifacts).
Development
.\.venv\Scripts\python -m ruff check .
.\.venv\Scripts\python -m pyright
.\.venv\Scripts\python -m pytest
Project details
Release history Release notifications | RSS feed
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 tensor_network_visualization-1.0.0.tar.gz.
File metadata
- Download URL: tensor_network_visualization-1.0.0.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ebe022806237374d582bd15a36d67429d24215047e207a86c007cb44685b706
|
|
| MD5 |
7b993dea6c0d268d73d16a71b7b29939
|
|
| BLAKE2b-256 |
61109baff1e63bc20fe89502ed467b77edd53c83ff4faeeec4e050b01ee0cdba
|
File details
Details for the file tensor_network_visualization-1.0.0-py3-none-any.whl.
File metadata
- Download URL: tensor_network_visualization-1.0.0-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1465bc680eaf06f49679d5b43b62988743303a9c1ee6686e83472b1540758658
|
|
| MD5 |
b2632db838fc43ddcf6f93ce338f2f31
|
|
| BLAKE2b-256 |
8bc4f37f38a231a913992de43373cb647c9d8ddd51a280a13051b52345e2cac9
|