Last Updated: May 07, 2018

Submitting a Graph job is similar to submitting a job using MapReduce. The following section uses SSSP Algorithm as an example to show how to submit Graph jobs. Maven users can search “odps-sdk-graph” from Maven Library to get the required SDK (available in different versions). The related configuration information is as follows:

  1. <dependency>
  2. <groupId>com.aliyun.odps</groupId>
  3. <artifactId>odps-sdk-graph</artifactId>
  4. <version>0.20.7</version>
  5. </dependency>

To run a Graph job using the SSSP algorithm, follow these steps.

  1. Enter the console and run “odpscmd”.

  2. Create Input Table and Output Table.

    1. create table sssp_in (v bigint, es string);
    2. create table sssp_out (v bigint, l bigint);


    For the statement to create table, see SQL Create.

  3. Upload Data.
    The contents of local data is as follows:

    1. 1,2:2,3:1,4:4
    2. 2,1:2,3:2,4:1
    3. 3,1:1,2:2,5:1
    4. 4,1:4,2:1,5:1
    5. 5,3:1,4:1

    “tab” button is taken as the separator of two columns.Upload the data:

    1. tunnel u -fd "," sssp.txt sssp_in;
  4. Write SSSP example.
    According to the introduction in Graph Eclipse Plug-in, compile and debug SSSP Example on local.

    You only need to package the SSSP code. You do not need to package the SDK in “odps-graph-example-sssp.jar”.

  5. Add JAR package.

    1. add jar $LOCAL_JAR_PATH/odps-graph-example-sssp.jar odps-graph-example-sssp.jar


    For resource creation, see Resource Operation.

  6. Run SSSP.

    1. jar -libjars odps-graph-example-sssp.jar -classpath $LOCAL_JAR_PATH/odps-graph-example-sssp.jar
    2. com.aliyun.odps.graph.examples.SSSP 1 sssp_in sssp_out;

    JAR command is used to run MaxCompute GRAPH. Its use method is consistent with MapReduce.

    When GRAPH job is running, corresponding instance ID, execution schedule and result summary are printed on the command line, as follows:

    1. ID = 20130730160742915gl205u3
    2. 2013-07-31 00:18:36 SUCCESS
    3. Summary:
    4. Graph Input/Output
    5. Total input bytes=211
    6. Total input records=5
    7. Total output bytes=161
    8. Total output records=5
    9. graph_input_[bsp.sssp_in]_bytes=211
    10. graph_input_[bsp.sssp_in]_records=5
    11. graph_output_[bsp.sssp_out]_bytes=161
    12. graph_output_[bsp.sssp_out]_records=5
    13. Graph Statistics
    14. Total edges=14
    15. Total halted vertices=5
    16. Total sent messages=28
    17. Total supersteps=4
    18. Total vertices=5
    19. Total workers=1
    20. Graph Timers
    21. Average superstep time (milliseconds)=7
    22. Load time (milliseconds)=8
    23. Max superstep time (milliseconds) =14
    24. Max time superstep=0
    25. Min superstep time (milliseconds)=5
    26. Min time superstep=2
    27. Setup time (milliseconds)=277
    28. Shutdown time (milliseconds)=20
    29. Total superstep time (milliseconds)=30
    30. Total time (milliseconds)=344
    31. OK


    New users are recommended to submit their Graph job, and provide the name of the MaxCompute project and its usage scenario, to Alibaba Cloud. If the review of the job is successful, the Graph function is opened.

Thank you! We've received your feedback.