This paper contributes to a programme initiated by the first author_ "How much information about a graph is revealed in its Potts partition function?" We show that the W-polynomial distinguishes non-isomorphic weighted trees of a good family. The framework developed to do so also allows us to show that the W-polynomial distinguishes nonisomorphic caterpillars.
This establishes Stanley's isomorphism conjecture for caterpillars, an extensively studied problem.