Queries
Select a query type below to view its template and description.
T2.1 Node Filtering (Single Node Paths)
Generic Intent: Find nodes of a specific label that satisfy some predicates.
This query filters nodes by label and one or more node-property predicates. It represents a single-node path and measures predicate evaluation and node index lookup performance without edge traversal.
GQL Template:
MATCH (n:<NodeLabel>) WHERE n.<property1> = $value1 AND n.<property2> >= $value2 RETURN n LIMIT $limit;
Parameters:
- Node label: target label for candidate nodes
- Predicates: equality, range, or combined property filters
- Selectivity: high-selectivity vs low-selectivity predicates
- Limit size: small / large / no limit
T2.2 Edge Filtering
Generic Intent: Find edges that satisfy some predicates, optionally returning their endpoint nodes.
This query filters relationships by edge properties. It measures edge-property predicate evaluation and relationship scan or index lookup performance without requiring multi-hop traversal.
GQL Template:
MATCH (src)-[r:<EdgeType>]-(dst) WHERE r.<property> = $value RETURN src, r, dst LIMIT $limit;
Parameters:
- Edge type: optional relationship type filter
- Predicates: equality, range, or combined edge-property filters
- Selectivity: high-selectivity vs low-selectivity predicates
- Direction: outgoing / incoming / undirected
- Limit size: small / large / no limit
T2.3 Reachability between Two Nodes
Generic Intent: Determine whether a target node is reachable from a source node within k hops, returning true once the first matching path is found.
This query tests variable-length path traversal performance, path pruning capabilities of the engine, and the efficiency of short-circuiting once reachability is established.
Undirected Edge GQL Template:
MATCH p = ANY (s:<NodeLabel1> {<idProp>: $sourceId}) -[:<EdgeType>]-{1,<k>} (t:<NodeLabel2> {<idProp>: $targetId}) RETURN true AS reachable;
Outgoing Edge GQL Template:
MATCH p = ANY (s:<NodeLabel1> {<idProp>: $sourceId}) -[:<EdgeType>]->{1,<k>} (t:<NodeLabel2> {<idProp>: $targetId}) RETURN true AS reachable;
Incoming Edge GQL Template:
MATCH p = ANY (s:<NodeLabel1> {<idProp>: $sourceId}) <-[:<EdgeType>]-{1,<k>} (t:<NodeLabel2> {<idProp>: $targetId}) RETURN true AS reachable;
Parameters:
- Reachability: reachable vs unreachable pairs
- Distance: near vs far pairs
- Depth bound (k): 2, 3, 4, 5, 6
- Start node (degree): low / medium / high (measures fanout scaling)
- Direction: outgoing / incoming / undirected
- Limit size: small / large / no limit
T2.4 Shortest Path
Generic Intent: Find the shortest path connecting a source node and a target node.
This query measures the performance of shortest-path algorithm execution (such as BFS or Dijkstra), depth bounding, and active path pruning on the graph topology.
Undirected Edge GQL Template:
MATCH p = SHORTEST (s:<NodeLabel1> {<idProp>: $sourceId}) -[:<EdgeType>]-{1,$maxDepth} (t:<NodeLabel2> {<idProp>: $targetId}) RETURN p;
Note: Undirected matching allows edges to be traversed in either direction along a path,
regardless of their storage direction. For example, in a graph containing
a -> b <- c <- d, an undirected path search will successfully match and
return the path between a and d as long as it remains acyclic
(distinct nodes).
Outgoing Edge GQL Template:
MATCH p = SHORTEST (s:<NodeLabel1> {<idProp>: $sourceId}) -[:<EdgeType>]->{1,$maxDepth} (t:<NodeLabel2> {<idProp>: $targetId}) RETURN p;
Incoming Edge GQL Template:
MATCH p = SHORTEST (s:<NodeLabel1> {<idProp>: $sourceId}) <-[:<EdgeType>]-{1,$maxDepth} (t:<NodeLabel2> {<idProp>: $targetId}) RETURN p;
Parameters:
- Distance: source-target distance (controls BFS search space depth)
- Depth bound (maxDepth): controls maximum allowable search depth
- Start node (degree): low / medium / high (measures fanout scaling)
- Direction: outgoing / incoming / undirected
- Limit size: small / large / no limit
T2.5 All Simple Paths up to Length k
Generic Intent: Enumerate all simple paths (paths without repeated nodes) between two nodes up to a maximum depth k.
Unlike reachability or shortest path queries which short-circuit or prune paths early, this query materializes every valid simple path. It is highly resource-intensive and measures duplicate node/edge detection overhead during path enumeration.
Undirected Edge GQL Template:
MATCH p = ACYCLIC (s:<NodeLabel1> {<idProp>: $sourceId}) -[:<EdgeType>]-{1,<k>} (t:<NodeLabel2> {<idProp>: $targetId}) RETURN p LIMIT $limit;
Note: Undirected matching allows edges to be traversed in either direction along a path,
regardless of their storage direction. For example, in a graph containing
a -> b <- c <- d, an undirected path search will successfully match and
return the path between a and d as long as it remains acyclic
(distinct nodes).
Outgoing Edge GQL Template:
MATCH p = ACYCLIC (s:<NodeLabel1> {<idProp>: $sourceId}) -[:<EdgeType>]->{1,<k>} (t:<NodeLabel2> {<idProp>: $targetId}) RETURN p LIMIT $limit;
Incoming Edge GQL Template:
MATCH p = ACYCLIC (s:<NodeLabel1> {<idProp>: $sourceId}) <-[:<EdgeType>]-{1,<k>} (t:<NodeLabel2> {<idProp>: $targetId}) RETURN p LIMIT $limit;
Parameters:
- Depth bound (k): controls maximum depth bound
- Path limit (limit): bounds the number of materialized paths
- Start node (degree): low / medium / high (measures fanout scaling)
- Direction: outgoing / incoming / undirected
- Limit size: small / large / no limit
T2.6 top-K Weighted Paths (Optional)
Note: This query only makes sense if the edges in the dataset are weighted; for graphs like social network graphs, this might not apply.
Generic Intent: Find low-cost or high-score paths between two nodes up to a bounded depth, returning the top-K sorted by path cost or score.
This query measures how efficiently the engine aggregates edge weights along paths and sorts them by cumulative cost. It evaluates top-K path sorting, weight aggregation, and priority-queue operations.
Undirected Edge GQL Template:
MATCH p = (s:<NodeLabel> {<idProp>: $sourceId}) -[edges:<EdgeType>]-{1,<k>} (t:<NodeLabel> {<idProp>: $targetId}) RETURN p, reduce(total = 0, e IN relationships(p) | total + e.<weightProp>) AS pathCost ORDER BY pathCost ASC LIMIT $topK;
Outgoing Edge GQL Template:
MATCH p = (s:<NodeLabel> {<idProp>: $sourceId}) -[edges:<EdgeType>]->{1,<k>} (t:<NodeLabel> {<idProp>: $targetId}) RETURN p, reduce(total = 0, e IN relationships(p) | total + e.<weightProp>) AS pathCost ORDER BY pathCost ASC LIMIT $topK;
Incoming Edge GQL Template:
MATCH p = (s:<NodeLabel> {<idProp>: $sourceId}) <-[edges:<EdgeType>]-{1,<k>} (t:<NodeLabel> {<idProp>: $targetId}) RETURN p, reduce(total = 0, e IN relationships(p) | total + e.<weightProp>) AS pathCost ORDER BY pathCost ASC LIMIT $topK;
Parameters:
- top-K (K): return limit size for sorted paths
- Depth bound (k): controls maximum depth bound
- Start node (degree): low / medium / high (measures fanout scaling)
- Direction: outgoing / incoming / undirected
- Limit size: small / large / no limit