Graph

Last Updated: Jun 22, 2016

The sumbitting method of Graph job is similar to MapReduce. Next, take SSSP Algorithm as an example to illustrate how to submit Graph job. Users who use Maven can search “odps-sdk-graph” from Maven Library to get different versions of Java SDK. The related configuraion information:

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

Next we will take SSSP (Single Source Shortest Path) as an example to help you quickly grasp how to run Graph job.

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);

Note:

  • For the statement to create table, refer to SQL Create.

3.Upload Data

The contents of local data:

  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.

Note:Please note that you just need to package SSSP code, not to package SDK in “odps-graph-example-sssp.jar”.

5.Add Jar

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

Note:

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 ODPS GRAPH. Its use method is consistent with MapReduce.When GRAPH job is running, corresponding instance ID, execution schedule and result summary will be printed on 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

Note:If a new user needs to use graph, he must submit the application on workorder system, provide the name of his ODPS project and describe the use scenario simply. Only after your application is passed and the corresponding privileges are opened, you can use odps graph function.

Thank you! We've received your feedback.