Improved speed and memory usage in the case where users need a small number of pairs relative to size of the graph.