Overview
You can create one or multiple HDC graphs for a graphset as needed. Each HDC graph is hosted on a single HDC server.
Showing HDC Graphs
Retrieves information about all HDC graphs of the current graphset by calling the hdc.graph.show()
procedure:
CALL hdc.graph.show()
Or retrieves a specific HDC graph, such as the one named hdcGraph_1
:
CALL hdc.graph.show("hdcGraph_1")
It returns a table _hdcGraphList
with the following fields:
Field |
Description |
---|---|
name |
Name of the HDC graph. |
graph_name |
Name of the current graphset from which the data was loaded. |
status |
Current state of the HDC graph, which can be DONE or CREATING , FAILED or UNKNOWN . |
stats |
Statistics about nodes and edges included in the HDC graph, including their schemas (labels), properties and total counts. |
is_default |
Indicates if it is the default HDC graph for the current graphset. |
hdc_server_name |
Name of the HDC server hosting the HDC graph. |
hdc_server_status |
Current state of this HDC server, which can be ACTIVE or DEAD . |
config |
Configurations 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()
precedure can be called to create an HDC graph for the current graphset. The HDC graph creation is executed as a job, you may run CALL job.show(<id?>)
afterward to verify the success of the creation.
Syntax
CALL hdc.graph.create("<hdcServerName>", "<hdcGraphName>", {
nodes: {
"<label?>": ["<property1?>", "<property2?>", ...],
"<label2?>": ["<property1?>", "<property2?>", ...],
...
},
edges: {
"<label1?>": ["<property1?>", "<property2?>", ...],
"<label2?>": ["<property1?>", "<property2?>", ...],
...
},
direction: "<edgeDirection?>",
load_id: <boolean?>,
update: "<dataSyncMode>",
query: "query",
default: <boolean?>
})
Param | Description | Optional | |
---|---|---|---|
<hdcServerName> |
Name of the HDC server to host the HDC graph. | No | |
<hdcGraphName> |
Name of the HDC graph. Each HDC graph name within an HDC server must be unique and cannot duplicate the name of any distributed projection of the same graphset. | No | |
Config Map | nodes |
Specifies 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 |
edges |
Specifies edges to load based on labels and properties. All system properties are loaded by default. Sets to "*": ["*"] to load all edges. |
Yes | |
direction |
Since 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_id |
Sets to false to load nodes without _id values to save the memory space; it defaults to true . |
Yes | |
update |
Sets the data sync mode. Only static (default) is supported now where any data change in the physical storage will not be synchronized to the HDC graph. |
Yes | |
query |
This is a reserved parameter to set a query to specify the data to load. Now it can be set to query only. |
No | |
default |
Sets to true to specify this HDC graph as the default one for the current graphset; it defaults to false . |
Yes |
Examples
To load the entire current graphset to hdc-server-1
as hdcGraph
:
CALL hdc.graph.create("hdc-server-1", "hdcGraph", {
nodes: {"*": ["*"]},
edges: {"*": ["*"]},
direction: "undirected",
load_id: true,
update: "static",
query: "query",
default: true
})
To load nodes labeled account
and movie
with selected properties and incoming edges labeled rate
in the current graphset to hdc-server-1
as hdcGraph_1
, while omitting nodes' _id
values:
CALL hdc.graph.create("hdc-server-1", "hdcGraph_1", {
nodes: {
"account": ["name", "gender"],
"movie": ["name", "year"]
},
edges: {"rate": ["*"]},
direction: "in",
load_id: false,
update: "static",
query: "query",
default: false
})
Dropping an HDC Graph
You can drop any HDC graph of the current graphset from the HDC server by calling the hdc.graph.drop()
procedure.
The following example deletes the HDC graph named hdcGraph_1
:
CALL 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.