it can be a part of it, you just need a reduce step afterwards. The easiest way is by fold(…) ing across the result. You can use Folder2, which gives you the raw result set, row by row, or Folder3 which allows you to map(…) before the fold and get the result of the map inside the fold() calls.
Basically, when folding, you get passed an accumulator (which was the return value from the last call, or the initial value passed in for the first call) and you add some state typically, and return it to go into the next fold() call. The final result is returned when you get to the end of the result set.
If your accumulator is a map of root objects in your graph, you can accumulate against it pretty reasonably.
-Brian