March 2019
Beginner to intermediate
182 pages
4h 6m
English
The in-degree tells us how many vertices come into the second vertex, but not the other way around. This time, we can see that for the 2L instance of VertexId, there's only one inbound vertex. We can see that 2L has a relationship with 1L, 3L has a relationship with 1L as well, and 4L has a relationship with 1L. In the following resulting dataset, there will be no data for VertexId 1L, because 1L is the input. So, 1L would only be a source and not a destination:
test("should calculate in-degree of vertices") { //given val users: RDD[(VertexId, (String))] = spark.parallelize(Array( (1L, "a"), (2L, "b"), (3L, "c"), (4L, "d") )) val relationships = spark.parallelize(Array( Edge(1L, 2L, "friend"), Edge(1L, 3L, "friend"), Edge(2L, ...Read now
Unlock full access