Querying and Analyzing Graphs
If you have never used GES, you can use the sandbox access function to access a demo graph provided by the system to learn and use the functions of the graph editor. You can learn the functions through Quick Start. The system runs the PageRank algorithm by default.
This section describes how to use GES to query and analyze the sample graph data. The process is as follows:
Step 3: Querying and Analyzing the Graph
Step 4: Viewing the Analysis Result
Step 1: Creating a Graph
Log in to the GES management console and click Create Graph.
Two creation modes are available: Customize Graph and Use Industry-Specific Graph Template. By default, the system displays the Customize Graph tab page.
Method 1: Customize Graph
- On the Create Graph page, click the Customize Graph tab and set the following parameters:
- Select Region.
Region: Area where a graph works. You can select the region from the drop-down list in the upper left corner of the page.
- On the Configure tab page, set Graph Name and GES Software Version.
- Specify 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.
- Only letters, digits, and underscores (_) are allowed.
- Select the GES Software Version as required.
Currently, only the default version can be selected.
Figure 1 Graph name and software version
- Specify Graph Name, for example, demo, or use the default name in the system.
- Specify network information, including VPC, Subnet, Security Group, and Public Network Access. Figure 2 Network information
- VPC: A Virtual Private Cloud (VPC) is a secure, isolated, and logical network environment.
Select the VPC for which you want to create the graph and click View VPC to view the name and ID of the VPC.
If your account has a VPC, a VPC will be automatically selected. You can change it as required. If no VPC is available, you need to create a VPC. After the VPC is created, it will be automatically selected.
- Subnet: A subnet provides dedicated network resources that are logically isolated from other networks, improving network security.
Select the subnet for which you want to create the graph to enter the VPC and view the name and ID of the subnet.
- 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 Learn how to configure a security group. 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) cannot be accessed over the Internet. However, the graph instance can be accessed through ECSs deployed on a private network.
- Buy now: GES automatically allocates an EIP with exclusive bandwidth to the graph instance so that the graph instance can be accessed over the Internet using the EIP. In addition, GES uses the tenant permission to create an agency with the prefix of ges_agency_default automatically in the project to support EIP binding.
- Specify: An EIP allows the graph instance to be accessed over the Internet.
Click Create EIP to access the VPC management console and create an EIP.
- Enterprise Project: An enterprise project facilitates project-level management and grouping of cloud resources and users.
Click Create Enterprise Project to go to the Enterprise Project Management page.
- VPC: A Virtual Private Cloud (VPC) is a secure, isolated, and logical network environment.
- Set graph parameters. Figure 3 Graph parameters
- Purpose: Select 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.
- CPU Architecture: Currently, GES supports X86 and Kunpeng.
- 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, Billion-edge-pro, One-hundred-billion-edge, and Ten-billion-edge are supported.
- Developer learning: Currently, only Ten-thousand-edge is supported.
- Initial Data Required: This option is disabled by default. You can create a graph first and then import data. If you enable this option, 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.
If you already have metadata files, import them to GES.
- 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 you leave it blank, the vertices in the Edge Data set are used as the source of Vertex Data.
- The edge and vertex data sets can only be stored in English paths and folders.
- Currently, you can import the edge and vertex data sets only from OBS. Therefore, store data files on OBS in advance. For details about how to import data files to OBS, see the OBS Getting Started.
- The sequence of labels in the selected edge or vertex data set and the sequence of properties in the labels must be the same as those in the selected metadata file. Otherwise, The edge/vertex data file does not match the metadata file is prompted in the upper right corner and the graph fails to be created. For details about the data formats of GES graph data, see Graph Data Formats.
- Import the graph data (including the metadata file, and edge and vertex data sets) in the format specified in the corresponding template. The template contains a copy of movie data. You can click Download to download and import it.
- 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 a timely time if you do not need to use it any more.
- Edge Processing: Includes Allow repetitive edges, Ignore subsequent repetitive edges, Overwrite previous repetitive edges, and Ignore labels on repetitive edges.
Repetitive edges have the same source vertex and target vertex. When labels are considered, repetitive edges must have the same source and target vertices and the same labels.
Allow repetitive edges: Multiple edges may exist between a source vertex and a target vertex.
Ignore subsequent repetitive edges: If there are multiple edges between a source vertex and a target vertex, only the first edge read is retained.
Overwrite previous repetitive edges: If there are multiple edges between a source vertex and a target vertex, only the last edge read is retained.
Ignore labels on repetitive edges: If labels are ignored, edges with the source vertex and target vertex are repetitive edges.
- Metadata: Indicates the graph metadata information.
- Purpose: Select Enterprise production or Developer learning.
- Advanced Settings: Set this parameter to Default or Custom.
- Default: Use the default values of the system.
- Custom: Include Encrypt Instance and Operation Audit.
Encrypt Instance: Indicate whether to encrypt graph instances. Key Source is default to KMS. KMS Key: Select the corresponding key.
Disabling or deleting a KMS key affects the instance functions.
Operation Audit: Indicate whether to enable operation audit. LTS Log Group: Select the corresponding log group.
You will be billed for storing logs to LTS. For details, see the LTS billing standards.
- Select Region.
- Click Next. The Confirm tab page is displayed.
- Confirm the information and click Submit to create the graph.
- After the submission is successful, the Finish tab page is displayed. You can click Back to Task Center to view the status and running result of the created graph.
- Method 2: Use Industry-Specific Graph Template
- On the Create Graph page, click the Use Industry-Specific Graph Template tab and set the following parameters:
- Select Region.
Region: Area where a graph works. You can select the region from the drop-down list in the upper left corner of the page.
- On the Configure tab page, set the following parameters:
- Select Region.
- Click Next. On the Confirm tab page, confirm the specifications and click Submit. The system automatically creates the graph of the selected specifications and inserts the selected template data (schema and sample data).
- After the submission is successful, the Finish tab page is displayed. You can click Back to Task Center to view the status and running result of the created graph.
You do not need to set the name for a graph created using a template. By default, the name of the template is used as the prefix of the created graph, for example, assets_management.
After the graph is created, the name of the created graph is in assets_management_XXXX format, where XXXX is the unique identifier automatically generated by the system and cannot be modified.
Step 2: Accessing the Graph
- On the Graph Management page, locate the row containing the graph to be accessed, for example, demo created in the previous steps, and click Access in the Operation column.
- 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
- You can query and analyze graphs in either of the following ways if a graph is created in Customize Graph mode:
- Queries using Gremlin commands
- Enter the query command in the Gremlin text box in the lower part of the page, for example, g.V().limit(100).
To prevent the system queries from being time-consuming due to a large amount of returned data, you are advised to add the limit parameter and set it to less than 1,000 for a better display effect.
Figure 4 Gremlin query
- Press Enter to run the Gremlin command. The query result is displayed in both the drawing area and result area. Figure 5 Gremlin query result
- Enter the query command in the Gremlin text box in the lower part of the page, for example, g.V().limit(100).
- Analysis by selecting algorithms and configuring parameters
- The algorithms supported by GES are displayed in the left pane of the graph editor. Select the target analysis algorithm from the list. Figure 6 Algorithm list
- Select the algorithm to be used, expand its parameter configuration by clicking
, and input 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 1,000. directed indicates whether to consider the edge direction and the default value is true. Figure 7 Setting PageRank algorithm parameters
- Execute the algorithm by clicking
. The analysis result is displayed in both the drawing area and result area. Figure 8 Analysis result
- The algorithms supported by GES are displayed in the left pane of the graph editor. Select the target analysis algorithm from the list.
- Queries using Gremlin commands
- For a graph created using an industry-specific template, in addition to using the Gremlin commands and selecting algorithms and configuring parameters, four public operation scenarios of the industry-specific graph template are added.
- Scenario 1: List administrators and their applications.
- Command: g.V().hasLabel('admin').outE().otherV().hasLabel('application').path()
- Procedure: Click Run. The graph is displayed on the canvas.
- Scenario 2: Find all paths from administrator x to equipment room x.
- Implementation principle: get${Administrator x} is the source vertex and ${Equipment room x} is the target vertex. Find out all paths using the n-Paths algorithm, where source is Administrator x, target is Equipment room x, direct is false, n is 10, and k is10.
- Procedure: Click Run. In the dialog box that is displayed, select administrator x and equipment room x from the drop-down list box. After the operation is complete, the graph is displayed on the canvas.
- Scenario 3: Find all VMs and physical machines on which application x depends.
- Implementation principle: get${Application x} is the input to find all points at layer 2. Use the K-Hop algorithm, where k is 2, source is x, and mode is in.
- Procedure: Click Run. In the dialog box that is displayed, set the application x (select the application from the drop-down list box and drag the vertex of the application entity to the drop-down list box). After the operation is complete, the graph is displayed on the canvas.
- Scenario 4: Find all vertices with a specified label, for example, all administrators, equipment rooms, and physical machines in the graph.
- Implementation principle: Filter vertices by label.
- Procedure: Click Run. In the dialog box that is displayed, select the label from the drop-down list box. After the operation is complete, the graph is displayed on the canvas.
- Scenario 1: List administrators and their applications.
Last Article: Getting Started with GES
Next Article: Introduction to GES Management Console
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.