Skip to content

Removing use of pgr_analyzeGraph on the documentation #2822

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

Conversation

cvvergara
Copy link
Member

@cvvergara cvvergara commented Apr 5, 2025

Fixes #2820 .

Changes proposed in this pull request:

  • Remove the use of pgr_analyzeGraph in the documentation.
  • Remove references to the pgr_analyzeGraph documentation

@pgRouting/admins

Summary by CodeRabbit

  • Documentation

    • Revised and reorganized user guides for network topology analysis for improved clarity by removing outdated references and streamlining instructions.
    • Updated documentation entries for pgr_analyzeOneWay and pgr_createTopology to focus on relevant functions and removed references to pgr_analyzeGraph.
  • Refactor

    • Updated the guidance for SQL queries used in analyzing network connectivity, enhancing details on detecting intersections, gaps, and dead ends.
    • Enhanced SQL logic for managing edge relationships and network topology.
  • Chore

    • Simplified the documentation build process by eliminating obsolete image configuration steps for a cleaner experience.

@cvvergara cvvergara added this to the Release 3.8.0 milestone Apr 5, 2025
@cvvergara cvvergara requested a review from robe2 April 5, 2025 01:17
@cvvergara cvvergara self-assigned this Apr 5, 2025
Copy link
Contributor

coderabbitai bot commented Apr 5, 2025

Walkthrough

The changes update several documentation, configuration, and SQL files. In the JavaScript history file, a new version (3.8) is appended for the pgr_analyzeOneWay entry. The CMake configuration files no longer include the images directory, with the images script entirely removed. Multiple documentation files have been revised to remove references to the outdated pgr_analyzeGraph function and to reorganize sections for clarity in network topology analysis. Additionally, the SQL scripts have been reworked to replace deprecated functions with enhanced geometric and connectivity logic using CTEs and an intersections table.

Changes

File(s) Change Summary
doc/_static/page_history.js Appended version 3.8 to the pgr_analyzeOneWay entry, updating the method signature without altering the existing structure.
doc/topology/CMakeLists.txt
doc/topology/images/CMakeLists.txt
Removed the inclusion of the "images" subdirectory and the setting of image file variables; the images CMake file was deleted.
doc/topology/pgr_analyzeOneWay.rst
doc/topology/pgr_createTopology.rst
doc/topology/pgr_createVerticesTable.rst
doc/topology/pgr_nodeNetwork.rst
Updated documentation by removing references to pgr_analyzeGraph, refining field descriptions, and restructuring sections (e.g., splitting network analysis into intersections and gaps).
docqueries/topology/nodeNetwork.pg
docqueries/topology/nodeNetwork.result
Modified SQL queries by replacing deprecated functions with new logic based on geometric intersections, introducing CTEs and an intersections table, and refining edge-vertex connectivity updates.
locale/en/LC_MESSAGES/pgrouting_doc_strings.po Deprecated pgr_analyzeGraph function; introduced pgr_nodeNetwork and updated method signatures for pgr_createTopology and pgr_analyzeOneWay.
locale/pot/pgrouting_doc_strings.pot Updated POT-Creation-Date to reflect recent changes, focusing on translation infrastructure improvements.

Sequence Diagram(s)

sequenceDiagram
    participant Query as SQL Script
    participant Intersect as Intersections Table
    participant Vertices as Vertices Table
    participant Edges as Edges Table

    Query->>Intersect: Compute intersections using ST_Intersection
    Query->>Vertices: Filter vertices with CTE (e.g., vertices with single connection)
    Query->>Query: Call pgr_nodeNetwork with intersection filter
    Query->>Edges: Update edges (set source/target using geometrical data)
    Query->>Edges: Insert new edges with computed costs (using new CTE for fractions)
    Query->>Edges: Delete edges identified in intersections
Loading

Poem

I'm Bunny, hopping through the code all day,
New version numbers and clean docs lead my way.
Images and old calls have hopped out of sight,
SQL intersections sparkle in the morning light.
Fields of topology now dance in a brand-new tune,
With every query, I cheer under the moon!
Hoppy code to all, let’s keep the bugs at bay!


📜 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 ead4e2a and 1edf8a1.

