Skip to content

SQL function reference

Functions are in schema warren. Signatures below preserve the SQL argument names, types, defaults, overloads, and return types. Named arguments use argument := value. Graph access and ownership checks still apply; see access rules.

An anyelement or anyarray argument uses the graph’s external id type. Cast ids explicitly, such as 1::bigint. Where an id_type argument supplies a type witness, use a typed null such as NULL::bigint. See id types and type witnesses.

The server is authoritative for the software you have installed. In psql, list its functions with:

\df+ warren.*

Check the installed software version with SELECT warren.version();. Function results that name graph versions refer to immutable graph builds, rather than the extension’s software version. Catalog trigger and event-trigger helpers are excluded because they cannot be called as ordinary functions.

Define a graph from SQL queries and manage its lifetime. Read the guide.

warren."create_graph"(
"name" TEXT,
"node_query" TEXT,
"edge_query" TEXT,
"directed" bool DEFAULT true,
"weighted" bool DEFAULT false,
"has_relations" bool DEFAULT false,
"build_reverse" bool DEFAULT true,
"retain_versions" INT DEFAULT 2,
"store_merged" bool DEFAULT true,
"node_order" TEXT DEFAULT 'id'
)
RETURNS void;
warren."drop_graph"(
"name" TEXT
)
RETURNS void;
warren."info"(
"name" TEXT
)
RETURNS jsonb;

Build, stage, promote, compare, and compact immutable graph versions. Read the guide.

warren."refresh"(
"name" TEXT,
"promote" bool DEFAULT true,
"label" TEXT DEFAULT NULL
)
RETURNS bigint;
warren."promote"(
"name" TEXT,
"version" bigint
)
RETURNS void;
warren."drop_version"(
"name" TEXT,
"version" bigint
)
RETURNS void;
warren."compact"(
"name" TEXT,
"node_order" TEXT DEFAULT NULL
)
RETURNS bigint;
warren."diff"(
"name" TEXT,
"v1" bigint,
"v2" bigint
)
RETURNS jsonb;

Lookups, breadth-first search, reachability, paths, components, and typed walk steps. Read the guide.

