Solution (source code)

= Solution

Choose the central vertex's color in $x$ ways. Every rim vertex must avoid that color, so the rim is a cycle colored using the remaining $x-1$ colors. Hence
$$
\boxed{p_{W_{n+1}}(x)=x\bigl((x-2)^n+(-1)^n(x-2)\bigr)}.
$$