Skip to content

Deprecate pgr_analyzeGraph #2819

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 4, 2025

Conversation

cvvergara
Copy link
Member

@cvvergara cvvergara commented Apr 4, 2025

Fixes #2753

Changes proposed in this pull request:

  • SQL: mark function as deprecated
  • doc:
    • Migration: add migration suggestions
  • docqueries:
    • Update results adding message that is shown

@pgRouting/admins

Summary by CodeRabbit

  • New Features

    • Enhanced release notes now include links to closed issues and pull requests.
    • Expanded analytical capabilities improve graph analysis and troubleshooting.
  • Documentation

    • Updated guides and structured sections provide clearer navigation and improved migration instructions.
    • New markers enhance the readability of topics like graph connectivity and dead-end analysis.
  • Deprecations

    • The pgr_analyzeGraph function is now deprecated, with warning messages added to facilitate user transition.

- SQL: mark function as deprecated
- doc:
  - Migration: add migration suggestions
- docqueries:
  - Update results adding message that is shown
@cvvergara cvvergara added this to the Release 3.8.0 milestone Apr 4, 2025
@cvvergara cvvergara self-assigned this Apr 4, 2025
Copy link
Contributor

coderabbitai bot commented Apr 4, 2025

Walkthrough

The changes update the pgRouting 3.8.0 documentation and SQL scripts. In the release files, functions have been promoted or deprecated (with pgr_analyzeGraph marked deprecated) and links to GitHub issues and pull requests added. Documentation sections now include new directive markers to structure content on dead ends and disconnected graphs. A detailed migration guide for pgr_analyzeGraph has been introduced. Additionally, new SQL analysis queries have been added across several files, and deprecation warnings for pgr_analyzeGraph have been incorporated throughout.

Changes

File(s) Change Summary
NEWS.md, doc/src/release_notes.rst Added links to GitHub issues/PRs; promoted functions (pgr_extractVertices, pgr_degree with a revised signature, pgr_findCloseEdges with the partial option removed); marked pgr_analyzeGraph as deprecated and introduced a deprecation rubric.
doc/metrics/pgr_degree.rst, doc/src/pgRouting-concepts.rst Introduced new directive markers (.. finding_dead_ends_start/end, .. disconnected_graph_start/end) to clearly delineate sections on dead ends and disconnected graphs.
doc/src/migration.rst, doc/topology/pgr_analyzeGraph.rst Added a detailed migration guide for pgr_analyzeGraph; updated documentation to reflect changes from counting graph features to identifying structural components; included migration directives referencing external migration content.
docqueries/src/migration.pg, docqueries/src/migration.result Introduced five new SQL queries enhancing graph analysis by using functions such as pgr_connectedComponents, pgr_degree, and pgr_findCloseEdges, as well as geometry-based comparisons.
docqueries/topology/analyzeGraph.result, docqueries/topology/nodeNetwork.result, sql/topology/analyzegraph.sql Added deprecation warnings for the pgr_analyzegraph function across SQL queries; updated runtime warning messages and function comments to indicate deprecation (v3.8.0).

Sequence Diagram(s)

sequenceDiagram
    participant U as User/Developer
    participant A as pgr_analyzeGraph
    participant W as Warning System
    participant M as Migration Guide

    U->>A: Call pgr_analyzeGraph
    A->>W: Emit deprecation warning (v3.8.0)
    W-->>U: Return warning message
    U->>M: Consult migration guide
    M-->>U: Recommend using pgr_connectedComponents, etc.
Loading
sequenceDiagram
    participant Q as Query Executor
    participant C as pgr_connectedComponents
    participant D as pgr_degree
    participant F as pgr_findCloseEdges

    Q->>C: Execute components analysis (analysis1)
    Q->>D: Run degree check for dead ends (analysis2)
    Q->>F: Find close edges for identified dead ends (analysis3)
Loading

Poem

I’m a bunny in a codey glen,
Hopping through docs again and again.
New markers mark my path so bright,
Warnings whisper in the moonlit night.
SQL queries dance with joyful art,
Celebrating changes from my little heart! 🐇


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 9c892b5 and 4e29043.

