function [GG,ig,jg,ing,jng] = gangster(n);
% call:  [GG,ig,jg,ing,jng] = gangster(n); 

V = [ eye( n-1 ); - ones( n-1, 1)'];         
e = ones(n,1);
VT = [1, zeros(1,(n-1)*(n-1));kron(e,e)/n, kron(V,V) ]; %iz clanka

R = [ 1, zeros(1,(n-1)*(n-1));  zeros((n-1)*(n-1),1), kron(n*eye(n-1) - ones(n-1),n*eye(n-1) - ones(n-1))/(n*n*(n-1))];
G = VT*R*VT';
m= size(G,1);
for i=1:m
  for j=1:m
    if G(i,j)> 1e-5; 
      G(i,j)=1;
    else
      G(i,j)=0;
    end
  end
end

%gangster indices:
I = ones(n*n+1);
GG = I - G;
GG = tril(GG ,-1);
[ig,jg] = find(GG);


%not gagnster indices
pom1 = tril(G,-1);
[ing,jng] = find(pom1);

%n=5;  %ovo je od gangster indices!!
% ii=[1 2 3 5 6 7 9 10 12 13 14 19 20 21 23 24 25 27 29 30 31 32 33 36 37 38 39 41 42 46 47 50 51 53 54 56 57 58 62 63 76 77 78 81 82 91 92 93 95 96];
% P=ig(ii); Q=jg(ii);

%n=6;  %ovo je od gangster indices!!
%ii=[1 2 3 4 6 7 8 9 11 12 13 15 16 17 18 20 21 23 24 25 26 30 31 32 33 36 37 38 39 41 42  43 44 46 47 48 49 51 52 53 55 56 57 59 60 61 63 64 66 67 68 72 73 74 77 78 79 81 82 83 85 86 87 88 90 91 93 94 95 97 98 100 101 103 104 108 109 112 113 115 116 118 119 120 121 125 126 127 131 132 145 146 147 148 151 152 153 156 157 166 167 168 169 171 172 173 175 176]; 