Skip to main content
This section contains information on all supported functions from the Cypher query language.

Predicate functions

Scalar functions

* FalkorDB-specific extensions to Cypher

Aggregating functions

List functions

* FalkorDB-specific extensions to Cypher

Mathematical operators

Mathematical functions

* FalkorDB-specific extensions to Cypher ** FalkorDB-specific behavior: to avoid possible loss of precision, when expr evaluates to an integer - the result is an integer as well *** FalkorDB-specific behavior: tie-breaking method is “half away from zero”

Trigonometric functions

String functions

Point functions

Type conversion functions

* FalkorDB-specific behavior: rounding method when converting a floating point to an integer is “toward negative infinity (floor)“

Node functions

* FalkorDB-specific extensions to Cypher

Path functions

* FalkorDB-specific extensions to Cypher

Vector functions

List comprehensions

List comprehensions are a syntactical construct that accepts an array and produces another based on the provided map and filter directives. They are a common construct in functional languages and modern high-level languages. In Cypher, they use the syntax:
  • array can be any expression that produces an array: a literal, a property reference, or a function call.
  • WHERE condition is an optional argument to only project elements that pass a certain criteria. If omitted, all elements in the array will be represented in the output.
  • | output elem is an optional argument that allows elements to be transformed in the output array. If omitted, the output elements will be the same as their corresponding inputs.
The following query collects all paths of any length, then for each produces an array containing the name property of every node with a rank property greater than 10:

Existential comprehension functions

The functions any(), all(), single() and none() use a simplified form of the list comprehension syntax and return a boolean value.
They can operate on any form of input array, but are particularly useful for path filtering. The following query collects all paths of any length in which all traversed edges have a weight less than 3:

Pattern comprehensions

Pattern comprehensions are a method of producing a list composed of values found by performing the traversal of a given graph pattern. The following query returns the name of a Person node and a list of all their friends’ ages:
Optionally, a WHERE clause may be embedded in the pattern comprehension to filter results. In this query, all friends’ ages will be gathered for friendships that started before 2010:

CASE WHEN

The case statement comes in two variants. Both accept an input argument and evaluates it against one or more expressions. The first WHEN argument that specifies a value matching the result will be accepted, and the value specified by the corresponding THEN keyword will be returned. Optionally, an ELSE argument may also be specified to indicate what to do if none of the WHEN arguments match successfully. In its simple form, there is only one expression to evaluate and it immediately follows the CASE keyword:
In its generic form, no expression follows the CASE keyword. Instead, each WHEN statement specifies its own expression:

Reduce

The reduce() function accepts a starting value and updates it by evaluating an expression against each element of the list:
sum will successively have the values 0, 1, 3, and 6, with 6 being the output of the function call.

Intern

The intern() function expects a single string argument:
This function deduplicates the input string by storing a single internal copy across the database. It is especially useful for repeated string values—like country names, email domains, or tags—in large graphs. Interned strings can be stored as node or relationship properties, and behave identically to regular strings in queries, with the added benefit of reduced memory usage.

Point

The point() function expects one map argument of the form:
The key names latitude and longitude are case-sensitive. The point constructed by this function can be saved as a node/relationship property or used within the query, such as in a distance function call.

About Path Functions

The following graph: Road network represents a road network with 7 cities (A, B, C, and so on) and 11 one-way roads. Each road has a distance (say, in kilometers) and trip time (say, in minutes).

shortestPath

shortestPath returns one of the shortest paths. If there is more than one, only one is retrieved. The sole shortestPath argument is a traversal pattern. This pattern’s endpoints must be resolved prior to the function call, and no property filters may be introduced in the pattern. The relationship pattern may specify any number of relationship types (including zero) to be considered. If a minimum number of edges to traverse is specified, it may only be 0 or 1, while any number may be used for the maximum. If 0 is specified as the minimum, the source node will be included in the returned path. If no shortest path can be found, NULL is returned. Example Usage: Find the shortest path (by number of roads) from A to G
Road network

allShortestPaths

All allShortestPaths results have, by definition, the same length (number of roads). Examples Usage: Find all the shortest paths (by number of roads) from A to G
Using the unbounded traversal pattern (a:City{name:'A'})-[*]->(g:City{name:'G'}), FalkorDB traverses all possible paths from A to G. ORDER BY length(p) LIMIT 5 ensures that you collect only [up to 5 shortest paths (minimal number of relationships). This approach is very inefficient because all possible paths would have to be traversed. Ideally, you would want to abort some traversals as soon as you are sure they would not result in the discovery of shorter paths.

JSON format

toJSON() returns the input value in JSON formatting. For primitive data types and arrays, this conversion is conventional. Maps and map projections (toJSON(node { .prop} )) are converted to JSON objects, as are nodes and relationships. The format for a node object in JSON is:
The format for a relationship object in JSON is:

Variable length traverse filtering

Consider a logistics network where:
  • Nodes (Warehouse) represent distribution centers.
  • Edges (Shipment) represent routes where packages are shipped.
  • Each shipment has an increasing priority level.
Imagine a package tracking system where deliveries follow a priority-based routing:
  • Each shipment (Shipment) has a priority value (s.priority).
  • We want to ensure that package priority never decreases as it moves through the network.
  • The query filters paths where the previous shipment (prev(s.priority)) has a lower or equal priority than the current one (s.priority).
  • MATCH p=(:Warehouse)-[s:Shipment]->(:Warehouse) Finds shipment paths between warehouses.
  • WHERE coalesce(prev(s.priority)) <= s.priority Ensures that priority never decreases along the route.
  • RETURN p Returns valid paths where shipments maintain or increase priority.

Frequently Asked Questions

FalkorDB supports predicate, scalar, aggregating, list, mathematical, trigonometric, string, point, type conversion, node, path, and vector functions.
Use the exists() predicate function: WHERE exists(n.email). Note that graph pattern existence checks like exists((n)-[]->()) are not supported — use pattern predicates in WHERE instead.
Use type conversion functions like toInteger(), toFloat(), toString(), and toBoolean(). These are especially useful when importing data from CSV where all values start as strings.
The collect() aggregation function gathers values into a list. It is the inverse of UNWIND and is useful for grouping related values: RETURN person.city, collect(person.name) AS residents.
Yes. FalkorDB provides vecf32() for creating 32-bit float vectors and vecf64() for 64-bit float vectors. These are used with vector indexes for similarity search operations.