- Predicate functions
- Scalar functions
- Aggregating functions
- List functions
- Mathematical operators
- Mathematical functions
- Trigonometric functions
- String functions
- Point functions
- Type conversion functions
- Node functions
- Path functions
- Vector functions
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:arraycan be any expression that produces an array: a literal, a property reference, or a function call.WHERE conditionis 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 elemis 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.
name property of every node with a rank property greater than 10:
Existential comprehension functions
The functionsany(), all(), single() and none() use a simplified form of the list comprehension syntax and return a boolean value.
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 aPerson node and a list of all their friends’ ages:
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 firstWHEN 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:
CASE keyword. Instead, each WHEN statement specifies its own expression:
Reduce
Thereduce() 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
Theintern() function expects a single string argument:
Point
Thepoint() function expects one map argument of the form:
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:
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

allShortestPaths
AllallShortestPaths 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
(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:
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.
- 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.priorityEnsures that priority never decreases along the route.RETURN pReturns valid paths where shipments maintain or increase priority.
Frequently Asked Questions
What categories of functions does FalkorDB support?
What categories of functions does FalkorDB support?
FalkorDB supports predicate, scalar, aggregating, list, mathematical, trigonometric, string, point, type conversion, node, path, and vector functions.
How do I check if a property exists on a node?
How do I check if a property exists on a node?
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.How do I convert data types in Cypher?
How do I convert data types in Cypher?
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.What is the collect() function?
What is the collect() function?
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.Does FalkorDB support vector operations?
Does FalkorDB support vector operations?
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.