Implement a directed Graph as an undirected graph using GraphX
Asked Answered
M

1

10

I have following directed graph as given by the nodes and edges below.

Nodes

1,2,3,4,5

Edges

(1,2),(1,3),(1,4),(2,5),(3,4),(3,5),(4,5)

How do I convert this directed graph to undirected graph Do I have to convert using built-in method. If there is build in method, what method is it?. Or, do I have to add edges manually in the dataset such as (1,2) to (2,1).

Movie answered 21/11, 2016 at 20:22 Comment(0)
A
12

You don't need to convert your graph to an undirected graph. You'll simply have to treat it as an undirected graph (by simply ignoring the edge directions).

For example, if you use collectNeighbors, you can make it act as an undirected graph by passing an EdgeDirection.Either as parameter.

Afterdamp answered 21/11, 2016 at 21:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.