n1 = 4;
n  = 2 * n1;
A = [1, 2, rand*2; 2,1, 0];
A = [A; 1, 3, rand*2; 3,1,  0];
A = [A; 2*n1-2,2*n1, rand*2; 2*n1,2*n1-2, 0];
A =[A; 2*n1-1,2*n1, rand*2; 2*n1,2*n1-1, 0];
cross = 1;
for k= 1:n1-2
    A=[A; 2*k,2*k+2,rand;  2*k+2,2*k,rand];
    A=[A;2*k,2*k+1,rand;   2*k+1,2*k,rand];
    A=[A;2*k+1,2*k+3,rand; 2*k+3,2*k+1,rand];
    if (cross == 1)
        A=[A; 2*k,2*k+3,rand;  2*k+3,2*k,rand];
        A=[A;2*k+2,2*k+1,rand;   2*k+1,2*k+2,rand];
    end
end
k = n1 -1;
A=[A;2*k,2*k+1,rand;  2*k+1,2*k,rand];
A1=A;
%%%NetworkFlow;
[FLOW,Asort,C1,C2,VF,flg] = NetworkFlow(A);
fcc = 0;
for k=1:length(FLOW)
   verify = 1;
   if (ismember(FLOW(k,1),C1) & ismember(FLOW(k,2),C2))
      if (abs(FLOW(k,3)-Asort(k,3)) > 0)
          verify = 0;
          K      = k;
          break;
      end
      fcc = fcc + Asort(k,3);
   end
end

       





