class SameNeighborsAPI extends API {

    private static final Logger LOG = Log.logger(SameNeighborsAPI.class);

    @GET
    @Timed
    @Produces(APPLICATION_JSON_WITH_CHARSET)
    public String get(@Context GraphManager manager,
                      @PathParam("graph") String graph,
                      @QueryParam("vertex") String vertex,
                      @QueryParam("other") String other,
                      @QueryParam("direction") String direction,
                      @QueryParam("label") String edgeLabel,
                      @QueryParam("max_degree")
                      @DefaultValue(DEFAULT_MAX_DEGREE) long maxDegree,
                      @QueryParam("limit")
                      @DefaultValue(DEFAULT_ELEMENTS_LIMIT) int limit) {
        LOG.debug("Graph [{}] get same neighbors between '{}' and '{}' with " +
                  "direction {}, edge label {}, max degree '{}' and limit '{}'",
                  graph, vertex, other, direction, edgeLabel, maxDegree, limit);

        ApiMeasurer measure = new ApiMeasurer();

        Id sourceId = VertexAPI.checkAndParseVertexId(vertex);
        Id targetId = VertexAPI.checkAndParseVertexId(other);
        Directions dir = Directions.convert(EdgeAPI.parseDirection(direction));

        HugeGraph g = graph(manager, graph);
        SameNeighborTraverser traverser = new SameNeighborTraverser(g);
        Set<Id> neighbors = traverser.sameNeighbors(sourceId, targetId, dir,
                                                    edgeLabel, maxDegree, limit);

        measure.addIterCount(traverser.vertexIterCounter.get(),
                             traverser.edgeIterCounter.get());

        return manager.serializer(g, measure.measures())
                      .writeList("same_neighbors", neighbors);
    }

    @POST
    @Timed
    @Produces(APPLICATION_JSON_WITH_CHARSET)
    public String sameNeighbors(@Context GraphManager manager,
                                @PathParam("graph") String graph,
                                Request request) {<FILL_FUNCTION_BODY>}

    private static class Request {

        @JsonProperty("max_degree")
        public long maxDegree = Long.parseLong(DEFAULT_MAX_DEGREE);
        @JsonProperty("limit")
        public int limit = Integer.parseInt(DEFAULT_ELEMENTS_LIMIT);
        @JsonProperty("vertex_list")
        private List<Object> vertexList;
        @JsonProperty("direction")
        private String direction;
        @JsonProperty("labels")
        private List<String> labels;
        @JsonProperty("with_vertex")
        private boolean withVertex = false;

        @Override
        public String toString() {
            return String.format("SameNeighborsBatchRequest{vertex_list=%s," +
                                 "direction=%s,label=%s,max_degree=%d," +
                                 "limit=%d,with_vertex=%s",
                                 this.vertexList, this.direction, this.labels,
                                 this.maxDegree, this.limit, this.withVertex);
        }
    }
}

        LOG.debug("Graph [{}] get same neighbors among batch, '{}'", graph, request.toString());

        ApiMeasurer measure = new ApiMeasurer();

        Directions dir = Directions.convert(EdgeAPI.parseDirection(request.direction));
        HugeGraph g = graph(manager, graph);
        SameNeighborTraverser traverser = new SameNeighborTraverser(g);

        List<Object> vertexList = request.vertexList;
        E.checkArgument(vertexList.size() >= 2, "vertex_list size can't " +
                                                "be less than 2");

        List<Id> vertexIds = new ArrayList<>();
        for (Object obj : vertexList) {
            vertexIds.add(HugeVertex.getIdValue(obj));
        }

        Set<Id> neighbors = traverser.sameNeighbors(vertexIds, dir, request.labels,
                                                    request.maxDegree, request.limit);
        measure.addIterCount(traverser.vertexIterCounter.get(),
                             traverser.edgeIterCounter.get());

        Iterator<?> iterVertex;
        Set<Id> ids = new HashSet<>(neighbors);
        ids.addAll(vertexIds);
        if (request.withVertex && !ids.isEmpty()) {
            iterVertex = g.vertices(ids.toArray());
        } else {
            iterVertex = ids.iterator();
        }
        return manager.serializer(g, measure.measures())
                      .writeMap(ImmutableMap.of("same_neighbors", neighbors,
                                                "vertices", iterVertex));
    
<methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegraph.core.GraphManager, java.lang.String) ,public static org.apache.hugegraph.HugeGraph graph4admin(org.apache.hugegraph.core.GraphManager, java.lang.String) ,public static java.lang.Object[] properties(Map<java.lang.String,java.lang.Object>) <variables>public static final java.lang.String ACTION_APPEND,public static final java.lang.String ACTION_CLEAR,public static final java.lang.String ACTION_ELIMINATE,public static final java.lang.String APPLICATION_JSON,public static final java.lang.String APPLICATION_JSON_WITH_CHARSET,public static final java.lang.String APPLICATION_TEXT_WITH_CHARSET,public static final java.lang.String CHARSET,private static final Meter EXPECTED_ERROR_METER,private static final Meter ILLEGAL_ARG_ERROR_METER,public static final java.lang.String JSON,protected static final Logger LOG,private static final Meter SUCCEED_METER,public static final java.lang.String TEXT_PLAIN,private static final Meter UNKNOWN_ERROR_METER