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

Replace set-snapshot with set-context #76

Closed
nicolaspayette opened this issue Feb 25, 2013 · 4 comments
Closed

Replace set-snapshot with set-context #76

nicolaspayette opened this issue Feb 25, 2013 · 4 comments
Milestone

Comments

@nicolaspayette
Copy link
Member

No description provided.

@SethTisue
Copy link
Collaborator

I should remember from previous discussions and presentations, but I don't: what's the difference between set-snapshot and set-context?

@nicolaspayette
Copy link
Member Author

From the doc:

Now wouldn't it be better if you didn't have to call nw:set-snapshot everytime you want to do something with a network? Yes, indeed, it would. And eventually, it will be the case. What we have in mind for the moment is something like a nw:set-context primitive, which you would use to tell the extension that "in general, these are the turtles and links I want to work with." Once you set the context, the extension will be wise enough to decide by itself if it needs to take a new snapshot or not.

The reason we did not do it like this right away is that there currently is no efficient way to ask NetLogo if turtles and links have been created or deleted since a previous function call. If we can include this functionality in a future version of NetLogo, we will probably deprecate nw:set-snapshot and provide the much more convenient nw:set-context instead.

Jung's implementation of Dijktra's algorithm for path finding automatically caches a distance matrix to be reused unless the graph has changed. This is something we could easily have foregone, though. The real sticking point was the centrality primitives: the algorithms that calculate centrality do it for the whole graph at once and put the results in a map from vertex to score. We could have returned this map as a list of [turtle, score] pairs, but we wanted simple turtle reporters allowing things like ask turtle 0 [ set size nw:betweenness-centrality]. And this required knowing if the score map was still valid or if we had to recalculate centrality for the whole graph.

I'm not sure I'd go with the same design decision if I could revisit it. set-snapshot was quite a hassle. But the point is moot, now: set-context will soon be ready.

@SethTisue
Copy link
Collaborator

thx

@SethTisue
Copy link
Collaborator

congrats

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