tusc

tools for combinatorial maths

PyPI version Documentation Status Build Status Downloads MIT license GitHub version

Summary

tusc is work-in-progress Python library providing tools for combinatorial maths (partially-ordered sets, graph polynomials, etc.). Documentation is available on Read the Docs. You can install a preliminary version of tusc using pip.

Example Usage

Create a Boolean lattice B5, and check if it is an Eulerian poset:

>>> examples = tusc.posets.ExamplePosets()
>>> boolean_lattice = examples.boolean_lattice(5)
>>> p = tusc.posets.Poset(boolean_lattice)
>>> print(p.is_Eulerian())
True

Compute the Tutte polynomial for the cycle graph C5, and use it to find the number of acyclic orientations of C5:

>>> tutte_C5 = tusc.graph.polynomial.Tutte(nx.cycle_graph(5))
>>> print(tutte_C5.polynomial)
'x**4 + x**3 + x**2 + x + y'
>>> tutte_C5.evaluate(2, 0)
30