<<KnotTheory`

The genus is g=(1/2)(Length[L]-cycles+2)

SetAttributes[P,Orderless]
CG[K_PD]:=Module[{k,kk,A,AA,B,BB,a,aa,b,bb,n=Length[K]},
k=K/.X[i_,j_,k_,l_]:>If[TrueQ[Mod[i,2]==0],X[i,j,k,l],X[l,i,j,k]];
A=k//.X[i_,j_,k_,l_]:> P[i,j]P[k,l];
B=k//.X[i_,j_,k_,l_]:>P[i,l]P[j,k];
a=(Times@@A)//.P[i_,j_]P[j_,k_]:> P[i,k];
b=(Times@@B)//.P[i_,j_]P[j_,k_]:> P[i,k];

kk=K/.X[i_,j_,k_,l_]:>If[TrueQ[Mod[i,2]==0],X[l,i,j,k],X[i,j,k,l]];
AA=kk//.X[i_,j_,k_,l_]:> P[i,j]P[k,l];
BB=kk//.X[i_,j_,k_,l_]:>P[i,l]P[j,k];
aa=(Times@@AA)//.P[i_,j_]P[j_,k_]:> P[i,k];
bb=(Times@@BB)//.P[i_,j_]P[j_,k_]:> P[i,k];Cases[{(1/2)(n-Length@Variables[a]-Length@Variables[b]+2),(1/2)(n-Length@Variables[aa]-Length@Variables[bb]+2)},_Integer][[1]]]

This only works for mod2 numberable knots, because those admit crossing changes that make them alternating. (This is a remark from Micah in an upcoming paper.)

k36=PD[X[3,6,4,1],X[1,4,2,5],X[5,2,6,3]];
CG[k36]

k487=PD[X[3,8,4,1],X[5,1,6,2],X[6,2,7,3],X[4,7,5,8]];
CG[k487]

Turning a Gauss code into PD notation, because Green' s table doesn' t have it for knots with more than 4 crossings.

GCtoPD[K_]:=Module[{j,l=Length@Characters[K]/3},
i[j_]:=(StringPosition[K,StringReplace["On","n"-> TextString[j]]][[1]][[1]]-1)/3+1;
p[j_]:=If[StringContainsQ[K,StringReplace["On+","n"-> TextString[j]]], i[j],n[j]+1];
n[j_]:=If[StringContainsQ[K,StringReplace["On-","n"-> TextString[j]]], i[j],p[j]+1];
L=PD@@Table[
X[(t-1)/3+1,Mod[n[Characters[K][[t+1]]],l,1],Mod[(t-1)/3+2,l,1],Mod[p[Characters[K][[t+1]]],l,1]],{t,Union@Flatten@StringPosition[K,"U"]}]
]

WW=GCtoPD["O1-O2-U1-U3-U4-U2-O4-O3-"]

QQ=GCtoPD["O1-O2-U1-U3+O4+O3+U4+U2-"]

CG[WW]
CG[QQ]

The program sometimes runs on knots it shouldn' t run on.