Help Center> > User Guide > Getting Started with GES >Querying and Analyzing Graphs

Querying and Analyzing Graphs

This section describes how to use GES to query and analyze the sample graph data. The process is as follows:

Step 1: Creating a Graph

Step 2: Accessing the Graph

Step 3: Querying and Analyzing the Graph

Step 4: Viewing the Analysis Result

Step 1: Creating a Graph

  1. Log in to the GES management console and click Create Graph. The Create Graph page is displayed.
  2. Configure the following parameters:
    • Specify the Region and AZ.

      Region: Area where a cluster works. You can select the region from the drop-down list in the upper left corner of the page.

      AZ: A physical region where resources use independent power supply and networks. AZs are physically isolated but interconnected through the internal network. This improves the availability of applications.

      NOTE:

      You are advised to create clusters in different AZs and select the AZ associated with the cluster region.

    • Specify the Graph Name, for example, demo, or use the default name in the system.

      The graph name must comply with the following rules:

      • Contain 4 to 64 characters and start with a letter.
      • Letters are case-insensitive.
      • Contain only letters, digits, and underscores (_).
    • Select the GES Software Version as required.
      NOTE:

      Currently, only the default version can be selected.

    • Specify the network information, including VPC, Subnet, and Security Group.
      • VPC: A Virtual Private Cloud (VPC) is a secure, isolated, logical network environment.

        Select the VPC of the cluster to be created. Click View VPC to enter the VPC service page and view the names and IDs of existing VPCs.

        NOTE:

        If no VPC is available, create one.

      • Subnet: A subnet provides dedicated network resources that are logically isolated from other networks, improving network security.

        Select the subnet of the cluster to be created. Enter the VPC service page and click the name of the selected VPC to view the names and IDs of existing subnets.

        NOTE:

        The subnet takes effect in an AZ only.

      • Security Group: A security group is a logical group. It provides access control policies for the ECSs that are mutually trusted and have the same security protection requirements in a VPC.

        Click How is a security group configured? to learn how to configure a security group.

        Click View Security Group to learn security group details.

    • Select the Public Network Access mode as required. Possible values are Do Not Use, Buy Now, and Specify.
      • Do Not Use: A graph instance without an elastic IP (EIP) address cannot access the Internet, but can be used through ECSs deployed on a private network.
      • Buy Now: GES automatically assigns a graph instance an EIP that uses dedicated bandwidth so that the graph instance can be accessed from the Internet through the EIP. In addition, GES uses the tenant's permission to create an agency with the prefix of ges_agency_default automatically to support EIP association.
      • Specify: If a specific EIP has been bound to a graph instance, users can access the graph instance using this EIP from the Internet.

        Click Create EIP to access the VPC management console and create an EIP.

    • Set graph parameters.
      • Purpose: Enterprise production or developer learning
        • Enterprise production: Supports high reliability and concurrency, suitable for enterprise production and large-scale application.
        • Developer learning: Offers complete function experience, suitable for developer learning.
      • Graph Size (edges): Based on a user's current quota, the system displays the numbers of graphs and edges that can be created. The unit is edge. Enterprise production and developer learning have different graph specifications.
        • Enterprise production: Currently, Million-edge, Ten-million-edge, Hundred-million-edge, Billion-edge, Ten-billion-edge, and One-hundred-billion-edge are supported.
        • Developer learning: Currently, only Ten-thousand-edge is supported.
      • Initial Data Required: This option is disabled by default. If it is enabled, you need to set the following parameters.
        • Metadata: Indicates the graph metadata information. If no metadata is available, click Create Metadata File. For details about how to create a metadata file, see Metadata Management.
        • Edge Data: Describes edges that form the graph, including information about the edge structures, labels, and properties.
        • Vertex Data: Describes vertices that form the graph, including information about all vertex IDs, labels, and properties. If it is not selected, the vertices in the Edge Data are used as the source of Vertex Data.
          NOTE:

          Edge and vertex data sets can only be English paths and folders.

        • Log Storage Path: Stores vertex and edge data sets that do not comply with the metadata definition, as well as detailed logs during graph import. Storage on OBS may incur fees, so delete the data in time.
        • Edge Processing: Includes Allow repetitive edges, Ignore subsequent repetitive edges, and Overwrite previous repetitive edges.
        NOTE:

        Currently, you can select the metadata file and edge and vertex data sets only from OBS. You are advised to store data files on OBS in advance. For details about how to import data files to OBS, see the Object Storage Service Console Operation Guide.

        Graph data (including the metadata file and edge and vertex data sets) needs to be imported based on the format in the template. The template contains a copy of movie data. You can click Download to download and import it.

      Figure 1 Graph parameter configuration
  3. Click Next. The Confirm page is displayed.
  4. Confirm the information and click Submit to create the graph.
  5. After the submission is successful, the Finish page is displayed. You can click Back to Task Center to view the status and running result of the created graph.

Step 2: Accessing the Graph

  1. On the Graph Management page, select the graph to be accessed, for example, demo created in the previous steps. Click Access in the Operation column. The graph editor is displayed.
  2. Enter the displayed graph editor, and query and analyze the current graph. For details, see Step 3: Querying and Analyzing the Graph.

Step 3: Querying and Analyzing the Graph

  • Query using Gremlin commands
    1. Enter the query command in the Gremlin text box in the upper part of the page, for example, g.V().limit(100).
      NOTE:

      To prevent the system queries from being time-consuming due to a large amount of returned data, you are advised to configure the limit parameter and set it to less than 1000 for a better display effect.

      Figure 2 Gremlin query
    2. Press Enter to run the Gremlin command. The query result is displayed in both the drawing area and result area.
      Figure 3 Gremlin query result
  • Analysis by selecting algorithms and configuring parameters
    1. The algorithms supported by the current system are displayed in the left pane of the graph editor. Select the target analysis algorithm from the list.
      Figure 4 Algorithm list
    2. Select the algorithm to be used, click to expand its parameter configuration, and enter corresponding values based on the required range. Take PageRank as an example. alpha indicates the weight coefficient, and its value is 0.85. convergence is the convergence coefficient, and its value is 0.00001. max_iterations indicates the maximum iterations and its value is 1000. directed indicates whether to consider the edge direction and the default value is true.
      Figure 5 Setting PageRank algorithm parameters
    3. Execute the algorithm by clicking . The analysis result is displayed in both the drawing area and result area.
      Figure 6 Analysis result

Step 4: Viewing the Analysis Result

You can view the running record and query result in the result area or click the Export button in the upper right corner to download the analysis result.