Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditionally select subset of network based on link values (for distance-to, path-to and turtles-in-radius) #203

Open
EwoutH opened this issue Dec 14, 2022 · 4 comments

Comments

@EwoutH
Copy link

EwoutH commented Dec 14, 2022

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!

@EwoutH
Copy link
Author

EwoutH commented Dec 19, 2022

@LaCuneta or @brandesNW Any chance one of you could help out with this case?

@nicolaspayette
Copy link
Member

@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.

@EwoutH
Copy link
Author

EwoutH commented Dec 19, 2022

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.

@nicolaspayette
Copy link
Member

I think that

move-to first route
set route remove-item 0 route

is as good as it gets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants