简体   繁体   English

在graphx spark中删除没有边缘的顶点

[英]removing vertices with no edges in graphx spark

I was wondering if somebody could help, I'm having a problem with a function written for graphx in spark which keeps giving error messages if I have vertices with no edges. 我想知道是否有人可以提供帮助,我为在spark中为graphx编写的函数遇到了问题,如果我的顶点没有边缘,就会不断给出错误消息。

When joining edges and vertices together 将边缘和顶点连接在一起时

val graph = Graph(vertices, edges)

is there a simple way to skip over vertices which do not have any corresponding edges? 有没有一种简单的方法可以跳过没有任何相应边的顶点? or is there a way of subgraphing for this? 还是有一种方法可以对此进行细分? Currently if I use subgraph for say an edge attribute, it preserves the vertices. 目前,如果我使用子图来表示edge属性,它将保留顶点。

Many thanks for your help 非常感谢您的帮助

val graph = Graph(vertices, edges) <---this one got an error? val graph = Graph(vertices, edges) <---这有错误吗? maybe you should give the type of VD and Ed, like val graph:Graph[Int, Int] = Graph(vertices, edges) . 也许您应该提供VD和Ed的类型,例如val graph:Graph[Int, Int] = Graph(vertices, edges)

In fact, vextice with no edges is ok. 实际上,没有边缘的vextice没问题。 I have tried with 10 vertices and two of which has no edges. 我尝试了10个顶点,其中两个没有边。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM