class Traverser extends AlgoTraverser {

        public Traverser(UserJob<Object> job) {
            super(job);
        }

        public Object degreeCentrality(Directions direction,
                                       String label,
                                       long topN) {<FILL_FUNCTION_BODY>}

        protected Object degreeCentralityForBothDir(String label, long topN) {
            assert topN >= 0L || topN == NO_LIMIT;
            long totalVertices = 0L;
            JsonMap degrees = new JsonMap();
            TopMap<Id> tops = new TopMap<>(topN);

            Iterator<Vertex> vertices = this.vertices();

            degrees.startObject();
            while (vertices.hasNext()) {
                Id source = (Id) vertices.next().id();
                this.updateProgress(++totalVertices);

                long degree = this.degree(source, label);
                if (degree > 0L) {
                    if (topN <= 0L && topN != NO_LIMIT) {
                        degrees.append(source, degree);
                    } else {
                        tops.put(source, degree);
                    }
                }
            }

            if (tops.size() > 0) {
                degrees.append(tops.entrySet());
            }
            degrees.endObject();

            return degrees.asJson();
        }

        private long degree(Id source, String label) {
            List<String> labels = label == null ? null : Collections.singletonList(label);
            EdgeStep step = new EdgeStep(this.graph(), Directions.BOTH,
                                         labels, null, NO_LIMIT, 0);
            return this.edgesCount(source, step);
        }
    }

            if (direction == null || direction == Directions.BOTH) {
                return this.degreeCentralityForBothDir(label, topN);
            }
            assert direction == Directions.OUT || direction == Directions.IN;
            assert topN >= 0L || topN == NO_LIMIT;

            Iterator<Edge> edges = this.edges(direction);

            JsonMap degrees = new JsonMap();
            TopMap<Id> tops = new TopMap<>(topN);
            Id vertex = null;
            Id labelId = this.getEdgeLabelIdOrNull(label);
            long degree = 0L;
            long totalEdges = 0L;

            degrees.startObject();
            while (edges.hasNext()) {
                HugeEdge edge = (HugeEdge) edges.next();
                this.updateProgress(++totalEdges);

                Id schemaLabel = edge.schemaLabel().id();
                if (labelId != null && !labelId.equals(schemaLabel)) {
                    continue;
                }

                Id source = edge.ownerVertex().id();
                if (source.equals(vertex)) {
                    // edges belong to same source vertex
                    degree++;
                    continue;
                }

                if (vertex != null) {
                    // next vertex found
                    if (topN <= 0L && topN != NO_LIMIT) {
                        degrees.append(vertex, degree);
                    } else {
                        tops.put(vertex, degree);
                    }
                }
                vertex = source;
                degree = 1L;
            }

            if (vertex != null) {
                if (topN <= 0L && topN != NO_LIMIT) {
                    degrees.append(vertex, degree);
                } else {
                    tops.put(vertex, degree);
                    degrees.append(tops.entrySet());
                }
            }

            degrees.endObject();

            return degrees.asJson();
        
<methods>public non-sealed void <init>() ,public java.lang.String category() ,public void checkParameters(Map<java.lang.String,java.lang.Object>) <variables>private static final Logger LOG