label

Labels are used to categorize nodes, and the label module provides an array of utilities for working with labels in a Memgraph database.

docs-source (opens in a new tab)

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

Procedures

exists(node, label)

Checks whether a specified label exists within the provided node.

Input:

  • node: Any ➡ node whose labels are to be checked.
  • label: string ➡ name of the label whose existence is to be confirmed.

Output:

  • exists: bool ➡ whether or not provided node has a specified label.

Usage:

CREATE (:Student {name: 'Ana'});
MATCH (s:Student {name: 'Ana'}) CALL label.exists(s, "Teacher") YIELD exists RETURN exists;
+----------------------------+
| exists                     |
+----------------------------+
| False                      |
+----------------------------+