UltipaDocs
Try Playground
  • Introduction
    • Overview
    • Node and Edge Patterns
    • Path Patterns
    • Quantified Paths
    • Shortest Paths
    • Graph Patterns
    • Overview
    • Typed Graph
    • Open Graph
    • Graph Sharding and Storage
    • Constraints
    • Unique Identifiers
    • INSERT
    • INSERT OVERWRITE
    • UPSERT
    • SET
    • REMOVE
    • DELETE
    • Query Composition
    • Result Table and Visualization
    • MATCH
    • OPTIONAL MATCH
    • FILTER
    • LET
    • FOR
    • ORDER BY
    • LIMIT
    • SKIP
    • CALL
    • RETURN
    • Composite Query
    • NEXT
    • All Functions
    • Scalar Functions
    • Path Functions
    • Aggregate Functions
    • Mathematical Functions
    • Trigonometric Functions
    • String Functions
    • List Functions
    • Datetime Functions
    • Spatial Functions
    • Table Functions
  • Operators
  • Predicates
  • Expressions
    • Index
    • Full-text Index
    • Vector Index
    • Managing HDC Graphs
    • HDC Graph Queries
  • Transaction
  • Trigger
    • Process
    • Job
    • Execution Plan
    • Variables
    • Values and Types
    • Comments
    • Reserved Words
    • Syntactic Notation
  • Access Control
  • GQL Conformance
  1. Docs
  2. /
  3. ISO GQL
  4. /
  5. HDC Graphs

HDC Graphs

Overview

An HDC graph resides in the memory of an HDC (High-Density Computing) server and contains all or part of the data loaded from a graph, which is physically stored across one or multiple shard servers.

HDC graphs enable the execution of both graph queries and algorithms with enhanced performance.

For details on managing and using HDC graphs, see the following:

  • Managing HDC Graphs
  • HDC Graph Queries
  • HDC Graph Algorithms

Managing HDC Graphs

Overview

You can create one or multiple HDC graphs for a graph as needed. Each HDC graph is hosted on a single HDC server.

Note that each time an HDC server is rebooted, all hosted HDC graphs will be reloaded based on their configurations.

Showing HDC Graphs

Retrieves information about all HDC graphs of the current graph:

GQL
SHOW HDC GRAPH

Retrieves all HDC graphs of the current graph hosted on the HDC server hdc-server-1:

GQL
SHOW HDC GRAPH ON "hdc-server-1"

It returns a table _hdcGraphList with the following fields:

Field
Description
nameName of the HDC graph.
graph_nameName of the current graphset from which the data was loaded.
statusCurrent state of the HDC graph, which can be DONE or CREATING, FAILED or UNKNOWN.
statsStatistics about nodes and edges included in the HDC graph, including their schemas (labels), properties and total counts.
hdc_server_nameName of the HDC server hosting the HDC graph.
hdc_server_statusCurrent state of this HDC server, which can be ACTIVE or DEAD.
configConfigurations for the HDC graph.

Creating an HDC Graph

The CREATE HDC GRAPH statement can be used to create an HDC graph for the current graph. The HDC graph creation is executed as a job, you may run SHOW JOB <id?> afterward to verify the success of the creation.

Syntax

Syntax
CREATE HDC GRAPH [IF NOT EXISTS] <hdcGraphName> ON "<hdcServerName>" OPTIONS {
  nodes: {
    "<schema1>": ["<property1>", "<property2>", ...],
    "<schema2>": ["<property1>", "<property2>", ...],
    ...
  },
  edges: {
    "<schema1>": ["<property1>", "<property2>", ...],
    "<schema2>": ["<property1>", "<property2>", ...],
    ...
  },
  direction: "<edgeDirection>",
  load_id: <boolean>,
  update: "<static_or_sync>"
}
ParamDescriptionOptional
<hdcGraphName>Name of the HDC graph. HDC graphs hosted by the same HDC server cannot have duplicate names. HDC graphs and projections of the same graph cannot have duplicate names.No
<hdcServerName>Name of the HDC server to host the HDC graph.No
OPTIONSnodesSpecifies nodes to load based on labels and properties. The _uuid is loaded by default, while _id is configurable with load_id. Sets to "*": ["*"] to load all nodes.Yes
edgesSpecifies edges to load based on labels and properties. All system properties are loaded by default. Sets to "*": ["*"] to load all edges.Yes
directionSince each edge is physically stored twice - as an incoming edge along its destination node and an outgoing edge with its source node - you can choose to load only incoming edges with in, only outgoing edges with out, or both (the default setting) with undirected. Please note that in or out restricts graph traversal during computation to the specified direction.Yes
load_idSets to false to load nodes without _id values to save the memory space; it defaults to true.Yes
updateSets the data sync mode as:
  • static: This is the default. Any data change in the physical storage will not be synchronized to the HDC graph.
  • sync: The insertion, update, and deletion of nodes and edges will be synchronized to the HDC graph.[1] [2]
Yes

[1] Note: Modifications to the graph structure (schemas and properties) will not be synchronized. For example, if you add a new node schema and insert nodes into it, neither the schema nor the nodes will be synchronized with the HDC graph.
[2] The synchronization occurs after two heartbeats.

Examples

To load the entire current graph to hdc-server-1 as hdcGraph:

GQL
CREATE HDC GRAPH hdcGraph ON "hdc-server-1" OPTIONS {
  nodes: {"*": ["*"]},
  edges: {"*": ["*"]},
  direction: "undirected",
  load_id: true,
  update: "static"
}

To load account and movie nodes with selected properties and incoming rate edges in the current graph to hdc-server-1 as hdcGraph_1, while omitting nodes' _id values:

GQL
CREATE HDC GRAPH hdcGraph_1 ON "hdc-server-1" OPTIONS {
  nodes: {
    "account": ["name", "gender"],
    "movie": ["name", "year"]
  },
  edges: {"rate": ["*"]},
  direction: "in",
  load_id: false,
  update: "static"
}

The IF NOT EXISTS clause is used to prevent errors when attempting to create an HDC graph that already exists. It allows the statement to be safely executed.

GQL
CREATE HDC GRAPH IF NOT EXISTS hdcGraph ON "hdc-server-1" OPTIONS {
  nodes: {"*": ["*"]},
  edges: {"*": ["*"]},
  direction: "undirected",
  load_id: true,
  update: "static"
}

This creates the HDC graph hdcGraph only if an HDC graph with that name does not exist. If hdcGraph already exists, the statement is ignored without throwing an error.

Dropping an HDC Graph

You can drop any HDC graph of the current graph from the HDC server using the DROP HDC GRAPH statement.

The following example deletes the HDC graph named hdcGraph_1:

GQL
DROP HDC GRAPH hdcGraph_1

HDC Graph List Synchronization

HDC graphs are managed by the database's meta server. The latest HDC graph list is synchronized from the meta server to the name server during each heartbeat cycle. This list on the name server is referenced whenever HDC queries or algorithms are executed.

After creating or dropping an HDC graph, it is advisable to wait for two heartbeat intervals before performing further operations on the affected HDC graph. To adjust the heartbeat interval, update the heartbeat_interval_s setting (defaults to 3 seconds) in the Server section of the name server configuration.