This is the first matlab program I wrote. Under the pressure of the teacher, I have to implement the pseudo code in the paper. I refer to the rewards identity anonymization on for this program In this paper, the first algorithm of graphs is pseudocode. After writing it, I finally understand what teachers often say to learn, instead of spending a lot of time systematically learning a certain language.
The main idea is to randomly select a node v with a degree of d(v) from the degree sequence, set d(v) to 0, and then select d(v) nodes from the remaining nodes to connect with it, and the degree of the connected nodes will be reduced by 1, iterating until all the degrees are 0, the edge is connected, and the random graph will be formed (code roughness, many inclusions).
Theast).

d = [13,13,13,13,11,12,12,5,7,12,7,11,7,12,12,5,3,5,7,5,3,5,3,3,7,11,11];
n = length(d);
V = [];
tab1 = [];
tab2 = [];
s=0;
count = 0;
alen = 1;
blen = 1;
vlen = 1;
for i = 1:n
s = s + d(i);
end
if mod(s,2)~=0
disp('No');
return ;
end
while 1
for i = 1:n
if(d(i)<0)
disp('No');
break;
end
end
for i = 1:n
if(d(i) ==0)
count = count+1;
end
if (count == n)
G = graph(tab1,tab2);
plot(G);
return;
end
end
Arr = randperm(n);
for i = 1:n
v = Arr(i);
if d(v)>0
a = d(v);
d(v) = 0;
[B,I] = sort(d);
for j = n-a+1:n
V(vlen) = I(j);
vlen = vlen+1;
end
for k = 1:a
tab2(blen) = V(blen);
w = tab2(blen);
d(w) = d(w)-1;
tab1(alen) = v;
alen = alen+1;
blen = blen+1;
end
end
i = i+1;
end
end