MaxCompute Studio lets you write, debug, package, and run Graph programs directly from IntelliJ IDEA. This guide walks you through the full development cycle.
Prerequisites
Before you begin, ensure that you have:
Connected MaxCompute Studio to your project. For details, see Manage project connections.
Created a MaxCompute Java module. For details, see Create a MaxCompute Java module.
Write a Graph program
Create the Java classes
A Graph program requires two class types working together: a GraphLoader to load the graph from an input table, and a Vertex to define the computation each node performs. You must implement both.
| Class type | Role | Configured by |
|---|---|---|
| GraphLoader | Reads the input table and constructs the graph | setGraphLoaderClass method of GraphJob |
| Vertex | Defines per-node computation; has id, value, halted, and edges properties | setVertexClass method of GraphJob |
The following steps use BaseLoadingVertexResolver (GraphLoader) and SSSP (Vertex) as examples.
In the left-side navigation pane of the Project tab, choose src > main > java, right-click java, and choose New > MaxCompute Java.

Enter a Name and select GraphLoader or Vertex as the class type, then press Enter.
If no package exists yet, enter
packagename.classname. The system creates the package automatically.
Implement the Graph logic in the editor. For complete
BaseLoadingVertexResolverandSSSPimplementations, see SSSP.
Configure Maven dependencies
Add the following dependencies to pom.xml:
<dependency>
<groupId>com.aliyun.odps</groupId>
<artifactId>odps-sdk-core</artifactId>
<version>0.48.0-public</version>
</dependency>
<dependency>
<groupId>com.aliyun.odps</groupId>
<artifactId>odps-sdk-graph</artifactId>
<version>0.48.0-public</version>
</dependency>
<!-- Required for local testing -->
<dependency>
<groupId>com.aliyun.odps</groupId>
<artifactId>odps-graph-local</artifactId>
<version>0.48.0-public</version>
</dependency>After saving, verify that all three dependencies load successfully in the Maven pane.
Debug the Graph program
Run the Graph program locally to verify it produces the expected results.
Right-click the Java file and select Run.
In the Run/Debug Configurations dialog box, set the following parameters:
Parameter Description MaxCompute project The project in which to run the Graph program Download Record limit Maximum number of records to download. Default value: 100 
Click OK. The Graph program runs in local execution mode, reading data from the specified table in the warehouse directory. View the output in the console. For details about the warehouse directory, see Overview.
Package and upload the Graph program
Package the Graph program into a JAR file and upload it to your MaxCompute project as a resource. For details, see Package, upload, and register a Java program.
Run the Graph program
In the left-side navigation pane of IntelliJ IDEA, click Project Explorer.
Right-click the name of your MaxCompute project and select Open in Console.
In the Console section, run the following command:
jar -libjars xxx.jar -classpath /Users/home/xxx.jar com.aliyun.odps.graph.examples.PageRank pagerank_in pagerank_out;Replace the placeholders based on your Graph program:
Placeholder Description PageRankThe main class defined in your Graph program pagerank_inThe input table containing the graph data pagerank_outThe output table for results For additional command options, see Submit a MapReduce job.
What's next
Explore more Graph algorithm examples: SSSP
Learn about packaging and registering resources: Package, upload, and register a Java program