SetDirectory[NotebookDirectory[]];
Needs["Bulatov`sdp1`"];
Install["/Users/Yaroslav/mathematica/Pythonika"];

g=GridGraph[{4,3}];
A=AdjacencyMatrix@g;
n=Length@VertexList@g;
u=ConstantArray[1,n];
gram=solveDualSDP[-A,IdentityMatrix[n],u];
labels=gramRound[gram]

(* extract vertex->coords rules from a graph *)
graphCoords[g_Graph]:=(
Thread[VertexList[g]->VertexCoordinates/.AbsoluteOptions[g]]
);

oneColorGraph[g_Graph,vals_]:=Module[{vf},
Assert[Length@vals==Length@VertexList@g];
verts=VertexList@g;
edges=EdgeList@g;
vcoords=graphCoords@g;
vf[{xc_,yc_},name_,{w_,h_}]:=(
d1=Disk[{xc,yc},Max[w,h],{0,2Pi}];
{ColorData["Crayola"]["NavyBlue"],Opacity[vals[[name]]],d1}
);
Graph[verts,UndirectedEdge@@@edges,VertexShapeFunction->vf,VertexSize->{"Scaled",.1},VertexCoordinates->vcoords,ImageSize->Small]
];

g=GridGraph[{4,3}];
A=AdjacencyMatrix@g;
n=Length@VertexList@g;
u=ConstantArray[1,n];
vars=x/@Range@n;
cons=And@@(-1≤x[#]≤1&/@Range@n);
sol=vars/.Last[Maximize[{-vars.A.vars,cons},vars,Integers]]

oneColorGraph[g,1+sol]

gram=solveDualSDP[-A,IdentityMatrix[n],u];
sol2=gramRound[gram]

sol2==-sol