Graph 查找节点的邻居

Graph 查找节点的邻居,graph,similarity,Graph,Similarity,如何使用scala编程从无向图中查找节点的邻居? 我用节点列表和边列表创建了图,现在我需要找到每个节点的邻居列表。有没有图书馆或者知道如何找到邻居名单 val graphx = Graph(nodes,routes) val label = sc.textFile("label.csv") val getgdata2 = label.map(line=>line.split(",")) val node11 = getgdata2.map(line=>((line(0)))).di

如何使用scala编程从无向图中查找节点的邻居? 我用节点列表和边列表创建了图,现在我需要找到每个节点的邻居列表。有没有图书馆或者知道如何找到邻居名单

val graphx = Graph(nodes,routes)

val label = sc.textFile("label.csv")
val getgdata2 = label.map(line=>line.split(","))
val node11 = getgdata2.map(line=>((line(0)))).distinct   
val verticesWithSuccessors: VertexRDD[Array[VertexId]] = 
graphx.ops.collectNeighborIds(EdgeDirection.Out)
val successorGraph = Graph(verticesWithSuccessors, routes)

val res = successorGraph.vertices.collect()
res.take(5)
--------------------------
Output shows : 
(384,[J@38d17d80)
(454,[J@6ede46f6)
(1084,[J@66273da0)
(1410,[J@2127e66e)
(772,[J@1229a2b7)
Answer should be: 
(384 - 1084, 984,2013)
(454 - 924)
(1084 - 2302,354)

我需要查看每个节点的邻接列表。有人能帮我吗?

可能重复的否,可能的答案应该是节点:384-762982392