Cypher Functions

Cypher has many in-built functions. This reference contains all the functions present in Cypher Query Language.

Predicate Functions

all()returns true if the predicate holds for all elements in the given list.
any()returns true if the predicate holds for at least one element in the given list.
exists()returns true if a match for the given pattern exists in the graph, or if the specified property exists in the node, relationship or map.
none()returns true if the predicate holds for no element in the given list.
single()returns true if the predicate holds for exactly one of the elements in the given list.

Scalar Functions

coalesce()returns the first non-null value in the given list of expressions.
endNode()returns the end node of a relationship.
head()returns the first element in a list.
id()returns the id of a relationship or node.
last()returns the last element in a list.
length()returns the length of a path.
properties()returns a map containing all the properties of a node or relationship.
randomUUID()returns a randomly-generated Universally Unique Identifier (UUID), also known as a Globally Unique Identifier (GUID).
size()returns the number of elements in a list.
startNode()returns the start node of a relationship.
timestamp()returns the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.
toBoolean()converts a string value to a boolean value.
toFloat()converts an integer or string value to a floating point number.
toInteger()converts a floating point or string value to an integer value.
type()returns the string representation of the relationship type.

Aggregating Functions

avg()returns the average of a set of numeric values/ Durations.
collect()returns a list containing the values returned by an expression. 
count()returns the number of values or rows.
max()returns the maximum value in a set of values.
min()returns the minimum value in a set of values.
percentileCont()returns the percentile of the given value over a group, with a percentile from 0.0 to 1.0. It uses a linear interpolation method, calculating a weighted average between two values if the desired percentile lies between them.
percentileDisc()returns the percentile of the given value over a group, with a percentile from 0.0 to 1.0. It uses a rounding method and calculates the nearest value to the percentile.
stDev()returns the standard deviation for the given value over a group. It uses a standard two-pass method, with N-1 as the denominator.
stDevP()returns the standard deviation for the given value over a group. It uses a standard two-pass method, with N as the denominator.
sum()returns the sum of a set of numeric values/ Durations.

List Functions

keys()returns a list containing the string representations for all the property names of a node, relationship, or map.
labels()returns a list containing the string representations for all the labels of a node.
nodes()returns a list containing all the nodes in a path.
range()returns a list comprising all integer values within a range bounded by a start value start and end value end, where the difference step between any two consecutive values is constant.
reduce()returns the value resulting from the application of an expression on each successive element in a list in conjunction with the result of the computation thus far.
relationships()returns a list containing all the relationships in a path.
reverse()returns a list in which the order of all elements in the original list have been reversed.
tail()returns a list containing all the elements, excluding the first one, from a list.

Numeric Functions

abs()returns the absolute value of the given number.
ceil()returns the smallest floating point number that is greater than or equal to the given number and equal to a mathematical integer.
floor()returns the largest floating point number that is less than or equal to the given number and equal to a mathematical integer.
rand()returns a random floating point number in the range from 0 (inclusive) to 1 (exclusive).
round()returns the value of the given number rounded to the nearest integer.
sign()returns the signum of the given number: 0 if the number is 0, -1 for any negative number, and 1 for any positive number.

Logarithmic Functions

e() returns the base of the natural logarithm, e.
exp()returns e^n, where e is the base of the natural logarithm, and n is the value of the argument expression.
log()returns the natural logarithm of a number.
log10()returns the common logarithm (base 10) of a number.
sqrt()returns the square root of a number.

Trigonometric Functions

acos() returns the arccosine of a number in radians.
asin()returns the arcsine of a number in radians.
atan()returns the arctangent of a number in radians.
atan2()returns the arctangent2 of a set of coordinates in radians.
cos()returns the cosine of a number.
cot()returns the cotangent of a number.
degrees()converts radians to degrees.
haversin()returns half the versine of a number.
pi()returns the mathematical constant pi.
radians()converts degrees to radians.
sin()returns the sine of a number.
tan()returns the tangent of a number.

String Functions

left()returns a string containing the specified number of leftmost characters of the original string.
lTrim()returns the original string with leading whitespace removed.
replace()returns a string in which all occurrences of a specified string in the original string have been replaced by another string.
reverse()returns a string in which the order of all characters in the original string have been reversed.
right()returns a string containing the specified number of rightmost characters of the original string.
rTrim()returns the original string with trailing whitespace removed.
split()returns a list of strings resulting from the splitting of the original string around matches of the given delimiter.
substring()returns a substring of the original string, beginning with a 0-based index start and length.
toLower()returns the original string in lowercase.
toString()converts an integer, float or boolean value to a string.
toUpper()returns the original string in uppercase.
trim()returns the original string with leading and trailing whitespace removed.