Advanced maths

Tutte polynomial calculator from a graph edge list

The Tutte polynomial records rank and cycle-nullity information across every edge subset of a graph.

Your numbers

Vertices are indexed 0 through n−1.
Rows from,to,weight; absent weight means one. Leave empty for no edges.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

The Tutte polynomial records rank and cycle-nullity information across every edge subset of a graph. This calculator expands its exact bivariate coefficients and reports useful evaluations. A subset formulation keeps disconnected graphs well defined and avoids confusing the full invariant with only its chromatic-polynomial specialization.

THE FORMULAT_G(x,y)=Σ_(A subset E)(x−1)^(r(E)−r(A))(y−1)^(|A|−r(A)).

A worked example

For a triangle, T(x,y)=x²+x+y. Evaluating at (1,1) gives three spanning trees, while T(2,1)=4+2+1=7 counts spanning forests. The full edge set contributes the cycle term; acyclic subsets contribute the remaining rank terms.

Good to know

Simple undirected input, at most 12 vertices and 18 edges. Exact big-integer coefficients with exponential subset enumeration. For disconnected graphs, T(1,1) counts maximal spanning forests, not nonexistent spanning trees. No unlimited-size symbolic solver.

Rank and nullity summarize each edge subset

For an edge subset, rank is the number of vertices minus its connected-component count. Nullity is subset size minus that rank, measuring its independent cycle contribution. The Tutte expansion combines the deficits relative to full-graph rank with those nullities, retaining information that cannot generally be recovered from one scalar graph statistic.

The input graph is simple and undirected, but disconnected vertex sets remain meaningful. Isolated vertices affect component counts consistently without adding edges. This treatment keeps the rank definition valid across the full subset expansion instead of assuming a spanning tree exists in every input graph.

The triangle Tutte polynomial records both rank and cycle information012T(x,y) = x²+x+yT(1,1) = 3T(2,1) = 7
For a triangle, T(x,y)=x²+x+y. Evaluating at (1,1) gives three spanning trees, while T(2,1)=4+2+1=7 counts spanning forests. The full edge set contributes the cycle term; acyclic subsets contribute the remaining rank terms.

The Chromatic polynomial calculator from a graph edge list covers the nearby task. Tutte includes two-variable rank/nullity information; the existing chromatic specialization cannot recover it.

Exact expansion preserves the complete invariant

Each term initially contains powers of x minus one and y minus one. Expanding those binomials produces ordinary monomial coefficients, including intermediate signed contributions that cancel. Big-integer arithmetic avoids a numerical rounding error turning one of those cancellations into a small spurious nonzero coefficient.

The final polynomial has nonnegative coefficients for the supported graph class, providing a useful supplementary check. That positivity alone would not identify the correct polynomial. Independent verification also compares the rank-nullity sum with a deletion-contraction implementation, which organizes the same combinatorics through a different sequence of smaller graph problems. Edge labels do not affect the polynomial, providing a separate invariance test under consistent vertex and edge reordering.

Evaluations depend on graph connectedness

At one,one, a connected graph’s value counts spanning trees. For a disconnected graph, it instead counts maximal spanning forests, with one spanning tree in each component. Calling that value a spanning-tree count without the connectedness qualification would misdescribe an otherwise correct polynomial evaluation.

The triangle has three displayed terms and simple evaluations that can be checked by listing its subsets. Larger graphs quickly require exponentially more states, so the edge cap is strict. The page does not promise unlimited symbolic simplification, accept unvalidated input loops or present the chromatic specialization as a replacement for the full bivariate answer.

Read rank and nullity in the subset formula

For each edge subset A, let r(A)=|V|−k(A), where k(A) counts connected components including isolated vertices. The Tutte polynomial is ΣA(x−1)^(r(E)−r(A))(y−1)^(|A|−r(A)). The first exponent measures rank still missing from the full graph; the second measures independent cycles already present in the subset.

The implementation expands those shifted powers into coefficients of ordinary x and y using exact integers. A table row with powers (2,0) and coefficient one means x². Do not read the rows as coefficients of (x−1) and (y−1), and do not treat a missing row as an unevaluated symbolic term.

Build the polynomial of a triangle

A triangle has rank 2. Its empty subset contributes (x−1)²; its three one-edge subsets contribute 3(x−1); its three two-edge spanning trees contribute 3; and the full three-edge cycle contributes y−1. Adding and simplifying gives x²+x+y.

Evaluating at (1,1) gives 3, the number of spanning trees. At (2,1) it gives 7, the number of acyclic spanning edge subsets, including the empty subset. These are different counts. A path with two edges is a tree and has polynomial x², giving one spanning tree but four spanning forests at (2,1).

Handle disconnected graphs without calling forests trees

When the graph has several components, no spanning tree connects all vertices. T(1,1) instead counts choices of a spanning tree within each connected component, together forming a maximal spanning forest. Isolated vertices contribute a one-vertex component and do not need an edge.

For two disjoint edges, the polynomial is x² and T(1,1)=1, although the graph has no global spanning tree. This is not a contradiction; the interpretation changed with connectivity. The form retains all declared vertices when calculating ranks, so omitting isolated vertices from the declared vertex count changes the graph even if the edge list looks unchanged.

Use exact coefficients within the enumeration bound

There are 2^m subsets for m edges, which explains the 18-edge cap. Exact integer coefficients avoid overflow into imprecise floating-point counts, but they do not make the exponential enumeration scalable. A larger graph needs a more specialized symbolic or graph-decomposition method.

The input is simple and undirected. Although the Tutte polynomial has a broader multigraph definition and deletion–contraction theory, this form does not accept parallel edges or loops. Do not merge parallel edges as one while expecting the same polynomial. The displayed evaluations are useful consistency checks, but matching one evaluation alone does not uniquely determine the full polynomial.

A few questions, answered

What does T(1,1) count?

Spanning trees for a connected graph, or maximal spanning forests for a disconnected graph.

Are coefficients exact?

Yes. Subset expansion and cancellations use big integers.

Why does T(1,1) return a positive value for a disconnected graph?

It counts maximal spanning forests, with a spanning tree inside each component. It does not claim a global spanning tree exists.

Are the coefficient-table powers shifted by one?

No. The output is expanded in ordinary x and y. A row with exponents 2 and 0 represents a coefficient of x².

Find your calculator

Start typing to explore the library.