a little streamlining
Merge pull request #1646 from naylor-b/algs

some modest performance improvements to the graph stuff