I have a point shapefile and am trying to create lines connecting each point to the nearest other point with a similar value, based on one of its attributes. Specifically, the points are polygon centroids and each point has an attribute value for "area" corresponding to the area of the original polygon. I would like to connect each point to the nearest that is within a specified percentage of its own value. For example, if 50% was specified, a point with a value of 2 would connect to one with a value of 2.5 but not to one with a value of 4.
The "Nearest with Greater Value" plugin (https://plugins.qgis.org/plugins/qgis_nearest_greater/) does something similar but connects each point to the nearest greater one rather than the nearest of a similar value.
It's possible to do this manually by creating a new layer for each point containing only the other points within the specified range (e.g., for a 50% range and a point with a value of 2, all points with values between 1 and 3 would be exported to a new layer) and then running "Shortest line between features", but I need an automated method since my shapefile has thousands of points in it.
I am using QGIS 3.28.0.