# Creating polygon from vertices alorithm

Is there somebody who can describe a theory behind creating quads from pointcloud(vertices) in blender python ? Is the only way to check length betweeen vertices like: (theory)

for i = number of vertices :
for y = number of vertices :
if (length between vertex(i) and vertex(y)) < (set number):