I cant find anything that explains what the adjacency array input does or how to make one, but I get the feeling it might be what I need to make the shortest path results a little better.
I am scattering a handful of points over a terrain and trying to connect those for roads.
The total amount of points and their distance can be different every use.
So far I have it working ok with slope based costs and ignoring the distance in their cost/pathing.
But what I cant figure out is a good way to stop it from finding a path that cuts across the entire terrain between the furthest points, instead just using existing paths or not trying to reach more distant points.
Do I need to run the shortest path in a for-each loop with a group for each start point and their nearest end points? Or can the adjacency array do something like that? How do you make an adjacency array?
Find Shortest Path - How to make & use its adjacency array?
2289 5 1-
- proximo
- Member
- 25 posts
- Joined: Nov. 2019
- Offline
-
- proximo
- Member
- 25 posts
- Joined: Nov. 2019
- Offline
Still havent found any good descriptions or use cases with the Adjacency Array. No one uses that or could explain it?
Running a find shortest path through a for-each for every point kind of works to help separate/group each path on its own, but it would be nice to do this more cleanly. Maybe be able to snap all paths that are near together, but still keep sections grouped on their own for later use.
Running a find shortest path through a for-each for every point kind of works to help separate/group each path on its own, but it would be nice to do this more cleanly. Maybe be able to snap all paths that are near together, but still keep sections grouped on their own for later use.
-
- Aizatulin
- Member
- 491 posts
- Joined: July 2005
- Offline
Hi,
you can define an integer array attribute for each point, representing all points, which should be adjacent to this point. If this array contains all neighbours points, there is no difference between the usual approach. But you can add additional point numbers to this array, which are not necessarly connected to the point, like adding a new edge between these points. Additionally you can define a cost array, which represents cost travelling along the edge between the point and its (adjacent) neighbour. For example, if you add an new neighbour (to the existing ones), which is far away with a low cost, the path will prefer this point. On the other side, if the cost is very high for this edge, the path will take a longer way (but with lower sum of costs from the edges).
Here is an example
@additional info: there are several other options to add costs, but it looks like, that you can only have either a float value as point cost attribute or an array attribute. If you are choosing the array attribute, the length of each array must match the size of the adjacency array. And you don't have to put all neighbour points into the adjacency array, but if you are not doing this, the default cost value seems to be the edge length between the points.
you can define an integer array attribute for each point, representing all points, which should be adjacent to this point. If this array contains all neighbours points, there is no difference between the usual approach. But you can add additional point numbers to this array, which are not necessarly connected to the point, like adding a new edge between these points. Additionally you can define a cost array, which represents cost travelling along the edge between the point and its (adjacent) neighbour. For example, if you add an new neighbour (to the existing ones), which is far away with a low cost, the path will prefer this point. On the other side, if the cost is very high for this edge, the path will take a longer way (but with lower sum of costs from the edges).
Here is an example
@additional info: there are several other options to add costs, but it looks like, that you can only have either a float value as point cost attribute or an array attribute. If you are choosing the array attribute, the length of each array must match the size of the adjacency array. And you don't have to put all neighbour points into the adjacency array, but if you are not doing this, the default cost value seems to be the edge length between the points.
Edited by Aizatulin - Nov. 1, 2020 03:30:56
-
- proximo
- Member
- 25 posts
- Joined: Nov. 2019
- Offline
-
- Len
- Member
- 132 posts
- Joined: July 2007
- Offline
Trying to get a handle on this same topic.
It appears to me the adjacency array only adds to the existing geo edges rather than replacing?
I'm trying to limit paths going downhill by building the adjacency array by getting all neighbors of each point then filtering those for ones that only go uphill. So the adjacency array is subset of all neighbors of each point.
However, paths still snake down to lower y despite confirming that the adjacency array doesn't include any of those edges at each point. Is this not possible with this approach? Thx.
It appears to me the adjacency array only adds to the existing geo edges rather than replacing?
I'm trying to limit paths going downhill by building the adjacency array by getting all neighbors of each point then filtering those for ones that only go uphill. So the adjacency array is subset of all neighbors of each point.
However, paths still snake down to lower y despite confirming that the adjacency array doesn't include any of those edges at each point. Is this not possible with this approach? Thx.
-
- Aizatulin
- Member
- 491 posts
- Joined: July 2005
- Offline
-
- Quick Links