% function [A,b,c,K] = theta(G,n)
% Creates primal standard form for Lovasz theta function
% Assume G is a (2 by numEdges) array that lists the edges 
% n is the number of vertices
function [A,b,c,K] = theta(G,n)
numEdges = size(G,2) ;
A = zeros(numEdges+1,n^2);
% ------ add a constraint for each edge -------
for edge = 1:numEdges
    newconst = zeros(n) ;
    newconst(G(1,edge),G(2,edge)) = 1 ;
    newconst(G(2,edge),G(1,edge)) = 1 ;
    A(edge,:) = vec(newconst)' ;
end
I = eye(n) ;
A(numEdges+1,:) = vec(I)' ;
b = [zeros(numEdges,1); 1] ;
c = -ones(n^2,1);
% ------------- mat(x) in SDP cone ------------
K.s = n ;
