Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道在 GraphX 中,我们可以合并两个图以更新现有网络……但是,更新网络的常规操作是向其中插入单个节点。怎么可能在 GraphX 中进行这样的更新操作?!谢谢 !
图表是不可变的,因此您无法将单个节点添加到现有图表中,但您可以在之前添加的节点的基础上创建新图表。假设您有这样的图表:
var graph: Graph[Int,Int] = ...
您可以像这样添加一个新节点:
graph = Graph( graph.vertices.union(sc.parallelize(Array[(VertexId, Int)]((13L, 1)))), graph.edges, 0 )