 # Picking path to walk through from a network of curves influenced by density of populated points

Hi,

I am trying to create a logic of lightning selecting the less resistant path to strike through.

I populate points with variation in density.

Then I would like to pick pathways to walk through a pre-determined network that I have created from starting points to end points with the criteria of picking the paths with less dense points distribution. Is there possible way of achieving this or similar logic?

Please find the gh code and screen capture in the attachment.

Thank you.

network question.gh (69.2 KB)

You can use the shortest walk method. Correlate population density to distance between points, or, say th e z axis of the points, then run shortest walk

Hi markz

Thank you for your reply. However, I’ve tried but till now I wasn’t able to figure out yet how the shortest walk logic could be adapted to selecting walk according to population density of points.

While I haven’t tried it myself, if you assign the population density to the z-value of a point, then do the shortest walk, should work. Another method, thinking of population density as a topographical map (again, population becomes the z-axis), you could then look for the ‘valleys’ in between the high points, these valleys would correspond to lowest population density. The method should also work for other variables that could be assigned to a z value: conductivity, surface roughness, epidemiology occurrences, average annual salary, software user preferences, real estate sales prices, and so on.

Given a graph and a collection of points that’s a classic custom Dijkstra routing where the cost in the related adjacency Matrix is not the node.DistanceTo(neighborNode) … but the prox connections count found per node (given a proper search Radius, that is).

In fact … by the book … you’ll need a bias control as well that balances the distances VS the density proximities per node. This means that if the bias is 100% towards the distances > a short path is made, if is 100% towards densities > some (maybe) long path is made … blah, blah.

Notify if you need the solution but it would be 100% code (thus maybe it would be useless for you if you are not familiar with coding). It could be somehow castrated mind due to various internal Methods used (plus it would use Sandbox instead of also internal graph connectivity Methods).

In this example shown a random (non uniform) pts collection is made “around” a given graph and then the routing goes from a node to a node according various user defined “priorities” - so to speak.