As you can see previous example, some nodes are not connected. Because, there is radius value which is between 0 to 1. The code draws a certain radius to each of the nodes point in the Euclidean Space. If another node point is inside this radius, the shortest distance between these two points is calculated using the Euclidean Distance formula and a straight line is drawn.
Theoretically If radius equals to 1 this means that all nodes are connected each other. If radius equals to 0 this means that all nodes are not connected.
10 Nodes and Radius is 1
10 Nodes and Radius is 0.4
Our radius values are depending on the number of nodes. Here are conditions:
if 25 <= x <= 49;
Radius = 0.5
else if 50 <= x <=99;
Radius = 0.3
else if 100 <= x <=199;
Radius = 0.25
else if 300 <= x <=399;
Radius = 0.22
else if 400 <= x <=545;
Radius = 0.18
else if 200 <= x <=299;
Radius = 0.2