Its very much possible to use GraphX through Java, though some boilerplate may be needed. Here is an example.

Create a graph from edge and vertex RDD (JavaRDD<Tuple2<Object, Long>> vertices, JavaRDD<Edge<Long>> edges )

ClassTag longTag = scala.reflect.ClassTag$.MODULE$.apply(Long.class);
Graph<Long,Float> graph = Graph.apply(vertices.rdd(),
edges.rdd(), 0L, StorageLevel.MEMORY_ONLY(), StorageLevel.MEMORY_ONLY(), 
longTag, longTag);


Then basically you can call graph.ops() and do available operations like triangleCounting etc, 

On Tue, May 31, 2016 at 11:40 AM, Santoshakhilesh <> wrote:

Hi ,

Scala has similar package structure as java and finally it runs on JVM so probably you get an impression that its in Java.

As far as I know there are no Java API for GraphX. I had used GraphX last year and at that time I had to code in Scala to use the GraphX APIs.

Santosh Akhilesh



From: Kumar, Abhishek (US - Bengaluru) []
Sent: 30 May 2016 13:24
To: Santoshakhilesh;
Cc: Golatkar, Jayesh (US - Bengaluru); Soni, Akhil Dharamprakash (US - Bengaluru); Matta, Rishul (US - Bengaluru); Aich, Risha (US - Bengaluru); Kumar, Rajinish (US - Bengaluru); Jain, Isha (US - Bengaluru); Kumar, Sandeep (US - Bengaluru)
Subject: RE: GraphX Java API



·       I see some graphx packages listed here:

·       org.apache.spark.graphx

·       org.apache.spark.graphx.impl

·       org.apache.spark.graphx.lib

·       org.apache.spark.graphx.util

Aren’t they meant to be used with JAVA?



From: Santoshakhilesh []
Sent: Friday, May 27, 2016 4:52 PM
To: Kumar, Abhishek (US - Bengaluru) <>;
Subject: RE: GraphX Java API


GraphX APis are available only in Scala. If you need to use GraphX you need to switch to Scala.


From: Kumar, Abhishek (US - Bengaluru) []
Sent: 27 May 2016 19:59
Subject: GraphX Java API




We are trying to consume the Java API for GraphX, but there is no documentation available online on the usage or examples. It would be great if we could get some examples in Java.


Thanks and regards,


Abhishek Kumar




This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message and any disclosure, copying, or distribution of this message, or the taking of any action based on it, by you is strictly prohibited.