Skip to main content


Supported functions​

This section contains the list of supported functions.

startNodeReturns the starting node of an edge.
endNodeReturns the destination node of an edge.
degreeReturns the number of edges (both incoming and outgoing) of a node.
headReturns the first element of a list.
lastReturns the last element of a list.
propertiesReturns the properties of a node or an edge.
sizeReturns the number of elements in a list or a map. When given a string it returns the number of characters. When given a path it returns the number of expansions (edges) in that path.
toBooleanConverts the argument to a boolean.
toFloatConverts the argument to a floating point number.
toIntegerConverts the argument to an integer.
typeReturns the type of an edge as a character string.
keysReturns a list keys of properties from an edge or a node. Each key is represented as a string of characters.
labelsReturns a list of labels from a node. Each label is represented as a character string.
nodesReturns a list of nodes from a path.
relationshipsReturns a list of relationships (edges) from a path.
rangeConstructs a list of value in given range.
tailReturns all elements after the first of a given list.
uniformSampleReturns elements of given list randomly oversampled or undersampled to desired size, e.g. uniformSample([1, 2, 3], 5) -> [1, 2, 3, 2, 3]
absReturns the absolute value of a number.
ceilReturns the smallest integer greater than or equal to given number.
floorReturns the largest integer smaller than or equal to given number.
roundReturns the number, rounded to the nearest integer. Tie-breaking is done using the commercial rounding, where -1.5 produces -2 and 1.5 produces 2.
expCalculates e^n where e is the base of the natural logarithm, and n is the given number.
logCalculates the natural logarithm of a given number.
log10Calculates the logarithm (base 10) of a given number.
sqrtCalculates the square root of a given number.
acosCalculates the arccosine of a given number.
asinCalculates the arcsine of a given number.
atanCalculates the arctangent of a given number.
atan2Calculates the arctangent2 of a given number.
cosCalculates the cosine of a given number.
sinCalculates the sine of a given number.
tanCalculates the tangent of a given number.
signApplies the signum function to a given number and returns the result. The signum of positive numbers is 1, of negative -1 and for 0 returns 0.
eReturns the base of the natural logarithm.
piReturns the constant pi.
randReturns a random floating point number between 0 (inclusive) and 1 (exclusive).
startsWithCheck if the first argument starts with the second.
endsWithCheck if the first argument ends with the second.
containsCheck if the first argument has an element which is equal to the second argument.
leftReturns a string containing the specified number of leftmost characters of the original string.
lTrimReturns the original string with leading whitespace removed.
replaceReturns a string in which all occurrences of a specified string in the original string have been replaced by another (specified) string.
reverseReturns a string in which the order of all characters in the original string have been reversed.
rightReturns a string containing the specified number of rightmost characters of the original string.
rTrimReturns the original string with trailing whitespace removed.
splitReturns a list of strings resulting from the splitting of the original string around matches of the given delimiter.
substringReturns a substring of the original string, beginning with a 0-based index start and length.
toLowerReturns the original string in lowercase.
toStringConverts an integer, float or boolean value to a string.
toUpperReturns the original string in uppercase.
trimReturns the original string with leading and trailing whitespace removed.
allCheck if all elements of a list satisfy a predicate. The syntax is: all(variable IN list WHERE predicate).
NOTE: Whenever possible, use Memgraph's lambda functions when matching instead.
anyCheck if any element in the list satisfies the predicate. The syntax is: any(element IN list WHERE predicate_using_element).
singleCheck if only one element of a list satisfies a predicate. The syntax is: single(variable IN list WHERE predicate).
reduceAccumulate list elements into a single result by applying an expression. The syntax is: reduce(accumulator = initial_value, variable IN list \| expression).
extractA list of values obtained by evaluating an expression for each element in list. The syntax is: extract(variable IN list \| expression).
assertRaises an exception reported to the client if the given argument is not true.
counterGenerates integers that are guaranteed to be unique within a single query for a given counter name. The syntax is counter("counter_name", initial_value, [increment] = 1). The increment parameter can be any integer besides zero.
timestampReturns the difference, measured in microseconds, between the current time and midnight, January 1, 1970 UTC.
idReturns identifier for a given node or edge. The identifier is generated during the initialization of node or edge and will be persisted through the durability mechanism.