* Set Intersection #performance
Intersection is faster for sets of different sizes if one iterates over the shorter set and checks the presence of an element in a larger one. For an edge case consider `s` having 1M entries and `other` no entries at all. In this case original code will iterate over 1M entries in `s` not finding anything and then returning an empty result set. In the patched code the iteration won't happen at all and result is returned immediately.
This change is inspired by profiling a relatively large terraform configuration, where the time to validate was sped up 4x with this change.
The public functions for the graph UpEdges and DownEdges is returning
the internal Set from the graph, meaning that callers could
inadvertently corrupt the graph structure by editing the returned Sets.
Make UpEdges and DownEdges return a copy of the set, while retaining the
efficient no-copy behavior for internal callers.