Updated on 2022-09-14 GMT+08:00

Creating a Graph

You can use a specific API provided by GES to create a graph. The sample code is as follows:

  private static void createGraph(GesClient client) throws GesSdkException {
        GraphReq graphReq = new GraphReq();
        graphReq.setName("ges0211");
        graphReq.setRegionCode("cn-north-1");
        graphReq.setAzCode("cn-north-1a");
        graphReq.setGraphSizeTypeIndex(1);
        graphReq.setSchemaPath("gesdata/movie/schema.xml");
        graphReq.setVertexsetPath("gesdata/movie/vertex.csv");
        graphReq.setEdgesetPath("gesdata/movie/edge.csv");
        graphReq.setEdgesetFormat("csv");
        graphReq.setVpcId("98a8900c-bd4c-4a29-a488-93f4b71378fb");
        graphReq.setSubnetId("b491203a-bcb7-4e0f-88e2-cdab3a636eef");
        graphReq.setSecurityGroupId("cefb75f5-fc97-4c82-a613-42d55299bd12");
        CreateGraphReq createGraphReq = new CreateGraphReq();
        createGraphReq.setGraph(graphReq);
        Graph graph = client.createGraph(createGraphReq);
        System.out.println(graph);
    }