ClosableIterator<QueryRow> it = result.iterator();
Map<Node,Node> snodes = new HashMap<Node,Node>();
while(it.hasNext()) {
QueryRow row = it.next();
snodes.put(row.getValue(f1), row.getValue(f2));
}
it.close();
Node[][] res = new Node[snodes.size()][2];
int i = 0;
for(Map.Entry<Node, Node> row : snodes.entrySet()) {
res[i][0] = row.getKey();
res[i][1] = row.getValue();
i++;
}
return res;
}