📒 Files selected for processing (2)
  • locale/en/LC_MESSAGES/pgrouting_doc_strings.po (4 hunks)
  • locale/pot/pgrouting_doc_strings.pot (4 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.

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: 8

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 109ffa8 and 93f53fe.

⛔ Files ignored due to path filters (2)
  • doc/topology/images/after_node_net.png is excluded by !**/*.png
  • doc/topology/images/before_node_net.png is excluded by !**/*.png
📒 Files selected for processing (11)
  • doc/_static/page_history.js (1 hunks)
  • doc/topology/CMakeLists.txt (0 hunks)
  • doc/topology/images/CMakeLists.txt (0 hunks)
  • doc/topology/pgr_analyzeOneWay.rst (1 hunks)
  • doc/topology/pgr_createTopology.rst (1 hunks)
  • doc/topology/pgr_createVerticesTable.rst (1 hunks)
  • doc/topology/pgr_nodeNetwork.rst (1 hunks)
  • docqueries/topology/nodeNetwork.pg (1 hunks)
  • docqueries/topology/nodeNetwork.result (1 hunks)
  • locale/en/LC_MESSAGES/pgrouting_doc_strings.po (4 hunks)
  • locale/pot/pgrouting_doc_strings.pot (4 hunks)
💤 Files with no reviewable changes (2)
  • doc/topology/images/CMakeLists.txt
  • doc/topology/CMakeLists.txt
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Check queries
🔇 Additional comments (20)
locale/en/LC_MESSAGES/pgrouting_doc_strings.po (4)

11-11: Timestamp update looks good.

This is a routine update to the POT-Creation-Date timestamp, reflecting when the translation template was generated.


9998-9999: Text properly updated to reference only analyzeOneWay.

Good job removing references to the deprecated pgr_analyzeGraph function and correctly updating the documentation to focus on pgr_analyzeOneWay as the relevant function for the vertices table requirement.


13404-13459: Appropriate replacement of analyzeGraph with topology analysis instructions.

The new content effectively replaces the deprecated pgr_analyzeGraph functionality with more specific instructions on how to:

  • Analyze the network for intersections and gaps
  • Fix topology issues like intersections and gaps
  • Update source and target information
  • Manage the vertex topology

This change aligns well with the PR objective of removing pgr_analyzeGraph while still providing users with the necessary guidance for topology analysis.


18039-18041: Section header addition looks good.

Adding the "Images" section header improves the documentation structure by properly categorizing the visual content that follows.

locale/pot/pgrouting_doc_strings.pot (5)

11-11: LGTM: POT file creation date updated.

The POT-Creation-Date has been properly updated to reflect when the template was regenerated.


8584-8584: LGTM: Successfully removed pgr_analyzeGraph reference.

The text has been appropriately updated to only mention that the vertices table is a requirement for the pgr_analyzeOneWay functions, removing the reference to the deprecated pgr_analyzeGraph function.


11386-11389: LGTM: New replacement content for topology analysis.

These new instructions for analyzing networks for intersections and gaps provide appropriate alternatives to the deprecated pgr_analyzeGraph function.


11431-11431: LGTM: Updated See Also section.

The "See Also" section has been properly updated to reference related topology functions without mentioning the deprecated pgr_analyzeGraph.


15118-15120: LGTM: Added Images section header.

The addition of an "Images" header improves the documentation organization.

doc/_static/page_history.js (1)

226-228: Version parameter added for pgr_analyzeOneWay.

The modification adds version 3.8 as the removal date parameter for the pgr_analyzeOneWay function entry in the file history. This correctly aligns with the PR objective of removing pgr_analyzeGraph from documentation.

doc/topology/pgr_analyzeOneWay.rst (1)

124-125: Documentation cleanup: References to pgr_analyzeGraph removed.

The descriptions for the cnt and chk fields have been appropriately simplified to remove references to the deprecated pgr_analyzeGraph function while maintaining the essential information about each field's purpose.

doc/topology/pgr_createVerticesTable.rst (2)

94-95: Documentation update: Dependency reference removed.

The vertices table requirements section has been correctly updated to remove references to the deprecated pgr_analyzeGraph function, leaving only pgr_analyzeOneWay as the function requiring this table.


100-102: Field descriptions simplified.

The descriptions for the cnt and chk fields have been appropriately updated to remove references to the deprecated pgr_analyzeGraph function while preserving their functional descriptions.

doc/topology/pgr_createTopology.rst (2)

107-108: Documentation update: Function dependency removed.

The vertices table requirements section has been correctly updated to remove references to the deprecated pgr_analyzeGraph function, now indicating that the vertices table is only a requirement for pgr_analyzeOneWay.


114-115: Field descriptions simplified.

The descriptions for the cnt and chk fields have been appropriately updated to remove references to the deprecated pgr_analyzeGraph function while maintaining their essential descriptions.

docqueries/topology/nodeNetwork.pg (3)

18-19: Verify potential SQL injection risk.

The query dynamically builds 'SELECT id, geom FROM edges WHERE id != ' || inhere. If inhere is not guaranteed to be numeric or sanitized, this could lead to SQL injection.

Please confirm that inhere is always an integer or properly escaped. If uncertain, sanitize or cast it explicitly.


31-32: Check input validation for rows_where.

SELECT pgr_nodeNetwork('edges', 0.001, the_geom => 'geom', rows_where=>'id in ('||id1||','||id2||')')

Same concern as above: ensure id1 and id2 come from trusted sources and cannot introduce injection.


76-94: Ensure cost calculation handles 0 or negative costs safely.

When splitting edges based on fractions, cost and reverse_cost calculations may become zero or negative if not carefully handled. For real-world data, consider validating that final segment lengths and costs remain non-negative.

docqueries/topology/nodeNetwork.result (2)

6-12: Output verification.

The intersection result shows one row: id1=13, id2=18, point=POINT(3.5 3). This matches the earlier queries in nodeNetwork.pg. The data appears consistent and correct based on the geometry. No concerns here.


129-129: Confirm zero rows scenario.

(0 rows)

This indicates no more intersections found. Ensure that the test environment truly has no additional crossing edges beyond the identified subset. This is expected, but you may want to confirm for real-world data with more edges.

@cvvergara cvvergara force-pushed the issue-2820-Remove-use-of-pgr_analyzeGraph branch from 93f53fe to ead4e2a Compare April 5, 2025 01:28
@cvvergara cvvergara merged commit 3354577 into pgRouting:main Apr 5, 2025
1 of 2 checks passed
@cvvergara cvvergara deleted the issue-2820-Remove-use-of-pgr_analyzeGraph branch April 5, 2025 01:30
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.

Remove use of pgr_analyzeGraph
2 participants