class KneighborTraverser extends OltpTraverser {

    public KneighborTraverser(HugeGraph graph) {
        super(graph);
    }

    public Set<Id> kneighbor(Id sourceV, Directions dir,
                             String label, int depth,
                             long degree, long limit) {
        E.checkNotNull(sourceV, "source vertex id");
        this.checkVertexExist(sourceV, "source vertex");
        E.checkNotNull(dir, "direction");
        checkPositive(depth, "k-neighbor max_depth");
        checkDegree(degree);
        checkLimit(limit);

        Id labelId = this.getEdgeLabelIdOrNull(label);

        KneighborRecords records = new KneighborRecords(true, sourceV, true);

        Consumer<EdgeId> consumer = edgeId -> {
            if (this.reachLimit(limit, records.size())) {
                return;
            }
            records.addPath(edgeId.ownerVertexId(), edgeId.otherVertexId());
        };

        while (depth-- > 0) {
            records.startOneLayer(true);
            traverseIdsByBfs(records.keys(), dir, labelId, degree, NO_LIMIT, consumer);
            records.finishOneLayer();
            if (reachLimit(limit, records.size())) {
                break;
            }
        }

        this.vertexIterCounter.addAndGet(records.size());

        return records.idsBySet(limit);
    }

    public KneighborRecords customizedKneighbor(Id source, Steps steps,
                                                int maxDepth, long limit) {<FILL_FUNCTION_BODY>}

    private boolean reachLimit(long limit, int size) {
        return limit != NO_LIMIT && size >= limit;
    }
}

        E.checkNotNull(source, "source vertex id");
        this.checkVertexExist(source, "source vertex");
        checkPositive(maxDepth, "k-neighbor max_depth");
        checkLimit(limit);

        KneighborRecords records = new KneighborRecords(true,
                                                        source, true);

        Consumer<Edge> consumer = edge -> {
            if (this.reachLimit(limit, records.size())) {
                return;
            }
            EdgeId edgeId = ((HugeEdge) edge).id();
            records.addPath(edgeId.ownerVertexId(), edgeId.otherVertexId());
            records.edgeResults().addEdge(edgeId.ownerVertexId(), edgeId.otherVertexId(), edge);
        };

        while (maxDepth-- > 0) {
            records.startOneLayer(true);
            traverseIdsByBfs(records.keys(), steps, NO_LIMIT, consumer);
            records.finishOneLayer();
            if (this.reachLimit(limit, records.size())) {
                break;
            }
        }

        this.vertexIterCounter.addAndGet(records.size());

        return records;
    
<methods>public void close() ,public static void destroy() <variables>private static final java.lang.String EXECUTOR_NAME,private static org.apache.hugegraph.util.Consumers.ExecutorPool executors