I think you can use aggregateMessages() twice.
In first step, collect inDegrees to every node, and store them.
in second step, collect inDegrees info in node to the final node.
OR,you can use outerJoinVertices() first, like:

yourGraph = followerGraph.outerJoinVertices(
        new setDegreesMsg()//use the function to combine inDegrees info with yourGraph

And then, use aggregateMessages() to collect inDegrees info in neighbor, like:

        degrees:RDD[(VertexId, Int)] = yourGraph.aggregateMessages(
                new getInfoSendMsg(),
                new getInfoMergeMsg()

Related Query

More Query from same tag