warren.bfs(
graph text,
start anyarray,
max_depth int,
direction text DEFAULT 'out',
rels text[] DEFAULT NULL,
node_filter "any" DEFAULT NULL,
max_results bigint DEFAULT NULL,
version bigint DEFAULT NULL
)
RETURNS TABLE (node_id anyelement, depth int, via anyelement);
warren.neighbours(
graph text,
node anyelement,
direction text DEFAULT 'out',
rels text[] DEFAULT NULL,
version bigint DEFAULT NULL
)
RETURNS SETOF anyelement;
warren.degree(
graph text,
node anyelement,
direction text DEFAULT 'out',
rels text[] DEFAULT NULL,
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS bigint;
warren.has_edge(
graph text,
src anyelement,
dst anyelement,
rel text DEFAULT NULL,
version bigint DEFAULT NULL
)
RETURNS boolean;
warren.reachable(
graph text,
start anyelement,
target anyelement,
max_depth int DEFAULT NULL,
rels text[] DEFAULT NULL,
direction text DEFAULT 'out',
version bigint DEFAULT NULL
)
RETURNS boolean;
warren.reachable_set(
graph text,
start anyarray,
max_depth int DEFAULT NULL,
rels text[] DEFAULT NULL,
direction text DEFAULT 'out',
version bigint DEFAULT NULL
)
RETURNS SETOF anyelement;
warren.shortest_path(
graph text,
start anyelement,
target anyelement,
max_depth int DEFAULT NULL,
rels text[] DEFAULT NULL,
direction text DEFAULT 'out',
version bigint DEFAULT NULL
)
RETURNS anyarray;
warren.dijkstra(
graph text,
start anyelement,
target anyelement,
rels text[] DEFAULT NULL,
direction text DEFAULT 'out',
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS TABLE (path anyarray, cost float8);
warren.components(
graph text,
id_type anyelement,
version bigint DEFAULT NULL
)
RETURNS TABLE (node_id anyelement, component_id bigint);
warren.walk(
graph text,
start anyarray,
steps warren.step[],
mode text DEFAULT 'ends',
distinct_ends boolean DEFAULT true,
max_results bigint DEFAULT NULL,
reverse boolean DEFAULT false,
version bigint DEFAULT NULL
)
RETURNS TABLE (end_id anyelement, path anyarray, rels text[], count bigint);
warren.s(
rels text[],
direction text DEFAULT 'out',
filter "any" DEFAULT NULL,
min_hops int DEFAULT 1,
max_hops int DEFAULT NULL
)
RETURNS warren.step;
warren.steps(
steps jsonb
)
RETURNS warren.step[];
warren."last_stats"()
RETURNS jsonb;

Construct, inspect, and remove named per-node vectors and matrices. Read the guide.

warren."vector_from_query"(
"graph" TEXT,
"name" TEXT,
"query" TEXT,
"dtype" TEXT DEFAULT 'f64',
"fill" double precision DEFAULT 0,
"persist" bool DEFAULT true,
"version" bigint DEFAULT NULL
)
RETURNS bigint;
warren."vector_const"(
"graph" TEXT,
"name" TEXT,
"value" double precision,
"dtype" TEXT DEFAULT 'f64',
"persist" bool DEFAULT true,
"version" bigint DEFAULT NULL
)
RETURNS bigint;
warren.vector_degree(
graph text,
name text,
direction text DEFAULT 'out',
rels text[] DEFAULT NULL,
dtype text DEFAULT 'f64',
persist boolean DEFAULT true,
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS bigint;
warren."vector_dense_id"(
"graph" TEXT,
"name" TEXT,
"dtype" TEXT DEFAULT 'i64',
"persist" bool DEFAULT true,
"version" bigint DEFAULT NULL
)
RETURNS bigint;
warren.vector_values(
graph text,
name text,
id_type anyelement,
version bigint DEFAULT NULL
)
RETURNS TABLE (node_id anyelement, value float8);
warren.matrix_rows(
graph text,
name text,
id_type anyelement,
version bigint DEFAULT NULL
)
RETURNS TABLE (node_id anyelement, "row" float8[]);
warren.vector_topk(
graph text,
name text,
k int,
id_type anyelement,
descending bool DEFAULT true,
version bigint DEFAULT NULL
)
RETURNS TABLE (node_id anyelement, value float8);
warren."vector_stats"(
"graph" TEXT,
"name" TEXT,
"version" bigint DEFAULT NULL
)
RETURNS jsonb;
warren.id_map(
graph text,
id_type anyelement,
version bigint DEFAULT NULL
)
RETURNS TABLE (node_id anyelement, dense_id bigint, live boolean);
warren."drop_vector"(
"graph" TEXT,
"name" TEXT,
"version" bigint DEFAULT NULL,
"if_exists" bool DEFAULT false
)
RETURNS void;

Semiring products, SQL expressions, reductions, and SQL-typed messages. Read the guide.

warren.spmv(
graph text,
x text,
y text,
semiring text DEFAULT 'plus_times',
transpose boolean DEFAULT false,
rels text[] DEFAULT NULL,
weighted boolean DEFAULT NULL,
mask text DEFAULT NULL,
mask_complement boolean DEFAULT false,
replace boolean DEFAULT false,
accumulate text DEFAULT NULL,
persist boolean DEFAULT true,
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS void;
warren.spmm(
graph text,
x text,
y text,
semiring text DEFAULT 'plus_times',
transpose boolean DEFAULT false,
rels text[] DEFAULT NULL,
weighted boolean DEFAULT NULL,
mask text DEFAULT NULL,
mask_complement boolean DEFAULT false,
replace boolean DEFAULT false,
accumulate text DEFAULT NULL,
persist boolean DEFAULT true,
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS void;
warren."vector_map"(
"graph" TEXT,
"y" TEXT,
"expr" TEXT,
"persist" bool DEFAULT true,
"version" bigint DEFAULT NULL
)
RETURNS void;
warren."explain_map"(
"graph" TEXT,
"expr" TEXT,
"version" bigint DEFAULT NULL
)
RETURNS jsonb;
warren."vector_reduce"(
"graph" TEXT,
"x" TEXT,
"op" TEXT,
"version" bigint DEFAULT NULL
)
RETURNS double precision;
warren."vector_norm_diff"(
"graph" TEXT,
"a" TEXT,
"b" TEXT,
"norm" TEXT DEFAULT 'l2',
"a_version" bigint DEFAULT NULL,
"b_version" bigint DEFAULT NULL
)
RETURNS double precision;
warren.gather(
graph text,
messages text,
id_type anyelement,
value_type anycompatible,
combine text DEFAULT 'collect',
direction text DEFAULT 'in',
rels text[] DEFAULT NULL,
mask text DEFAULT NULL,
mask_complement boolean DEFAULT false,
version bigint DEFAULT NULL,
include_self boolean DEFAULT false,
per_relation boolean DEFAULT false
)
RETURNS TABLE (node_id anyelement, value anycompatible);

Graph algorithms built over the same versions and compute primitives. Read the guide.

warren.pagerank(
graph text,
"out" text,
damping float8 DEFAULT 0.85,
tol float8 DEFAULT 1e-6,
max_iter int DEFAULT 100,
seed text DEFAULT NULL,
rels text[] DEFAULT NULL,
weighted boolean DEFAULT NULL,
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS int;
warren.eigenvector_centrality(
graph text,
"out" text,
tol float8 DEFAULT 1e-6,
max_iter int DEFAULT 100,
rels text[] DEFAULT NULL,
weighted boolean DEFAULT NULL,
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS int;
warren.katz_centrality(
graph text,
"out" text,
alpha float8 DEFAULT 0.1,
beta float8 DEFAULT 1.0,
seed text DEFAULT NULL,
normalized boolean DEFAULT true,
tol float8 DEFAULT 1e-6,
max_iter int DEFAULT 1000,
rels text[] DEFAULT NULL,
weighted boolean DEFAULT NULL,
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS int;
warren.hits(
graph text,
hubs text,
authorities text,
tol float8 DEFAULT 1e-8,
max_iter int DEFAULT 100,
normalized boolean DEFAULT true,
rels text[] DEFAULT NULL,
weighted boolean DEFAULT NULL,
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS int;
warren.components_vector(
graph text,
"out" text,
rels text[] DEFAULT NULL,
version bigint DEFAULT NULL
)
RETURNS int;
warren.label_propagation(
graph text,
"out" text,
seed text DEFAULT NULL,
max_iter int DEFAULT 100,
mask text DEFAULT NULL,
rels text[] DEFAULT NULL,
version bigint DEFAULT NULL
)
RETURNS int;
warren.label_propagation_majority(
graph text,
"out" text,
seed text DEFAULT NULL,
max_iter int DEFAULT 100,
rels text[] DEFAULT NULL,
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS int;
warren.sssp_vector(
graph text,
"out" text,
source anyelement,
rels text[] DEFAULT NULL,
weighted boolean DEFAULT NULL,
max_iter int DEFAULT NULL,
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS int;
warren.degree_vector(
graph text,
"out" text,
direction text DEFAULT 'out',
rels text[] DEFAULT NULL,
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS bigint;
warren.aggregate_neighbours(
graph text,
x text,
"out" text,
agg text DEFAULT 'mean',
hops int DEFAULT 1,
rels text[] DEFAULT NULL,
direction text DEFAULT 'out',
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS void;
warren."triangles"(
"graph" TEXT,
"out" TEXT,
"rels" TEXT[] DEFAULT NULL,
"persist" bool DEFAULT true,
"version" bigint DEFAULT NULL
)
RETURNS bigint;
warren.clustering(
graph text,
"out" text,
rels text[] DEFAULT NULL,
version bigint DEFAULT NULL
)
RETURNS void;
warren."core_number"(
"graph" TEXT,
"out" TEXT,
"rels" TEXT[] DEFAULT NULL,
"persist" bool DEFAULT true,
"version" bigint DEFAULT NULL
)
RETURNS bigint;
warren."strong_components_vector"(
"graph" TEXT,
"out" TEXT,
"rels" TEXT[] DEFAULT NULL,
"persist" bool DEFAULT true,
"version" bigint DEFAULT NULL
)
RETURNS bigint;
warren."topological_order"(
"graph" TEXT,
"out" TEXT,
"rels" TEXT[] DEFAULT NULL,
"persist" bool DEFAULT true,
"version" bigint DEFAULT NULL
)
RETURNS bigint;
warren.dag_longest_path(
graph text,
"out" text,
rels text[] DEFAULT NULL,
weighted boolean DEFAULT NULL,
persist boolean DEFAULT true,
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS double precision;
warren.minimum_spanning_forest(
graph text,
id_type anyelement,
rels text[] DEFAULT NULL,
weighted bool DEFAULT NULL,
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS TABLE (source anyelement, target anyelement, weight float8);
warren.betweenness_centrality(
graph text,
"out" text,
k bigint DEFAULT NULL,
seed bigint DEFAULT 0,
normalized boolean DEFAULT true,
endpoints boolean DEFAULT false,
directed boolean DEFAULT true,
sources text DEFAULT NULL,
rels text[] DEFAULT NULL,
weighted boolean DEFAULT NULL,
persist boolean DEFAULT true,
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS bigint;
warren.closeness_centrality(
graph text,
"out" text,
k bigint DEFAULT NULL,
seed bigint DEFAULT 0,
wf_improved boolean DEFAULT true,
directed boolean DEFAULT true,
sources text DEFAULT NULL,
rels text[] DEFAULT NULL,
weighted boolean DEFAULT NULL,
persist boolean DEFAULT true,
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS bigint;
warren.harmonic_centrality(
graph text,
"out" text,
k bigint DEFAULT NULL,
seed bigint DEFAULT 0,
directed boolean DEFAULT true,
sources text DEFAULT NULL,
rels text[] DEFAULT NULL,
weighted boolean DEFAULT NULL,
persist boolean DEFAULT true,
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS bigint;
warren.similarity(
graph text,
pairs text,
id_type anyelement,
measure text DEFAULT 'jaccard',
rels text[] DEFAULT NULL,
version bigint DEFAULT NULL
)
RETURNS TABLE (source anyelement, target anyelement, score float8);
warren.most_similar(
graph text,
node anyelement,
k bigint DEFAULT 10,
measure text DEFAULT 'jaccard',
rels text[] DEFAULT NULL,
version bigint DEFAULT NULL
)
RETURNS TABLE (node_id anyelement, score float8);
warren.similar_pairs(
graph text,
id_type anyelement,
k bigint DEFAULT 10,
measure text DEFAULT 'jaccard',
nodes text DEFAULT NULL,
rels text[] DEFAULT NULL,
version bigint DEFAULT NULL
)
RETURNS TABLE (source anyelement, target anyelement, score float8);

Eigenpairs and structural, spectral, or embedding distances between graphs or versions. Read the guide.

warren.eigen(
graph text,
k integer,
matrix text DEFAULT 'adjacency',
which text DEFAULT 'largest',
rels text[] DEFAULT NULL,
weighted boolean DEFAULT NULL,
symmetrize boolean DEFAULT true,
tol double precision DEFAULT 1e-6,
max_iter integer DEFAULT NULL,
vectors_prefix text DEFAULT NULL,
version bigint DEFAULT NULL,
dtype text DEFAULT 'f32',
persist boolean DEFAULT true,
per_relation boolean DEFAULT false
)
RETURNS TABLE (i integer, eigenvalue double precision, residual double precision);
warren.distance(
graph text,
v1 bigint,
v2 bigint,
method text,
vectors_prefix text DEFAULT NULL,
k integer DEFAULT NULL,
x text DEFAULT NULL,
y text DEFAULT NULL,
compared_rows text DEFAULT 'shared',
matrix text DEFAULT NULL,
which text DEFAULT 'largest',
rels text[] DEFAULT NULL,
weighted boolean DEFAULT NULL,
symmetrize boolean DEFAULT true,
tol double precision DEFAULT 1e-6,
max_iter integer DEFAULT NULL,
dtype text DEFAULT 'f32',
graph2 text DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS jsonb;

Community detection, contraction, projection, and lifting between levels. Read the guide.

warren.contract(
graph text,
label_vector text,
out_graph text,
weighted boolean DEFAULT true,
drop_self_loops boolean DEFAULT false,
promote boolean DEFAULT true,
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS bigint;
warren."project"(
"graph" TEXT,
"x" TEXT,
"out_graph" TEXT,
"y" TEXT,
"agg" TEXT DEFAULT 'sum',
"persist" bool DEFAULT true,
"version" bigint DEFAULT NULL
)
RETURNS void;
warren."lift"(
"out_graph" TEXT,
"y" TEXT,
"graph" TEXT,
"x" TEXT,
"persist" bool DEFAULT true,
"version" bigint DEFAULT NULL
)
RETURNS void;
warren.modularity(
graph text,
labels text,
resolution double precision DEFAULT 1.0,
weighted boolean DEFAULT NULL,
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS double precision;
warren.local_moving(
graph text,
"out" text,
initial text DEFAULT NULL,
keys text DEFAULT NULL,
resolution double precision DEFAULT 1.0,
seed bigint DEFAULT 0,
max_sweeps integer DEFAULT 100,
tolerance double precision DEFAULT 1e-7,
weighted boolean DEFAULT NULL,
persist boolean DEFAULT true,
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS bigint;
warren.leiden_refine(
graph text,
communities text,
"out" text,
keys text DEFAULT NULL,
resolution double precision DEFAULT 1.0,
seed bigint DEFAULT 0,
randomness double precision DEFAULT 0.01,
weighted boolean DEFAULT NULL,
persist boolean DEFAULT true,
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS bigint;
warren.louvain(
graph text,
"out" text,
resolution float8 DEFAULT 1.0,
seed bigint DEFAULT 0,
max_levels int DEFAULT 100,
tolerance float8 DEFAULT 1e-7,
weighted boolean DEFAULT NULL,
levels_prefix text DEFAULT NULL,
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS float8;
warren.leiden(
graph text,
"out" text,
resolution double precision DEFAULT 1.0,
seed bigint DEFAULT 0,
max_levels integer DEFAULT 100,
tolerance double precision DEFAULT 1e-7,
randomness double precision DEFAULT 0.01,
iterations integer DEFAULT 2,
weighted boolean DEFAULT NULL,
levels_prefix text DEFAULT NULL,
version bigint DEFAULT NULL,
per_relation boolean DEFAULT false
)
RETURNS double precision;

Graph access, graph and vector ownership, quotas, and cleanup after role removal. Read the guide.

warren."grant"(
name text,
role regrole
)
RETURNS void;
warren."revoke"(
name text,
role regrole
)
RETURNS void;
warren."set_owner"(
name text,
owner regrole
)
RETURNS void;
warren."set_vector_quota"(
name text,
bytes bigint,
role regrole DEFAULT NULL
)
RETURNS void;
warren."vector_usage"(
name text
)
RETURNS TABLE (role regrole, vectors bigint, bytes bigint, quota bigint);
warren."reassign_owned"(
"old" regrole,
"new" regrole
)
RETURNS bigint;
warren."drop_owned"(
role regrole
)
RETURNS bigint;
warren."orphans"()
RETURNS TABLE ("kind" TEXT, "graph" TEXT, "role" oid);
warren."drop_orphans"()
RETURNS bigint;

Load and evict versions, inspect cache state, and observe running work. Read the guide.

warren."prewarm"(
"name" TEXT,
"version" bigint DEFAULT NULL
)
RETURNS bigint;
warren."evict"(
"name" TEXT
)
RETURNS bigint;
warren."cache"()
RETURNS TABLE ("kind" TEXT, "graph" TEXT, "version" bigint, "vector" TEXT, "vector_id" bigint, "bytes" bigint, "state" TEXT, "last_use" bigint, "cap" bigint);
warren."shared_cache"()
RETURNS TABLE ("kind" TEXT, "graph" TEXT, "version" bigint, "vector" TEXT, "vector_id" bigint, "state" TEXT, "bytes" bigint, "pins" INT, "mappers" INT, "last_use" bigint, "cap" bigint);
warren."backends"()
RETURNS TABLE ("kind" text, "pid" int, "database" oid, "role" regrole, "private_bytes" bigint, "transient_bytes" bigint, "mapped_bytes" bigint, "lookups" bigint, "private_hits" bigint, "shared_hits" bigint, "waits" bigint, "private_loads" bigint, "shared_loads" bigint, "loaded_bytes" bigint, "load_seconds" float8, "private_evictions" bigint, "shared_evictions" bigint, "refusals" jsonb, "since" timestamptz);
warren."progress"()
RETURNS TABLE ("pid" int, "database" oid, "role" regrole, "command" text, "graph" text, "version" bigint, "phase" text, "done" bigint, "total" bigint, "operation" text, "operation_phase" text, "operation_done" bigint, "operation_total" bigint, "detail" jsonb, "command_start" timestamptz, "operation_start" timestamptz);
warren."report_progress"(
"command" TEXT,
"graph" TEXT,
"phase" TEXT,
"done" bigint DEFAULT NULL,
"total" bigint DEFAULT NULL
)
RETURNS void;

Inspect the installed extension software version. Read the guide.

warren."version"()
RETURNS TEXT;