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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/_static/page_history.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ var filesArr = [
]),
new createInfo('pgr_analyzeOneWay', '2.0', [
{ v: '2.1', n: 'src/common/doc/functions/analyze_oneway'},
{ v: '2.3', n: 'src/topology/doc/pgr_analyzeOneWay'},
{ v: '2.3', n: 'src/topology/doc/pgr_analyzeOneWay'}, 3.8
]),
new createInfo('pgr_analyzeGraph', '2.0', [
{ v: '2.1', n: 'src/common/doc/functions/analyze_graph'},
Expand Down
4 changes: 0 additions & 4 deletions doc/topology/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,4 @@ foreach (f ${LOCAL_FILES})
list(APPEND LOCAL_DOC_FILES ${PGR_DOCUMENTATION_SOURCE_DIR}/${f})
endforeach()


add_subdirectory("images")
set(PROJECT_DOC_FILES ${PROJECT_DOC_FILES} ${LOCAL_DOC_FILES} PARENT_SCOPE)
set(PROJECT_IMG_FILES ${PROJECT_IMG_FILES} PARENT_SCOPE)

13 changes: 0 additions & 13 deletions doc/topology/images/CMakeLists.txt

This file was deleted.

Binary file removed doc/topology/images/after_node_net.png
Binary file not shown.
Binary file removed doc/topology/images/before_node_net.png
Binary file not shown.
6 changes: 2 additions & 4 deletions doc/topology/pgr_analyzeOneWay.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,8 @@ The structure of the vertices table is:

:id: ``bigint`` Identifier of the vertex.
:cnt: ``integer`` Number of vertices in the edge_table that reference this
vertex. See :doc:`pgr_analyzeGgraph <pgr_analyzeGraph>`.
:chk: ``integer`` Indicator that the vertex might have a problem. See
:doc:`pgr_analyzeGraph <pgr_analyzeGraph>`.
vertex.
:chk: ``integer`` Indicator that the vertex might have a problem.
:ein: ``integer`` Number of vertices in the edge_table that reference this
vertex as incoming.
:eout: ``integer`` Number of vertices in the edge_table that reference this
Expand All @@ -142,7 +141,6 @@ See Also
-------------------------------------------------------------------------------

* :doc:`topology-functions`
* :doc:`pgr_analyzeGraph`
* :doc:`pgr_createVerticesTable`
* :doc:`sampledata`

Expand Down
8 changes: 3 additions & 5 deletions doc/topology/pgr_createTopology.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,15 @@ The function returns:

.. rubric:: The Vertices Table

The vertices table is a requirement of the :doc:`pgr_analyzeGraph` and the
The vertices table is a requirement of the
:doc:`pgr_analyzeOneWay` functions.

The structure of the vertices table is:

:id: ``bigint`` Identifier of the vertex.
:cnt: ``integer`` Number of vertices in the edge_table that reference this
vertex. See :doc:`pgr_analyzeGraph`.
:chk: ``integer`` Indicator that the vertex might have a problem. See
:doc:`pgr_analyzeGraph`.
vertex.
:chk: ``integer`` Indicator that the vertex might have a problem.
:ein: ``integer`` Number of vertices in the edge_table that reference this
vertex AS incoming. See :doc:`pgr_analyzeOneWay`.
:eout: ``integer`` Number of vertices in the edge_table that reference this
Expand Down Expand Up @@ -279,7 +278,6 @@ See Also
* :doc:`sampledata`
* :doc:`topology-functions`
* :doc:`pgr_createVerticesTable`
* :doc:`pgr_analyzeGraph`

.. rubric:: Indices and tables

Expand Down
8 changes: 3 additions & 5 deletions doc/topology/pgr_createVerticesTable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,15 @@ The function returns:

.. rubric:: The Vertices Table

The vertices table is a requirement of the :doc:`pgr_analyzeGraph` and the
The vertices table is a requirement of the
:doc:`pgr_analyzeOneWay` functions.

The structure of the vertices table is:

:id: ``bigint`` Identifier of the vertex.
:cnt: ``integer`` Number of vertices in the edge_table that reference this
vertex. See :doc:`pgr_analyzeGraph`.
:chk: ``integer`` Indicator that the vertex might have a problem. See
:doc:`pgr_analyzeGraph`.
vertex.
:chk: ``integer`` Indicator that the vertex might have a problem.
:ein: ``integer`` Number of vertices in the edge_table that reference this
vertex as incoming. See :doc:`pgr_analyzeOneWay`.
:eout: ``integer`` Number of vertices in the edge_table that reference this
Expand Down Expand Up @@ -284,7 +283,6 @@ See Also
algorithms.
* :doc:`pgr_createTopology` <pgr_create_topology>` to create a topology based on
the geometry.
* :doc:`pgr_analyzeGraph` to analyze the edges and vertices of the edge table.
* :doc:`pgr_analyzeOneWay` to analyze directionality of the edges.

.. rubric:: Indices and tables
Expand Down
180 changes: 96 additions & 84 deletions doc/topology/pgr_nodeNetwork.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,143 +87,155 @@ The output table will have for ``edge_table_noded``
Examples
-------------------------------------------------------------------------------

Let's create the topology for the data in :doc:`sampledata`
Create the topology for the data in :doc:`sampledata`

.. literalinclude:: sampledata.queries
:start-after: -- q1
:end-before: -- q1-1

.. literalinclude:: sampledata.queries
:start-after: -- q3
:end-before: -- q4

Analyze the network for intersections.

.. literalinclude:: nodeNetwork.queries
:start-after: --q1
:end-before: --q1.1
:end-before: --q2

Now we can analyze the network.
Analyze the network for gaps.

.. literalinclude:: nodeNetwork.queries
:start-after: --q2
:end-before: --q2.1
:end-before: --q3

The analysis tell us that the network has a gap and an intersection.

Fixing an intersection
...............................................................................

The analysis tell us that the network has a gap and an intersection. We try to
fix the problem using:
Storing the intersections.

.. literalinclude:: nodeNetwork.queries
:start-after: --q3
:end-before: --q3.1
:end-before: --q4

Inspecting the generated table, we can see that edges 13,14 and 18 has been
segmented
Calling ``pgr_nodeNetwork``.

.. literalinclude:: nodeNetwork.queries
:start-after: --q4
:end-before: --q4.1
:end-before: --q5

We can create the topology of the new network
Inspecting the generated table, we can see that edges 13 and 18 have been
segmented.

.. literalinclude:: nodeNetwork.queries
:start-after: --q5
:end-before: --q5.1
:end-before: --q6

Now let's analyze the new topology
.. rubric:: Update the topology

Add new segments to the edges table.

.. literalinclude:: nodeNetwork.queries
:start-after: --q6
:end-before: --q6.1
:end-before: --q7

Images
-------------------------------------------------------------------------------
Insert the intersection as new vertices.

.. Rubric:: Before Image
.. literalinclude:: nodeNetwork.queries
:start-after: --q7
:end-before: --q8

.. image:: images/before_node_net.png
:scale: 60%
:alt: Before image
:align: left
Update source and target information on the edges table.

.. literalinclude:: nodeNetwork.queries
:start-after: --q8
:end-before: --q9

.. Rubric:: After Image
Delete original edge.

.. image:: images/after_node_net.png
:scale: 60%
:alt: After image
:align: left
.. literalinclude:: nodeNetwork.queries
:start-after: --q9
:end-before: --q10

Update the vertex topology

Comparing the results
-------------------------------------------------------------------------------
.. literalinclude:: nodeNetwork.queries
:start-after: --q10
:end-before: --q11

Comparing with the Analysis in the original edge_table, we see that.

+------------------+-----------------------------------------+--------------------------------------------------------------+
| | Before | After |
+==================+=========================================+==============================================================+
|Table name | edge_table | edge_table_noded |
+------------------+-----------------------------------------+--------------------------------------------------------------+
|Fields | All original fields | Has only basic fields to do a topology analysis |
+------------------+-----------------------------------------+--------------------------------------------------------------+
|Dead ends | - Edges with 1 dead end: 1,6,24 | Edges with 1 dead end: 1-1 ,6-1,14-2, 18-1 17-1 18-2 |
| | - Edges with 2 dead ends: 17,18 | |
| | | |
| | Edge 17's right node is a dead end | |
| | because there is no other edge sharing | |
| | that same node. (cnt=1) | |
+------------------+-----------------------------------------+--------------------------------------------------------------+
|Isolated segments | two isolated segments: 17 and 18 both | No Isolated segments |
| | they have 2 dead ends | - Edge 17 now shares a node with edges 14-1 and 14-2 |
| | | - Edges 18-1 and 18-2 share a node with edges 13-1 and 13-2 |
+------------------+-----------------------------------------+--------------------------------------------------------------+
|Gaps | There is a gap between edge 17 and 14 | Edge 14 was segmented |
| | because edge 14 is near to the right | Now edges: 14-1 14-2 17 share the same node |
| | node of edge 17 | The tolerance value was taken in account |
+------------------+-----------------------------------------+--------------------------------------------------------------+
|Intersections | Edges 13 and 18 were intersecting | Edges were segmented, So, now in the interection's |
| | | point there is a node and the following edges share it: |
| | | 13-1 13-2 18-1 18-2 |
+------------------+-----------------------------------------+--------------------------------------------------------------+


Now, we are going to include the segments 13-1, 13-2 14-1, 14-2 ,18-1 and 18-2
into our edge-table, copying the data for dir,cost,and reverse cost with tho
following steps:

- Add a column old_id into edge_table, this column is going to keep track the id
of the original edge
- Insert only the segmented edges, that is, the ones whose max(sub_id) >1
Analyze the network for intersections.

.. literalinclude:: nodeNetwork.queries
:start-after: --q7
:end-before: --q7.1
:start-after: --q11
:end-before: --q12

We recreate the topology:
Fixing a gap
...............................................................................

Store the deadends

.. literalinclude:: nodeNetwork.queries
:start-after: --q8
:end-before: --q8.1
:start-after: --q12
:end-before: --q13

To get the same analysis results as the topology of edge_table_noded, we do the
following query:
Calling ``pgr_nodeNetwork``.

.. literalinclude:: nodeNetwork.queries
:start-after: --q9
:end-before: --q9.1
:start-after: --q13
:end-before: --q14

To get the same analysis results as the original edge_table, we do the following
query:
Inspecting the generated table, we can see that edge 14 has been segmented.

.. literalinclude:: nodeNetwork.queries
:start-after: --q10
:end-before: --q10.1
:start-after: --q14
:end-before: --q15

.. rubric:: Update the topology

Or we can analyze everything because, maybe edge 18 is an overpass, edge 14 is
an under pass and there is also a street level juction, and the same happens
with edges 17 and 13.
Add new segments to the edges table.

.. literalinclude:: nodeNetwork.queries
:start-after: --q11
:end-before: --q11.1
:start-after: --q15
:end-before: --q16

Insert the intersection as new vertices.

.. literalinclude:: nodeNetwork.queries
:start-after: --q16
:end-before: --q17

Update source and target information on the edges table.

.. literalinclude:: nodeNetwork.queries
:start-after: --q17
:end-before: --q18

Delete original edge.

.. literalinclude:: nodeNetwork.queries
:start-after: --q18
:end-before: --q19

Update the vertex topology

.. literalinclude:: nodeNetwork.queries
:start-after: --q19
:end-before: --q20

Analyze the network for gaps.

.. literalinclude:: nodeNetwork.queries
:start-after: --q20
:end-before: --q21

See Also
-------------------------------------------------------------------------------

:doc:`topology-functions` for an overview of a topology for routing algorithms.
:doc:`pgr_analyzeOneWay` to analyze directionality of the edges.
:doc:`pgr_createTopology` to create a topology based on the geometry.
:doc:`pgr_analyzeGraph` to analyze the edges and vertices of the edge table.

.. rubric:: Indices and tables

Expand Down
Loading