pgr_dmmsy
pgr_dmmsy · DMMSY deterministic directed single-source shortest path algorithm for pgRouting
Overview
PostgreSQL · 14, 15, 16
| Relationships | |
|---|---|
| Requires | pgrouting |
Usage
Sources:
- Pinned upstream README
- Version 0.1.0 SQL API
- Pinned PostgreSQL C wrapper
- Pinned algorithm implementation
- Pinned parameter tests
pgr_dmmsy version 0.1.0 implements a directed or undirected non-negative single-source shortest-path function with a pgRouting-style edge query. It requires PostgreSQL 14 or newer and pgRouting 3.x. The function currently works as a point-to-point path query; the documented all-destinations form is not implemented correctly.
Point-to-point path
The edge SQL must return id BIGINT, source BIGINT, target BIGINT, and cost FLOAT8 in exactly that order:
NULL edge fields and negative costs raise errors. directed false adds a reverse edge for each input row. An unknown or unreachable target returns no rows.
Current implementation boundaries
The README says a NULL target returns a distance map for all reachable vertices, but the C wrapper constructs output only when target is non-NULL and non-negative. The pinned regression test explicitly expects NULL target to return an empty set. Always provide a concrete target until the wrapper has a tested all-destinations output path.
output_predecessors and constant_degree are accepted but unused by the current source. max_levels can stop phase processing before the target is settled and then return no path. The repository’s implementation notes and current algorithm comments also disagree about whether this is a simplified Dijkstra-based implementation or the advertised asymptotic DMMSY algorithm. Treat the complexity claim as unverified and benchmark correctness and performance against pgr_dijkstra on your graphs.
The wrapper reads the complete edge query into backend memory before computing. It checks only cost less than zero, so callers should reject NaN and infinity explicitly. Arbitrary edges_sql executes with caller privileges; allow only trusted SQL templates, qualify every object, and do not concatenate user input.
The project is active but version 0.1.0, has no declared license, and CI covers only a subset of supported majors. Validate equal-cost ties, parallel edges, self-loops, zero weights, huge or sparse vertex IDs, disconnected graphs, cancellation, memory pressure, directed false, every tuning parameter, and comparison with a trusted implementation before production use.