Skip to main content

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. Run python examples/tensor_network_demo.py mps 2d from the project root.
  • scripts/ — Utility scripts (e.g. clean.py to remove caches and build artifacts).

Development

.\.venv\Scripts\python -m ruff check .
.\.venv\Scripts\python -m pyright
.\.venv\Scripts\python -m pytest

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

tensor_network_visualization-1.0.0.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

tensor_network_visualization-1.0.0-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file tensor_network_visualization-1.0.0.tar.gz.

File metadata

File hashes

Hashes for tensor_network_visualization-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9ebe022806237374d582bd15a36d67429d24215047e207a86c007cb44685b706
MD5 7b993dea6c0d268d73d16a71b7b29939
BLAKE2b-256 61109baff1e63bc20fe89502ed467b77edd53c83ff4faeeec4e050b01ee0cdba

See more details on using hashes here.

File details

Details for the file tensor_network_visualization-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tensor_network_visualization-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1465bc680eaf06f49679d5b43b62988743303a9c1ee6686e83472b1540758658
MD5 b2632db838fc43ddcf6f93ce338f2f31
BLAKE2b-256 8bc4f37f38a231a913992de43373cb647c9d8ddd51a280a13051b52345e2cac9

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