Metadata-Version: 2.2
Name: cluster_algebra
Version: 0.1.2
Summary: calculator for cluster algebras
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: numpy>=2.0.2
Requires-Dist: pandas>=2.2.3
Requires-Dist: matplotlib>=3.9.2
Requires-Dist: networkx>=3.2.1
Requires-Dist: scipy>=1.13.1
Requires-Dist: sympy>=1.13.3
Requires-Dist: shapely>=2.0.6
Requires-Dist: pydantic>=2.9.2
Provides-Extra: dev
Requires-Dist: pytest>=8.3.3; extra == "dev"
Dynamic: description
Dynamic: description-content-type
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# cluster algebra calculator

This library provides a calculator for cluster algebras. 
Especially it is useful for calculating algebraic relations and visualizing quivers

## requirements

- python >= 3.8
- sympy
- pandas

## Installation

```bash
pip install cluster_algebra
```

## Usage

```
from cluster_algebra import *

q = Quiver(vertices=range(14), 
	clusters=[(1, 13), (2, 13), (2, 12), (2, 11), (2, 10), (3, 10), (4, 10), (5, 10), (5, 9), (6, 9), (6, 8)], 
	laminations=[
	# [(0, 8)], 
	# [(4, 12)]
], is_principal=True)
```

Create a quiver (with vertices from 0 to 13) and make triangulations as clusters. When adding laminations, you can use indices (first 0 means the frozen edge 0-1, second 8 means frozen edge 8-9). If is_principal is True, same number of principal laminations will be added **before than you added manually**. 

After creating a quiver instance, you can 
- flip some variables, 
```
q.flip(edge=(3, 10))
# or
q.flip(index=3)
```
- get exchange matrix, 
```
q.get_exchange_matrix()
```
- express target variable, 
```
from IPython.display import display, Math

q2 = q.express_target()

for rel in q2.relations:
    display(Math(rel._repr_latex_()))

for rel in q2.expressions:
    display(Math(rel._repr_latex_()))
```
- plotting polygon with Plotter
```
from math import pi

p = Plotter()

p.plot_quiver(q, rotation=pi, lamination_label_pos=0.7)
```
