Given the set of turtles nodes , I want to find all links having both ends in nodes . The best I've come up with so far:
link-set [ my-links with [ member? other-end nodes ] ] of nodes
This is exactly what I want. However, since member? works in linear time for non-generated sets, this is O(n*n*d) (where d is the maximum degree of nodes and n is the number of nodes). I could improve it using a hash set, but that would require either abusing the table extension, searching for a third-party extension, or creating my own. I could also create a sorted list of who nodes numbers and then do a binary search on it to go to O(n * log(n) * d) , but I hope for a simpler answer. Any ideas?
source share