}
LocalPathIterationQuery lpi = new LocalPathIterationQuery(main.getRootGraph());
// Run BFS from all nodes in the graph and store the result in a set.
Set<LocalPathIterationQuery.NodePair> result = lpi.run();
// Convert NodePair set into a sorted array
LocalPathIterationQuery.NodePair[] resultArray =
new LocalPathIterationQuery.NodePair[result.size()];
result.toArray(resultArray);