📒 Files selected for processing (2)
  • locale/en/LC_MESSAGES/pgrouting_doc_strings.po (7 hunks)
  • locale/pot/pgrouting_doc_strings.pot (7 hunks)

Note

🎁 Summarized by CodeRabbit Free

Your organization has reached its limit of developer seats under the Pro Plan. For new users, CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please add seats to your subscription by visiting https://app.coderabbit.ai/login.If you believe this is a mistake and have available seats, please assign one to the pull request author through the subscription management page using the link above.

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@cvvergara cvvergara requested a review from robe2 April 4, 2025 13:38
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fc7dc91 and be9e3e4.

📒 Files selected for processing (13)
  • NEWS.md (1 hunks)
  • doc/metrics/pgr_degree.rst (2 hunks)
  • doc/src/migration.rst (2 hunks)
  • doc/src/pgRouting-concepts.rst (2 hunks)
  • doc/src/release_notes.rst (1 hunks)
  • doc/topology/pgr_analyzeGraph.rst (1 hunks)
  • docqueries/src/migration.pg (1 hunks)
  • docqueries/src/migration.result (1 hunks)
  • docqueries/topology/analyzeGraph.result (24 hunks)
  • docqueries/topology/nodeNetwork.result (5 hunks)
  • locale/en/LC_MESSAGES/pgrouting_doc_strings.po (7 hunks)
  • locale/pot/pgrouting_doc_strings.pot (7 hunks)
  • sql/topology/analyzegraph.sql (2 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: cvvergara
PR: pgRouting/pgrouting#2744
File: doc/src/release_notes.rst:94-94
Timestamp: 2025-04-03T01:13:53.213Z
Learning: In pgRouting, changes to functions can happen at two levels:
1. SQL level - removal/addition of function signatures
2. C/C++ level - deprecation/changes to the underlying implementation
These are documented separately in the release notes.
Learnt from: cvvergara
PR: pgRouting/pgrouting#2771
File: doc/topology/pgr_degree.rst:28-35
Timestamp: 2025-04-03T01:13:53.213Z
Learning: In the pgRouting documentation, historical version notes should be retained to show the evolution of functions across different versions.
NEWS.md (1)
Learnt from: cvvergara
PR: pgRouting/pgrouting#2744
File: NEWS.md:63-63
Timestamp: 2025-04-03T01:13:53.213Z
Learning: In pgRouting's NEWS.md, the "Removal of SQL deprecated internal functions" section lists SQL signatures being removed, while "Deprecation of internal C/C++ functions" section lists the underlying C/C++ implementations being deprecated. A function can appear in both sections when its SQL signature is removed while its C/C++ implementation is deprecated.
doc/src/release_notes.rst (1)
Learnt from: cvvergara
PR: pgRouting/pgrouting#2744
File: doc/src/release_notes.rst:94-94
Timestamp: 2025-04-03T01:13:53.213Z
Learning: In pgRouting, changes to functions can happen at two levels:
1. SQL level - removal/addition of function signatures
2. C/C++ level - deprecation/changes to the underlying implementation
These are documented separately in the release notes.
locale/pot/pgrouting_doc_strings.pot (3)

undefined

<retrieved_learning>
Learnt from: cvvergara
PR: #2771
File: doc/topology/pgr_extractVertices.rst:28-35
Timestamp: 2025-04-03T01:13:53.213Z
Learning: In pgRouting documentation, historical version entries should be maintained in reverse chronological order (newest first) to provide context about the evolution of functions over time.
</retrieved_learning>

<retrieved_learning>
Learnt from: cvvergara
PR: #2744
File: NEWS.md:63-63
Timestamp: 2025-04-03T01:13:53.213Z
Learning: In pgRouting's NEWS.md, the "Removal of SQL deprecated internal functions" section lists SQL signatures being removed, while "Deprecation of internal C/C++ functions" section lists the underlying C/C++ implementations being deprecated. A function can appear in both sections when its SQL signature is removed while its C/C++ implementation is deprecated.
</retrieved_learning>

<retrieved_learning>
Learnt from: cvvergara
PR: #2744
File: doc/src/release_notes.rst:94-94
Timestamp: 2025-04-03T01:13:53.213Z
Learning: In pgRouting, changes to functions can happen at two levels:

  1. SQL level - removal/addition of function signatures
  2. C/C++ level - deprecation/changes to the underlying implementation
    These are documented separately in the release notes.
    </retrieved_learning>
locale/en/LC_MESSAGES/pgrouting_doc_strings.po (1)

undefined

<retrieved_learning>
Learnt from: cvvergara
PR: #2744
File: NEWS.md:63-63
Timestamp: 2025-04-03T01:13:53.213Z
Learning: In pgRouting's NEWS.md, the "Removal of SQL deprecated internal functions" section lists SQL signatures being removed, while "Deprecation of internal C/C++ functions" section lists the underlying C/C++ implementations being deprecated. A function can appear in both sections when its SQL signature is removed while its C/C++ implementation is deprecated.
</retrieved_learning>

🪛 markdownlint-cli2 (0.17.2)
NEWS.md

12-12: Spaces inside link text
null

(MD039, no-space-in-links)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (25)
locale/en/LC_MESSAGES/pgrouting_doc_strings.po (9)

11-11: Date updated correctly.

The POT-Creation-Date has been updated to reflect the current date.


3924-3929: Good addition of milestone link.

The link to the closed milestone for 3.8.0 is helpful for users to track all issues and pull requests included in this release.


3934-3936: Documentation updated for promoted function.

The promotion of pgr_extractVertices to an official function is properly documented with a reference to its issue number.


3945-3945: Function promotion correctly documented.

Clear documentation of the promotion of pgr_degree to official status with proper issue reference.


3951-3953: Function promotion correctly documented.

The promotion of pgr_findCloseEdges and removal of the partial option is properly documented.


4045-4168: Comprehensive migration guidance provided.

The added migration section for pgr_analyzeGraph is thorough and helpful. It:

  1. Explains what the function calculated before deprecation
  2. Provides clear definitions for graph components
  3. Offers specific alternative approaches for each feature
  4. Lists appropriate replacement functions with links
  5. Includes references to PostGIS functions for geometric operations

This is excellent practice when deprecating functionality as it gives users a clear path forward.


7876-7880: Proper deprecation marking.

The function has been appropriately marked as deprecated with the version number (3.8.0) clearly indicated.


15917-15918: Documentation change noted correctly.

The changes to the documentation for pgr_degree are properly listed.


16311-16312: Documentation updated for promoted function.

The pgr_extractVertices function is properly added to what appears to be a list of documented functions.

doc/src/pgRouting-concepts.rst (1)

740-751: Well-structured documentation enhancement with directives

The addition of the disconnected graph directives (disconnected_graph_start and disconnected_graph_end) improves the documentation structure by clearly marking this section for reference from other documentation.

This change enhances organization and will make it easier to maintain cross-references, especially for the migration guidance from the deprecated pgr_analyzeGraph function.

doc/metrics/pgr_degree.rst (1)

351-364: Good documentation restructuring with clear section markers

The addition of the finding_dead_ends_start and finding_dead_ends_end directives provides clear section boundaries for important functionality documentation. This section effectively explains how to identify dead ends in a graph using the newly promoted pgr_degree function, which is a key replacement for functionality in the deprecated pgr_analyzeGraph.

This change helps users understand the migration path and makes the documentation more modular and maintainable.

docqueries/src/migration.pg (1)

381-390: Good examples for migration from deprecated functionality

These SQL examples clearly demonstrate how to perform graph analysis using the newer functions:

  1. Using pgr_connectedComponents to analyze graph connectivity
  2. Using pgr_degree to identify dead ends (vertices with degree = 1)

These examples provide excellent practical guidance for users migrating away from the deprecated pgr_analyzeGraph function.

doc/topology/pgr_analyzeGraph.rst (2)

23-26: Clear deprecation notice with appropriate version information

The addition of the Version 3.8.0 entry with explicit "Deprecated function" statement clearly communicates the status change of this function to users.

This follows good practice for deprecating functionality by marking it in the specific version where deprecation occurs.


31-33: Properly structured migration guidance

The inclusion of migration documentation via the migration.rst file provides users with a clear path forward. The specific markers (migrate_pgr_analyzeGraph_start and migrate_pgr_analyzeGraph_end) ensure that only the relevant portion of the migration guidance is included.

This approach helps users understand how to transition away from the deprecated function while maintaining backward compatibility for existing code.

locale/pot/pgrouting_doc_strings.pot (5)

11-11: Timestamp update looks good.

This is a standard update to the POT creation date timestamp to reflect the most recent generation of this template file.


3523-3525: Documentation additions for promoted functions are appropriate.

The addition of the Git milestone link and the documentation for promoting pgr_extractVertices to an official function (referencing issue #2772) is clear and follows the expected format for release notes.

Also applies to: 3529-3529


3619-3732: Comprehensive migration guidance provided.

The migration guidance for pgr_analyzeGraph is thorough and well-structured:

  1. It clearly explains what the deprecated function calculated
  2. Provides definitions of relevant graph concepts
  3. Offers detailed alternative approaches for each aspect of the original function's functionality
  4. Suggests specific functions to use as replacements

This follows good practice for deprecating functions by giving users clear paths forward.


6865-6870: Appropriate version tagging and deprecation notice.

Adding the version number (3.8.0) and explicitly marking the function as deprecated provides clear information to users about when this change occurred and the current status of the function.

This aligns with the learned practice of maintaining historical version notes to show function evolution over time.


13360-13361: Documentation reference updates are consistent.

The addition of pgr_degree and pgr_extractVertices to the list of functions with documentation changes is consistent with their promotion to official status mentioned earlier in the file.

Also applies to: 13675-13676

sql/topology/analyzegraph.sql (1)

138-139: Appropriately added deprecation warning.

The warning message is correctly implemented and will alert users that the function is deprecated while still allowing them to use it in this version. This is a good approach for a smooth transition.

docqueries/topology/nodeNetwork.result (3)

22-24: Test results correctly updated with deprecation warning.

The test results now appropriately include the deprecation warning message that will be displayed to users when running the function. This ensures documentation accurately reflects actual behavior.


114-116: Consistent application of deprecation warnings.

The deprecation warning is consistently applied across all instances of the function call in the test results, which is important for ensuring users are properly informed regardless of how they use the function.


167-169: Complete coverage of deprecation warnings.

All variants of function calls now properly display the deprecation warning, ensuring comprehensive coverage across different usage patterns (with different parameters and WHERE clauses).

Also applies to: 190-192, 213-215

doc/src/migration.rst (1)

27-98: Well-structured documentation on pgr_analyzeGraph migration.

The migration guide provides comprehensive instructions for transitioning from the deprecated pgr_analyzeGraph function. The documentation clearly explains the previous functionality, defines key terms, and provides appropriate alternative approaches using more modern functions.

I especially appreciate:

  • The organization into logical sections (Components, Dead ends, etc.)
  • Clear examples with references to query implementations
  • Helpful links to PostGIS functions for geometric and topological operations
docqueries/src/migration.result (1)

1244-1284: Good SQL examples demonstrating migration alternatives.

These example queries effectively demonstrate the recommended alternatives for pgr_analyzeGraph functionality:

  • Using pgr_connectedComponents to identify graph components (replacing isolated segments counting)
  • Using pgr_degree with filtering to find nodes with degree 1 (dead ends)

The query results clearly show the output format users should expect when implementing these alternative approaches.

@cvvergara cvvergara force-pushed the deprecate-analyzeGraph branch from be9e3e4 to 118857c Compare April 4, 2025 14:04
@cvvergara cvvergara marked this pull request as draft April 4, 2025 14:09
@cvvergara cvvergara force-pushed the deprecate-analyzeGraph branch from 1c66da7 to 9c892b5 Compare April 4, 2025 16:08
@cvvergara cvvergara marked this pull request as ready for review April 4, 2025 16:09
@cvvergara cvvergara merged commit 109ffa8 into pgRouting:main Apr 4, 2025
2 checks passed
@cvvergara cvvergara deleted the deprecate-analyzeGraph branch April 4, 2025 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate pgr_analyzeGraph in 3.8
2 participants