Hoping somebody can help.

I'm trying to write a program which needs to carry out a function on each edge ID connected to each node in a network on graphx.

To do this I want to iterate over each node and identify all edges connected to it, I then want to iterate over each edge with a function. My problem seems to arise when doing any kind of subgraphing or filtering within a foreach loop.

So for example the code below should output the id of each edge connected to a node

```
graph.vertices.foreach {
  network => 
    val KeyVert = network._1
val EGraph = graph.subgraph(e => e.dstId == KeyVert)
println(KeyVert)
EGraph.edges.foreach(println)
}

```

However it will only work if you add the collect function to collect the graph data from the rdd e.g.

```
graph.vertices.collect.foreach {
  network => 
    val KeyVert = network._1
val EGraph = graph.subgraph(e => e.dstId == KeyVert)
println(KeyVert)
EGraph.edges.foreach(println)
}

```

The network is too large to be collecting edge data so any help would be much appreciated.