The following Maple code will compute the chromatic symmetric function (CSF) for any graph with specified vertex and edge set. First, you will need to download John Stembridge's SF package, and load it and Maple's networks (i.e., graph theory) and combinatorics packages:
read "SF2.4v.txt": withSF(): with(networks): with(combinat):
Then, define a function "CSF" as follows:
CSF := (V,E) -> add((-1)^(nops(S)) * mul(cat(p,nops(C)), C=components(graph(V,S))), S=powerset(E)):
This takes advantage of Theorem 2.5 of Stanley's paper [Adv. Math. 111 (1995), 166-194] to compute the CSF in the power-sum basis (which you can then play with using the SF routines). For example, here's how you'd compute the CSF of the complete graph in and then express it in terms of elementary symmetric functions:
> CSF({1,2,3},{{1,2},{1,3},{2,3}}); 3 p1 + 2 p3 - 3 p1 p2 > toe(%); 6 e3