Advanced maths

Chromatic symmetric function calculator in the power sum basis

Compute Stanley’s chromatic symmetric function in the power-sum basis with exact integer coefficients.

Your numbers

One zero-based undirected edge per line; no loops or duplicate unordered pairs.

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

Compute Stanley’s chromatic symmetric function in the power-sum basis with exact integer coefficients. Partition labels retain color-class structural information that is lost when specializing to a single-variable chromatic polynomial.

THE FORMULAX_G=Σ_(F⊆E)(−1)^|F| p_(λ(F)), where λ(F) lists component sizes of(V,F).

A worked example

For path0–1–2, the empty edge subset contributes p_(1,1,1), the two single-edge subsets contribute−2p_(2,1), and both edges contribute p_(3). Thus X=p_(1,1,1)−2p_(2,1)+p_(3). Setting p_lambda to q^(number of parts) gives q³−2q²+q.

Good to know

Simple undirected graph1–8 vertices,≤20 edges. Exact integer edge-subset expansion in the power-sum basis,unit vertex weights. At most1048576 subsets. This invariant does not certify graph isomorphism or enumerate arbitrary symmetric-function basis conversions.

A symmetric function retains color information

The chromatic symmetric function sums monomials associated with proper vertex colorings using an unlimited named color set. Symmetry means renaming colors does not change the function, but the pattern of repeated colors remains significant.

The ordinary chromatic polynomial records how many proper colorings exist using q colors. It is a specialization of this richer invariant, rather than enough information to reconstruct it in general. This page returns a finite power-sum expansion of the symmetric function.

A three-vertex path has three partition types012p_(1,1,1) −2p_(2,1) +p_(3)Specialization:q³ −2q² +q
Scroll across to see the full diagram.
For path0–1–2, the empty edge subset contributes p_(1,1,1), the two single-edge subsets contribute−2p_(2,1), and both edges contribute p_(3). Thus X=p_(1,1,1)−2p_(2,1)+p_(3). Setting p_lambda to q^(number of parts) gives q³−2q²+q.

Compare this with the Chromatic polynomial calculator from a graph edge list. The chromatic polynomial collapses color-class structure and does not recover this invariant.

Read a partition as a basis label

A partition is a nonincreasing list of positive integers summing to the number of vertices. The term p_(3,1), for example, is the product p3 times p1, where pk denotes the sum of kth powers of the color variables.

Coefficients in this basis can be negative even though the original coloring interpretation has positive monomials. A negative coefficient therefore does not mean a negative number of colorings; it reflects the chosen algebraic basis and inclusion-exclusion formula.

Edge subsets produce exact component contributions

For each subset of the graph’s edges, keep all declared vertices and determine the sizes of its connected components. Sort those sizes to obtain a partition, then add plus or minus one according to the subset’s edge-count parity.

Aggregating equal partition labels gives the displayed integer coefficients. Isolated vertices contribute singleton parts and cannot be omitted. No numerical approximation or fitted coefficient enters the edge-subset expansion.

A three-vertex path has three partition types

With neither path edge selected, all three vertices are isolated, giving partition(1,1,1) with coefficient one. Each one-edge selection has one component of size two and one singleton, so together they contribute minus two to partition(2,1).

Selecting both edges connects all vertices and contributes plus one to partition(3). These four subsets explain every term of the default result and provide a direct check of the sign convention.

Specialize carefully to check a chromatic polynomial

If only q color variables equal one and all others equal zero, every power sum pk becomes q. Therefore a partition with r parts contributes q to the rth power, independently of its part sizes.

For the path example, the specialization is q³−2q²+q=q(q−1)². Evaluating at q=2 gives two proper colorings. This checks one projection of the symmetric function, but does not preserve all partition-level information.

The exponential bound is visible

The implementation evaluates one contribution for every edge subset, so twenty edges already require more than a million cases. The small declared bounds make this complete expansion practical for instructional graphs.

A graph can be small in vertex count but dense enough to exceed the edge limit. No unsupported large-graph result is fabricated by truncating the expansion. The function is exact within scope, but identical invariants are not claimed to prove that two graphs are isomorphic.

Compare invariants without changing the graph model

Relabeling vertices leaves the symmetric function unchanged, making it useful as one algebraic fingerprint of an unweighted simple graph. The partition coefficients can be compared directly when the same basis and vertex-weight convention are used.

Weighted vertex variants, quasisymmetric refinements and conversions to elementary or Schur bases add mathematical choices absent from this page. Keep those distinctions explicit rather than interpreting the returned power-sum coefficients under another basis convention.

A few questions, answered

Can coefficients be negative?

Yes. Power-sum coefficients use inclusion-exclusion and are not direct coloring counts.

What does a partition label mean?

Its entries index the power sums multiplied in that term, with their sum equal to vertex count.

How do I recover the chromatic polynomial?

Replace each p_lambda by q raised to the number of parts in lambda.

Does the invariant prove graph isomorphism?

No. Equal invariant values are not presented as an isomorphism certificate.

Find your calculator

Start typing to explore the library.