MATLAB: How to determine number of edges

edges shortestpath matlab

Hi, below is the code for shortestpath:
%code
A = randi(1,8) ;
D = graph(A);
D.Edges.W3 = randi(13, numedges(D), 1);
D.Edges.Weight = D.Edges.W3;
p = plot(D,'o','EdgeLabel',D.Edges.Weight );
axis square;
grid on
path = shortestpath(D, 2, 5);
highlight(p,path,'NodeColor','g','EdgeColor','g')
end
The Result:
As the result shown that each of the point will generate 8 edges based on the "A = randi(1,8)" input. How can i determine the edges number manually?
Thanks.

Best Answer

Since every node seems to go to every node (even including itself), wouldn't it just be simply N*N/2 = 8*8/2 = 32?