% The node incidence matrix for the graph is A =[ 1 0 0 0 0 0 0 -1 0 0 0 0; 1 0 0 0 0 0 0 -1 0 0 0 0; 1 0 0 0 0 0 0 -1 0 0 0 0; 0 0 1 0 0 0 0 -1 0 0 0 0; 0 1 0 0 0 0 0 0 -1 0 0 0; 0 1 0 0 0 0 0 0 -1 0 0 0; 0 1 0 0 0 0 0 0 -1 0 0 0; 0 0 0 0 0 0 1 0 -1 0 0 0; 0 0 1 0 0 0 0 0 0 -1 0 0; 0 0 0 1 0 0 0 0 0 -1 0 0; 0 0 0 1 0 0 0 0 0 -1 0 0; 0 0 0 1 0 0 0 0 0 -1 0 0; 0 0 0 0 1 0 0 0 0 0 -1 0; 0 0 0 0 1 0 0 0 0 0 -1 0; 0 0 0 0 1 0 0 0 0 0 -1 0; 0 0 0 0 1 0 0 0 0 0 -1 0; 0 0 0 0 0 0 1 0 0 0 -1 0; 1 0 0 0 0 0 0 0 0 0 0 -1; 0 0 1 0 0 0 0 0 0 0 0 -1; -1 1 0 0 0 0 0 0 0 0 0 0; -1 0 0 0 1 0 0 0 0 0 0 0; -1 0 0 0 1 0 0 0 0 0 0 0; 0 -1 1 0 0 0 0 0 0 0 0 0; 0 -1 0 1 0 0 0 0 0 0 0 0; 0 -1 0 0 1 0 0 0 0 0 0 0; 0 -1 0 0 0 1 0 0 0 0 0 0; 0 0 -1 0 1 0 0 0 0 0 0 0; 0 0 0 -1 1 0 0 0 0 0 0 0; 0 0 0 -1 1 0 0 0 0 0 0 0; 0 0 0 -1 1 0 0 0 0 0 0 0; 0 0 0 -1 1 0 0 0 0 0 0 0; 0 0 0 -1 0 1 0 0 0 0 0 0; 0 0 0 0 -1 0 1 0 0 0 0 0; 0 0 0 0 0 -1 1 0 0 0 0 0; 0 0 0 0 0 -1 1 0 0 0 0 0]; % the number of variable nodes n = 7; % the number of links K = size(A,1); % total number of nodes N = 12; % x and y coords for the fixed nodes xfixed = [-1 0.8 -1 1 0]'; yfixed = [0.8 1 -1 -1 0.6]'; % plotting the randomly placed free nodes for comparison with % the optimal quadratic placement (which will look much nicer!) rand('seed',0) xrand = 2*rand(n,1) - 1; yrand = 2*rand(n,1) - 1; view_layout(xrand,yrand,xfixed,yfixed,A); title('Random placement of the free nodes')