code: private int[] loadNodes(int size, int relType, Direction direction) {
          final CursorFactory cursors = ktx.cursors();
          try (NodeCursor node = cursors.allocateNodeCursor()) {
              // todo reuse array
              int[] offsets = new int[size];
              Arrays.fill(offsets,-1);
              int offset = 0;
              int maxIdx = 0;
  
              ktx.dataRead().allNodesScan(node);
  
              while (node.next()) {
                  int degree = DegreeUtil.degree(node, cursors, relType, direction);
                  int idx = mapId(node.nodeReference());
  //                offsets[idx] = degree;
                  offsets[idx] = offset;
                  offset += degree;
                  if (idx > maxIdx) maxIdx = idx;
              }
  
              return maxIdx < offsets.length -1 ? Arrays.copyOf(offsets,maxIdx+1) : offsets;
          }
      }
docs: pass in array, use array batches (pass in batch-no)