% Returns a signed adjacency matrix of a complete graph on n nodes,
%   where each edge has probability p (1-p) of being + (-)
function A = getRandomSignedGraph(n,p)

A = 1/2*eye(n); % We'll later set A = A + A'
for i = 1:(n-1)
    for j = (i+1):n
        if (rand()<p)
            A(i,j) = 1;
        else
            A(i,j) = -1;
        end
    end
end

A = A + A';