class PredictionTraverser extends OltpTraverser {

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

    public double adamicAdar(Id source, Id target, Directions dir,
                             String label, long degree, int limit) {<FILL_FUNCTION_BODY>}

    public double resourceAllocation(Id source, Id target, Directions dir,
                                     String label, long degree, int limit) {
        Set<Id> neighbors = checkAndGetCommonNeighbors(source, target, dir,
                                                       label, degree, limit);
        EdgeStep step = label == null ? new EdgeStep(graph(), dir) :
                        new EdgeStep(graph(), dir, ImmutableList.of(label));

        double sum = 0.0;
        for (Id vid : neighbors) {
            long currentDegree = this.edgesCount(vid, step);
            if (currentDegree > 0) {
                sum += 1.0 / currentDegree;
            }
        }
        return sum;
    }

    private Set<Id> checkAndGetCommonNeighbors(Id source, Id target,
                                               Directions dir, String label,
                                               long degree, int limit) {
        E.checkNotNull(source, "source id");
        E.checkNotNull(target, "the target id");
        this.checkVertexExist(source, "source");
        this.checkVertexExist(target, "target");
        E.checkNotNull(dir, "direction");
        checkDegree(degree);
        SameNeighborTraverser traverser = new SameNeighborTraverser(graph());
        return traverser.sameNeighbors(source, target, dir, label, degree, limit);
    }
}

        Set<Id> neighbors = checkAndGetCommonNeighbors(source, target, dir,
                                                       label, degree, limit);
        EdgeStep step = label == null ? new EdgeStep(graph(), dir) :
                        new EdgeStep(graph(), dir, ImmutableList.of(label));

        double sum = 0.0;
        for (Id vid : neighbors) {
            long currentDegree = this.edgesCount(vid, step);
            if (currentDegree > 0) {
                sum += 1.0 / Math.log(currentDegree);
            }
        }
        return sum;
    
<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