tutte_polynomial#

tutte_polynomial(k: PlanarDiagram, variables='xy')#

Compute the Tutte polynomial of a planar graph represented as a PlanarDiagram.

The Tutte polynomial is a two-variable polynomial known for its applications in graph theory, combinatorics, and statistical physics. This function computes the Tutte polynomial for planar graphs without crossings.

Parameters:#

kPlanarDiagram

A planar graph represented as a PlanarDiagram object. The input graph must be free of crossings.

variablesstr or iterable[Symbol], optional, default=”xy”

A string (of length 2) or an iterable containing two variables to be used in the Tutte polynomial (e.g., “xy” or [x, y]). If using a string, its two characters will be interpreted as symbolic variables.

Raises:#

ValueError

If k is not a planar graph (i.e., it contains crossings).

Returns:#

sympy.Expr

The symbolic representation of the Tutte polynomial as a sympy.Expr object.

Notes:#

  1. The function uses a recursive contraction-deletion approach to compute the polynomial by traversing and simplifying the arcs in the graph.

Examples:#

Compute the Tutte polynomial for a wheel graph with 4 nodes:

```python from knotpy.catalog.graphs import wheel_graph from tutte import tutte_polynomial

w = wheel_graph(4) polynomial = tutte_polynomial(w) print(polynomial) ```