0

I am new in scala and spark-graphX.

How can I declare spark-graphx variable as global variable in scala.

I have a method to create graph with spark-graphX and it is successful. Now , I want to retrieve graph details from another method. For that, I need to declare graph variable as global. Please suggest how can I do that

Rhea
  • 381
  • 1
  • 7
  • 22

1 Answers1

0

You can do it like any other data structure in scala just declare it outside the method in the main body of the class or object you have created. Make sure you give the same signature and initialize it to null. Like this

var graph: Graph[vertexType, edgeType] = null, for example 
var graph: Graph[Long, Long] = null