label

Labels are used to categorize nodes, and the label module provides a function to check the existence of a label within the node.

TraitValue
Module typeutil
ImplementationC++
Graph directiondirected/undirected
Edge weightsweighted/unweighted
Parallelismsequential

Functions

exists()

Checks whether a specified node is labeled with the provided label.

Input:

  • node: Any ➡ The target node for label check.
  • label: string ➡ Denotes the specific label name to be verified on the given node.

Output:

  • bool ➡ A boolean value indicating whether the specified label is present on the provided node.

Usage:

The following query checks if the created node labeled Student also has a Teacher label:

CREATE (:Student {name: 'Ana'});
MATCH (s:Student {name: 'Ana'}) RETURN label.exists(s, "Teacher") AS exists;

Results:

+----------------------------+
| exists                     |
+----------------------------+
| False                      |
+----------------------------+