Skip to content

SQL graph algorithms (shortestPath, dijkstra, bellmanFord, astar): adopt FunctionOptions for trailing options #3881

@lvca

Description

@lvca

Motivation

Follow-up to #3879 (vector.neighbors options map) and #3880 (fulltext.* options map). The four SQL graph path-finding functions have inconsistent option handling:

  • shortestPath(src, dest [, direction [, edgeType [, {maxDepth, edge}]]]) - mixed positional + map, map only covers two knobs.
  • dijkstra(src, dest, weight [, direction]) - single positional, primed for growth (edgeTypeNames, maxDepth, etc.).
  • bellmanFord(src, dest, weight [, direction]) - same as dijkstra, plus a foreseeable detectNegativeCycles flag.
  • astar(src, dest, weight [, {options}]) - already fully map-driven, but uses hand-rolled parsing that silently ignores unknown keys.

Proposal

  • Route all four through com.arcadedb.function.sql.FunctionOptions so unknown keys throw a descriptive error and type coercion is consistent with vector.neighbors and fulltext.*.
  • Let shortestPath, dijkstra, bellmanFord accept an options map that consolidates direction, edgeTypeNames, maxDepth, emptyIfMaxDepth, and (for shortestPath) edge. Existing positional forms stay for backward compatibility.
  • astar keeps the same surface but swaps its bespoke parser for FunctionOptions, keeping the same accepted keys (direction, edgeTypeNames, vertexAxisNames, parallel, maxDepth, emptyIfMaxDepth, tieBreaker, dFactor, heuristicFormula, customHeuristicFormula).

Non-goals

  • No grammar changes.
  • No renames: these functions already use camelCase under the convention.

Deliverables

  • Code: refactor the four functions through FunctionOptions.
  • Tests: options-map form + unknown-key rejection.
  • Docs: show options-map syntax alongside positional for each function.

Metadata

Metadata

Assignees

Labels

No labels
No labels
No fields configured for Feature.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions