UltipaDocs
Try Playground
  • Introduction
  • Terminologies
    • Graphset
    • Schema
    • Property
    • Constraints
    • Insert
    • Overwrite or Insert
    • Upsert
    • Update
    • Delete
    • Find Nodes
    • Find Edges
      • AB
      • Autonet
      • Spread
      • Path Template
      • K-Hop
      • K-Hop Template
    • GROUP BY
    • ORDER BY
    • SKIP
    • LIMIT
    • WHERE
    • RETURN
    • WITH
    • UNCOLLECT
    • UNION
    • UNION ALL
    • CALL
    • All Functions
    • Path Functions
    • Aggregate Functions
    • Mathematical Functions
    • Trigonometric Functions
    • String Functions
    • List Functions
    • Datetime Functions
    • Spatial Functions
    • Table Functions
    • Null Functions
    • Type Conversion Functions
  • Operators
  • Expressions
    • Index
    • Full-text Index
    • Vector Index
    • Cache
    • Overview
    • Managing HDC Graphs
    • HDC Graph Queries
    • Process
    • Job
    • Execution Plan
    • Alias
    • Filter
    • Values and Types
    • Data Flow in Queries
    • Comments
    • Reserved Words
  • Access Control
  1. Docs
  2. /
  3. UQL
  4. /
  5. HDC Graphs

Managing HDC Graphs

Overview

You can create one or multiple HDC graphs for a graphset 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 graphset:

UQL
hdc.graph.show()

Or retrieves a specific HDC graph, such as the one named hdcGraph_1:

UQL
hdc.graph.show("hdcGraph_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, CREATING, FAILED or UNKNOWN.
statsStatistics about nodes and edges included in the HDC graph, including their schemas, 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.

When retrieving a specific HDC graph using hdc.graph.show("<name>"), two supplementary tables are returned:

  • _graph_from_<hdcServerName>: Shows all HDC graphs hosted by <hdcServerName>.
  • _algoList_from_<hdcServerName>: Lists all algorithms installed on <hdcServerName>.

Here, <hdcServerName> is the HDC server hosting the specified HDC graph.

Creating an HDC Graph

The hdc.graph.create().to() statement creates an HDC graph for the current graphset. 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
hdc.graph.create("<hdcGraphName>", {
  nodes: {
    "<schema1>": ["<property1>", "<property2>", ...],
    "<schema2>": ["<property1>", "<property2>", ...],
    ...
  },
  edges: {
    "<schema1>": ["<property1>", "<property2>", ...],
    "<schema2>": ["<property1>", "<property2>", ...],
    ...
  },
  direction: "<edgeDirection>",
  load_id: <boolean>,
  update: "<static_or_sync>"
}).to("<hdcServerName>")
MethodParamDescriptionOptional
create()<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 graphset cannot have duplicate names.No
Config MapnodesSpecifies nodes to load based on schemas 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 schemas 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
to()<hdcServerName>Name of the HDC server to host the HDC graph.No

[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 graphset to hdc-server-1 as hdcGraph:

UQL
hdc.graph.create("hdcGraph", {
  nodes: {"*": ["*"]},
  edges: {"*": ["*"]},
  direction: "undirected",
  load_id: true,
  update: "static"
}).to("hdc-server-1")

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:

UQL
hdc.graph.create("hdcGraph_1", {
  nodes: {
    "account": ["name", "gender"],
    "movie": ["name", "year"]
  },
  edges: {"rate": ["*"]},
  direction: "in",
  load_id: false,
  update: "static"
}).to("hdc-server-1")

Dropping an HDC Graph

You can drop any HDC graph of the current graphset from the HDC server using the hdc.graph.drop() statement.

The following example deletes the HDC graph named hdcGraph_1:

UQL
hdc.graph.drop("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.