Pensieve header: Drawing the Willerton Fish using Gauss diagram formulas from Polyak-Viro.

<< KnotTheory`

Xs[xs_Xs] := xs;
Xs[L_] := Xs@@PD[L] /. X[i_,j_,k_,l_] :> If[PositiveQ[X[i,j,k,l]],Xp[l,i], Xm[j,i]];

Xs /: Normalize[xs_Xs]:= SortBy[
xs /. Thread[Union@@(List@@@xs)->Range[2Length[xs]]],
(List@@#)&
];
Xs /: RotateLeft[xs_Xs] := Normalize[
xs /. i_Integer :> If[i>1, i-1, 2Length[xs]]
];
GPV[F_Xs, K_Xs] /; Length[F]>Length[K] := 0;
GPV[F_Xs, K_Xs] /; Length[F]<Length[K] := Total[
GPV[F, #]& /@ Subsets[K, {Length[F]}]
];
GPV[F_Xs, K_Xs] /; Length[F]==Length[K] := If[
F===Normalize[K /. Xp|Xm -> X],
(-1)^Count[K, _Xm],
(*Else*) 0
];
GPV[F_Plus, K_] := GPV[#,K]& /@ F;
GPV[c_*F_Xs, K_] := c GPV[F,K];
V2[K_] := V2[K] = GPV[Xs[X[2,4],X[3,1]], Xs[K]];
V3Ds=Expand[Plus[
(1/2)Total[NestList[RotateLeft, Normalize[Xs[X[1,5],X[4,2],X[6,3]]], 5]],
Total[NestList[RotateLeft, Normalize[Xs[X[1,4],X[5,2],X[3,6]]], 1]]
]];
V3[K_] := V3[K] = GPV[V3Ds, Xs@K];

K=Knot[3,1]; xs=Xs@K

Normalize /@ Subsets[xs,{2}]

From Polyak-Viro’s “Guass Diagram Formulas for Vassiliev Invariants”, IMRN 11 (1994) 445-453:

V2[xs]

V2 /@ {Knot[3,1], Mirror@Knot[3,1]}

V2  /@ AllKnots[{3,10}]

Union[Vassiliev[2] /@ AllKnots[{3,10}] - V2  /@ AllKnots[{3,10}]]

From Polyak-Viro:

V3Ds

{V3[Xs@Knot[3,1]], V3[Xs@Knot[4,1]]}

V3 /@ {Knot[3,1], Mirror@Knot[3,1]}

V3 /@ AllKnots[{3,7}]

Vassiliev[3] /@ AllKnots[{3,7}]

Ks=AllKnots[{3,11}]; Ks=Ks⋃(Mirror /@ Ks);
ListPlot[{V2[#], V3[#]}& /@ Ks, PlotStyle->{Red}, PlotRange -> All]

ListPlot[
If[V3[#]≥0,{V2[#], V3[#]},{V2[Mirror@#], V3[Mirror@#]}]& /@ AllKnots[{3,11}],
PlotStyle->{Red}, PlotRange -> All]