Reference
APOC Functions
53 built-in functions across 9 modules. These are available out of the box — no plugins required.
Bitwise Operations
apoc.bitwise — 3 functions
| Function | Description |
|---|---|
| bitwise_op(a: i64, op: &str, b: i64) -> Result<i64, String> | Apply a bitwise operation. `op` is one of: AND, OR, XOR, NOT, SHIFT_LEFT, SHIFT_RIGHT. |
| binary_to_int(s: &str) -> Result<i64, String> | Parse a binary string (e.g., "10110") to an integer. |
| int_to_binary(n: i64) -> String | Convert an integer to a binary string representation. |
Collections
apoc.collections — 8 functions
| Function | Description |
|---|---|
| flatten(list: &PluginValue) -> PluginValue | Flatten nested lists into a single list. |
| zip(a: &[PluginValue], b: &[PluginValue]) -> Vec<PluginValue> | Zip two lists into a list of pairs. |
| partition(list: &[PluginValue], size: usize) -> Vec<PluginValue> | Split a list into chunks of `size`. |
| frequencies(list: &[PluginValue]) -> HashMap<String, i64> | Count occurrences of each element (by Display representation). |
| subtract(a: &[PluginValue], b: &[PluginValue]) -> Vec<PluginValue> | Set difference: elements in a but not in b. |
| intersection(a: &[PluginValue], b: &[PluginValue]) -> Vec<PluginValue> | Set intersection: elements in both a and b. |
| union(a: &[PluginValue], b: &[PluginValue]) -> Vec<PluginValue> | Set union (deduplicated by Display). |
| pairs(list: &[PluginValue]) -> Vec<PluginValue> | Consecutive pairs: [a,b,c] → [[a,b],[b,c]]. |
Conversion
apoc.convert — 6 functions
| Function | Description |
|---|---|
| to_json(value: &PluginValue) -> String | Serialize a PluginValue to a JSON string. |
| from_json(s: &str) -> Result<PluginValue, String> | Parse a JSON string to a PluginValue. Handles objects, arrays, strings, numbers, booleans, and null. |
| to_base64(s: &str) -> String | Base64 encode a string. |
| from_base64(s: &str) -> Result<String, String> | Base64 decode a string. |
| to_hex(bytes: &[u8]) -> String | Hex encode bytes. |
| from_hex(s: &str) -> Result<Vec<u8>, String> | Hex decode a string to bytes. |
Date & Time
apoc.date — 5 functions
| Function | Description |
|---|---|
| parse(s: &str, format: &str) -> Result<i64, String> | Parse a date string in a given format. Supports: "epoch", "iso". |
| format_epoch(epoch_secs: i64, format: &str) -> String | Format an epoch timestamp to a string. |
| add(epoch_secs: i64, amount: i64, unit: &str) -> Result<i64, String> | Add a duration to an epoch timestamp. |
| diff(epoch1: i64, epoch2: i64, unit: &str) -> Result<i64, String> | Difference between two epoch timestamps in the specified unit. |
| epoch_to_fields(epoch_secs: i64) -> HashMap<String, i64> | Extract date/time fields from an epoch timestamp. |
Import / Export
apoc.import_export — 6 functions
| Function | Description |
|---|---|
| export_json_all(graph: &dyn Graph) -> String | Export all nodes and relationships to a JSON string. |
| export_csv_all(graph: &dyn Graph) -> (String, String) | Export all nodes and relationships to CSV strings. Returns (nodes_csv, relationships_csv). |
| import_json_nodes(graph: &mut dyn Graph, json: &str) -> Result<usize, String> | Import nodes from a simple JSON format into the graph. Expected: [{"labels": [1], "properties": {"1": "value"}}, ...] |
| import_csv_nodes(graph: &mut dyn Graph, csv: &str) -> Result<usize, String> | Import nodes from CSV. First line is header. |
| load_json_url(_url: &str) -> Result<String, String> | Stub: load JSON from a URL. Returns the raw string. |
| load_csv_url(_url: &str) -> Result<String, String> | Stub: load CSV from a URL. |
Math
apoc.math — 7 functions
| Function | Description |
|---|---|
| sigmoid(x: f64) -> f64 | Logistic sigmoid: 1 / (1 + e^(-x)). |
| tanh(x: f64) -> f64 | Hyperbolic tangent. |
| clamp(x: f64, min: f64, max: f64) -> f64 | Clamp x to [min, max]. |
| lerp(a: f64, b: f64, t: f64) -> f64 | Linear interpolation: a + t * (b - a). |
| mean(values: &[f64]) -> Option<f64> | Arithmetic mean of a list. |
| median(values: &[f64]) -> Option<f64> | Median value. |
| variance(values: &[f64]) -> Option<f64> | Population variance. |
Graph Refactoring
apoc.refactor — 6 functions
| Function | Description |
|---|---|
| merge_nodes( | Merge multiple nodes into one, combining properties and relationships. Returns the ID of the surviving node (first in the list). |
| clone_nodes(graph: &mut dyn Graph, node_ids: &[NodeId]) -> Vec<NodeId> | Clone nodes with their properties. Returns new node IDs. |
| clone_subgraph( | Clone a subgraph (nodes + relationships). Returns (new_node_ids, new_rel_ids). |
| rename_label(graph: &mut dyn Graph, old_label: LabelId, new_label: LabelId) -> usize | Rename a label across all nodes. |
| rename_rel_type( | Rename a relationship type. Since rel type is immutable, this deletes and recreates each relationship with the new type. |
| rename_property( | Rename a property key across all nodes. |
Spatial / Geospatial
apoc.spatial — 5 functions
| Function | Description |
|---|---|
| distance(lat1: f64, lon1: f64, lat2: f64, lon2: f64) -> f64 | Haversine distance between two lat/lon points, in meters. |
| within_distance( | Check if a point is within `distance_meters` of a center point. |
| sort_by_distance(points: &mut [(f64, f64, u64)], center_lat: f64, center_lon: f64) | Sort a list of (lat, lon, id) by distance from a center point. |
| geocode(_address: &str) -> Option<(f64, f64)> | Geocode stub — returns None (real implementation would call an external API). |
| bounding_box(lat: f64, lon: f64, distance_meters: f64) -> (f64, f64, f64, f64) | Compute a bounding box around a center point at a given distance. Returns (min_lat, min_lon, max_lat, max_lon). |
Text & Similarity
apoc.text — 7 functions
| Function | Description |
|---|---|
| levenshtein_distance(a: &str, b: &str) -> usize | Levenshtein edit distance between two strings. |
| jaro_winkler_distance(a: &str, b: &str) -> f64 | Jaro-Winkler similarity (0.0 to 1.0). |
| sorensen_dice_similarity(a: &str, b: &str) -> f64 | Sorensen-Dice coefficient based on character bigrams. |
| camel_case(s: &str) -> String | Convert to camelCase. |
| snake_case(s: &str) -> String | Convert to snake_case. |
| slugify(s: &str) -> String | Convert to a URL-safe slug. |
| regex_groups(s: &str, pattern: &str) -> Result<Vec<Vec<String>>, String> | Extract regex capture groups from a string. |