A New Parallel Framework for Machine Learning

Examples

Java and Jython/Python interface

We provide a simple API to GraphLab for Java, using Java Native Interface (JNI).
On top of this, we also provide a Python -interface using Jython.
It is straightforward to write your own wrappers to other Java-enabled scripting languages.

Download

If you do not want to install the whole GraphLab C++ installation, you can simply
download the Java interface from here: graphlab_java_20101210.tar.gz.
We currently provide 64-bit Linux and Mac binary versions of the native library. For other platforms, you
need to build your own (see README.txt for instructions).

Consult README.txt for instructions on how to build the Java API and how to run the example applications.

(Java interface is also located as part of the main source distribution under directory extapis).

Java API for GraphLab

Java API for GraphLab is a 100% POJO (Plain Old Java Object) interface, and requires minimum
of boilerplate code to get started. You can use any Java libraries and you are not required
to write any "wrapper" code in C/C++.
Here are the steps required for writing a full GraphLab application in Java:

1. Create Graph. Create a graph encapsulating the data and dependencies. To encapsulate any type of data in a vertex, create a custom subclass
of graphlab.Vertex. Similarly for edges, simply subclass graphlab.Edge.
Basic graph class is graphlab.SparseGraph. Use methods addVertex() and addEdge() to construct the graph.
(You may also create your own implementation of graphlab.Graph, but this is necessary only if you need a highly compressed graph
representation or an implicitly created graph).

2. Update functions.
Implement update functions by creating implementations of abstract class graphlab.UpdateFunction. Interface is
similar to the C++ update function, with the exception of currently not supporting shared data

3. Run Graphlab.
Create instance of graphlab.wrapper.GraphLabJNIWrapper. Use its setX-methods to configure your
GraphLab session and provide the graph with setGraph() method. Call start() to
execute a GraphLab session.
Example:

Documentation

Examples

Package demo includes a couple of simple examples that demonstrate basic GraphLab functionality such
as prioritized scheduling and multiple update functions. In the package, directory examples includes
scripts to run these demos.

Python/Jython API

We have built on top of the GraphLab Java API a Python/Jython interface.
While the performance is not excellent (compared to native code), it provides a very easy way to start writing
GraphLab programs. Python programs are typically much more concise than Java or C++ applications, and allow
for quick experimenting. Note: Python API is in an early stage, but is almost fully functional (multiple
update functions are not supported).

Instructions

To use the Jython interface, you only need to install the Java Graphlab API (instructions above). Full GraphLab
Java API is available for the Python scripts.

GraphLab python program consists of four separate script-files:

1. Script for configuring the GraphLab parameters. This can be empty as well. Global variable graphlab
is a handle to the GraphLabJNIWrapper object.
For available methods, see GraphLabJNIWrapper API doc.

2. Script for creating the graph, or loading it from a file. Object graph is a handle to the graph object.
For vertex and edge data, you can use any python data type! Examples: