A 3D simplicial complex visualizer
Project description
Zen Sight
A (work in progress) simplicial complex visualization python package which combines a React frontend with a Python backend to provide interactive 2D and 3D visualizations.
Features
- 🎯 Interactive Visualizations: 2D and 3D simplicial complex rendering using react-force-graph and Three.js
- 🖱️ Selection Functionality: Single, multi, and lasso selection tools for nodes
- ✂️ Graph Operations: Node cutting and splitting.
- ⏱️ Timeline Replay: Replay and review graph operations with the timeline
- 🔗 Integration: Built-in adapters for NetworkX and Zen Mapper
Installation
pip install zen-sight
Quick Start
Creating Simplicial Complexes
from zen_sight import Sight
def create_simplicial_complex():
"""Create a graph with 2-simplices"""
# nodes in a hexagonal pattern
nodes = []
positions = [
(0, 0),
(1, 0),
(0.5, 0.87),
(-0.5, 0.87),
(-1, 0),
(-0.5, -0.87),
(0.5, -0.87),
]
for i, (x, y) in enumerate(positions):
nodes.append(
{
"id": i,
"name": f"Node {i} <br> {'center' if i == 0 else 'outer'}",
"x": x * 50,
"y": y * 50,
"z": 0,
"group": "center" if i == 0 else "outer",
}
)
links = []
# connect center to all others
for i in range(1, 7):
links.append({"source": 0, "target": i})
# connect outer nodes
for i in range(1, 7):
next_i = (i % 6) + 1
links.append({"source": i, "target": next_i})
faces = [
(0, 1, 2), # center with each adjacent pair in outer ring
(0, 2, 3),
(0, 3, 4),
(0, 4, 5),
(0, 5, 6),
(0, 6, 1),
]
return nodes, links, faces
def main():
sight = Sight()
nodes, links, faces = create_simplicial_complex()
sight.set_nodes(nodes)
sight.set_links(links)
sight.set_faces(faces)
sight.set_config(
{
"nodeAutoColorBy": "group",
"nodeRelSize": 4,
"nodeLabel": "name",
"nodeOpacity": 1,
"linkColor": "#000000",
"linkWidth": 2,
"linkOpacity": 1,
# Simplex appearance: alpha is for 2D version and will be ignored
# in favor of faceOpacity for 3D
"faceFillColor": "rgba(52, 152, 219, 0.3)",
"faceStrokeColor": "rgba(52, 152, 219, 0.5)",
"faceStrokeWidth": 1,
"faceOpacity": 0.3,
}
)
sight.show()
if __name__ == "__main__":
main()
Zen Mapper Integration
import zen_mapper as zm
from zen_sight.adapters import vis_zen_mapper
import numpy as np
from sklearn.decomposition import PCA
from sklearn.cluster import DBSCAN
def circle(n=100):
theta = np.linspace(0, 2 * np.pi, n)
x = np.cos(theta)
y = np.sin(theta)
return np.c_[x, y]
def main():
data = circle()
proj = PCA(n_components=1).fit_transform(data)
result = zm.mapper(
data=data,
cover_scheme=zm.Width_Balanced_Cover(percent_overlap=0.2, n_elements=6),
projection=proj,
dim=1,
clusterer=zm.sk_learn(DBSCAN(eps=0.2)),
)
vis_zen_mapper(result)
if __name__ == "__main__":
main()
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
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 zen_sight-0.1.4.tar.gz.
File metadata
- Download URL: zen_sight-0.1.4.tar.gz
- Upload date:
- Size: 2.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fad0dec93c4fcb4fea178971a0b7dee1640ed9392e1a76cae9db58ad77e5e18
|
|
| MD5 |
e751dd4659a1501ea6eeef6be1599d51
|
|
| BLAKE2b-256 |
1685afbf66fbe4b2d6e7726c95a51d716038ceba0e639eb10b1b0cf45dd89b95
|
Provenance
The following attestation bundles were made for zen_sight-0.1.4.tar.gz:
Publisher:
python-publish.yml on Jamiller137/zen-sight
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zen_sight-0.1.4.tar.gz -
Subject digest:
5fad0dec93c4fcb4fea178971a0b7dee1640ed9392e1a76cae9db58ad77e5e18 - Sigstore transparency entry: 233566707
- Sigstore integration time:
-
Permalink:
Jamiller137/zen-sight@54fcee0d0498ce258f4cacfdab9aea3323a11670 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/Jamiller137
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@54fcee0d0498ce258f4cacfdab9aea3323a11670 -
Trigger Event:
release
-
Statement type:
File details
Details for the file zen_sight-0.1.4-py3-none-any.whl.
File metadata
- Download URL: zen_sight-0.1.4-py3-none-any.whl
- Upload date:
- Size: 2.3 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c660423f4a228dfe1e6e1f23cff9a689ba038c415ec5b3664e4dc300e337105
|
|
| MD5 |
496c9426aa3adab60ea9c838444e0c7c
|
|
| BLAKE2b-256 |
cd8058b59e53db708e0627ae0b67ff2a8939d465dad03053d9242bbaec0098e3
|
Provenance
The following attestation bundles were made for zen_sight-0.1.4-py3-none-any.whl:
Publisher:
python-publish.yml on Jamiller137/zen-sight
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zen_sight-0.1.4-py3-none-any.whl -
Subject digest:
5c660423f4a228dfe1e6e1f23cff9a689ba038c415ec5b3664e4dc300e337105 - Sigstore transparency entry: 233566709
- Sigstore integration time:
-
Permalink:
Jamiller137/zen-sight@54fcee0d0498ce258f4cacfdab9aea3323a11670 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/Jamiller137
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@54fcee0d0498ce258f4cacfdab9aea3323a11670 -
Trigger Event:
release
-
Statement type: