Conditionally select subset of network based on link values (for distance-to, path-to and turtles-in-radius)
I would like to conditionally select a subset of a network based on link values to perform some functions, mainly distance-to, path-to and turtles-in-radius.
So for example, I have a network with links. Each link has either a red, green or blue color. I would like see which turtles are in a certain radius using only the green and blue links (so not red). Then I want to find a path those one of those turtles over only those green and blue links.
Is it currently possible to select such a subset of the network/links? If so, how? (I would expect something like with [color != red]). If not, it would be amazing to have this as an feature!
@LaCuneta or @brandesNW Any chance one of you could help out with this case?
@EwoutH, I think that nw:set-context does exactly what you need. Something like:
nw:set-context turtles links with [color != red]
should ensure that future calls to nw primitives will only take non-red links into account.
Thanks a lot, I will try it and report back.
Do you by any chance know if there is a "move to next turtle in route and delete that item from the route (list)" function?
I'm now using:
move-to first route
set route remove-item 0 route
But I feel it should be able to be done more efficiently.
I think that
move-to first route set route remove-item 0 route
is as good as it gets.