Skip to content

Improvement: add "prev" column to pgr_dijkstraVia result set #3111

Open

Description

@claudiadragoste

Problem

Currently, pgr_dijkstraVia returns the following fields:

seq | path_id | path_seq | start_vid | end_vid | node | edge | cost | agg_cost | route_agg_cost

However, unlike other pgRouting functions such as pgr_drivingDistance, it does not expose predecessor information.

Improvement

Add prev column to the result set of pgr_dijkstraVia.
Proposed output:

seq | path_id | path_seq | start_vid | end_vid | prev | node | edge | cost | agg_cost | route_agg_cost

Where: prev = previous node
Alternatives

Activity

  1. AdityaRanaX commented on Sep 17, 2026

    @AdityaRanaX

    Hi, I'd like to take a shot at this if it's still open.

    I looked into how pgRouting has handled similar column additions in the past to figure out the right approach here. pgr_dijkstraVia is currently listed as Proposed, not Official, and I found precedent for direct signature changes on functions at that stage rather than new overloads — pgr_dijkstra had columns added directly to its existing signatures while stabilizing (e.g. start_vid/end_vid added to the One-to-Many and Many-to-One variants), and pgRouting 3.7 added a pred column directly to pgr_drivingDistance's existing output, documented as a breaking change in the release notes. That looks like the closest precedent to what's being asked here.

    Based on that, I went with adding prev directly to the existing pgr_dijkstraVia signature rather than introducing a new overload, documented as a breaking change in the next release notes.

    For context on where I'm coming from: I've been working through the pgRouting workshop hands-on (built network views from real OSM data, ran pgr_connectedComponents and related functions against it), and I've since cloned and built the main pgrouting repo from source, so I have a working dev environment to test changes against.

    Opened #3149 with this approach — happy to adjust based on feedback.

  2. added 4 commits that reference this issue on Sep 17, 2026
    ac07696
    2a53f8b
    03daf84
    8a942c0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions