Skip to content
Blog

Node & relationship functions

The following functions are used to get information about nodes and relationships.

FunctionDescriptionAlias
IDreturns the internal ID of node/rel
LABELreturns the label name of node/relationshipLABELS
OFFSETreturns the offset of the internal ID

See below for more details on each of these functions.

ID

Returns the internal ID of node/rel.

Input typeOutput type
NODEID (Internal database ID)
RELID (Internal database ID)
MATCH (a:User) RETURN ID(a) AS ID LIMIT 1;

Output:

┌─────────────┐
│ ID │
│ INTERNAL_ID │
├─────────────┤
│ 0:0 │
└─────────────┘

LABEL

Returns the label name of node/rel.

Input typeOutput type
NODESTRING
RELSTRING
MATCH (a) RETURN LABEL(a) AS LABEL LIMIT 1;

Output:

┌────────┐
│ LABEL │
│ STRING │
├────────┤
│ User │
└────────┘

OFFSET

Returns the offset of the internal ID.

Input typeOutput type
IDINT64
MATCH (a) RETURN OFFSET(ID(a)) AS OFFSET LIMIT 1;

Output:

┌────────┐
│ OFFSET │
│ INT64 │
├────────┤
│ 0 │
└────────┘