NetLogo/NW-Extension — pull request #127 by nicolaspayette (2014-08-10 00:39:18+00:00)
Title: links set in GraphContext should only contain links that have both ends as part of the context

I noticed the problem while trying to use `save-graphml` (see language test added in 19e4ce2): Given two turtle breeds and links that can connect members of both breeds, if you set the context to one breed and the links, only the links between agents of that one breed should be included in the context. When saving to GraphML, I ended up with cross-breed links in my file, even though I shouldn't have. (And Gephi complained of missing nodes when trying to import...)

The problem mostly did not show up because that filtering was done at the time of building the `outLinks`, `inLinks` and `undirLinks` maps, and most primitives ultimately rely on those. But I think `links` should be filtered too: it is public and used in (at least) `save-graphml`.

So in 7782b6a, I moved the filtering "upstream", at the time of building `links`. All the old tests still pass, and the new tests I've added now pass too.

@qiemem, what do you think?