Creat graph from specific vertices graphx spark

Using subgraph worked :

This function should be used when you want to filter out of a graph either edges or vertices.

Here is the code I used for this particular problem :

val graph = Graph.apply( => (vertex,1.0)),{case(s,d)=>Edge(s,d,1.0)})

val filtered = graph.subgraph(vpred = (vid,vd)=>vd!=null.asInstanceOf[Double])

Out: Long

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top