|
| 1 | +.. |
| 2 | + **************************************************************************** |
| 3 | + pgRouting Manual |
| 4 | + Copyright(c) pgRouting Contributors |
| 5 | +
|
| 6 | + This documentation is licensed under a Creative Commons Attribution-Share |
| 7 | + Alike 3.0 License: https://creativecommons.org/licenses/by-sa/3.0/ |
| 8 | + **************************************************************************** |
| 9 | + |
| 10 | +.. index:: |
| 11 | + single: Metrics Family ; pgr_bandwidth - Experimental |
| 12 | + single: bandwidth - Experimental on v4.0 |
| 13 | + |
| 14 | +| |
| 15 | +
|
| 16 | +``pgr_bandwidth`` - Experimental |
| 17 | +=============================================================================== |
| 18 | + |
| 19 | +``pgr_bandwidth`` - Calculates the bandwidth of the graph |
| 20 | + |
| 21 | +.. include:: experimental.rst |
| 22 | + :start-after: warning-begin |
| 23 | + :end-before: end-warning |
| 24 | + |
| 25 | +.. rubric:: Availability |
| 26 | + |
| 27 | +.. rubic:: Version 4.0.0 |
| 28 | + |
| 29 | +* New experimental function. |
| 30 | + |
| 31 | +Description |
| 32 | +------------------------------------------------------------------------------- |
| 33 | + |
| 34 | +Bandwidth measures how "spread out" the connections are in a graph when vertices are arranged in a linear order (like numbering them 1, 2, 3, etc.). |
| 35 | + |
| 36 | +* For each edge in the graph, calculate the distance between the vertex numbers it connects |
| 37 | +* The bandwidth is the maximum of all these distances |
| 38 | +* The implementation is for undirected graphs |
| 39 | +* Run time is 0.160789 seconds |
| 40 | + |
| 41 | +|Boost| Boost Graph Inside |
| 42 | + |
| 43 | +Signatures |
| 44 | +------------------------------------------------------------------------------- |
| 45 | + |
| 46 | +.. rubric:: Summary |
| 47 | + |
| 48 | +.. admonition:: \ \ |
| 49 | + :class: signatures |
| 50 | + |
| 51 | + pgr_bandwidth(`Edges SQL`_) |
| 52 | + |
| 53 | + | Returns ``BIGINT`` |
| 54 | +
|
| 55 | +:Example: For an undirected graph with edges. |
| 56 | + |
| 57 | +.. literalinclude:: bandwidth.queries |
| 58 | + :start-after: -- q1 |
| 59 | + :end-before: -- q2 |
| 60 | + |
| 61 | +Parameters |
| 62 | +------------------------------------------------------------------------------- |
| 63 | + |
| 64 | +.. include:: pgRouting-concepts.rst |
| 65 | + :start-after: edges_start |
| 66 | + :end-before: edges_end |
| 67 | + |
| 68 | +Inner Queries |
| 69 | +------------------------------------------------------------------------------- |
| 70 | + |
| 71 | +Edges SQL |
| 72 | +............................................................................... |
| 73 | + |
| 74 | +.. include:: pgRouting-concepts.rst |
| 75 | + :start-after: basic_edges_sql_start |
| 76 | + :end-before: basic_edges_sql_end |
| 77 | + |
| 78 | +Result columns |
| 79 | +------------------------------------------------------------------------------- |
| 80 | + |
| 81 | +Returns a bigint ``(pgr_bandwidth)`` |
| 82 | + |
| 83 | +================= =========== ========================================== |
| 84 | +Column Type Description |
| 85 | +================= =========== ========================================== |
| 86 | +``pgr_bandwidth`` ``BIGINT`` gives the bandwidth of the graph. |
| 87 | +================= =========== ========================================== |
| 88 | + |
| 89 | +Additional Examples |
| 90 | +------------------------------------------------------------------------------- |
| 91 | + |
| 92 | +:Example: Undirected graph with edges before optimization. |
| 93 | + |
| 94 | +.. graphviz:: |
| 95 | + |
| 96 | + graph G { |
| 97 | + node [shape=circle, style=filled, fillcolor=white, color=black, fontcolor=black, fontsize=10]; |
| 98 | + edge [color=black, penwidth=1]; |
| 99 | + |
| 100 | + 4 -- 7; |
| 101 | + 7 -- 9; |
| 102 | + 7 -- 0; |
| 103 | + 0 -- 2; |
| 104 | + 2 -- 5; |
| 105 | + 5 -- 9; |
| 106 | + 9 -- 8; |
| 107 | + 9 -- 1; |
| 108 | + 5 -- 1; |
| 109 | + 9 -- 6; |
| 110 | + 6 -- 3; |
| 111 | + 1 -- 3; |
| 112 | + |
| 113 | + {rank=same; 4; 8; 6;} |
| 114 | + {rank=same; 7; 9; 3;} |
| 115 | + {rank=same; 0; 2; 5; 1;} |
| 116 | + } |
| 117 | + |
| 118 | +.. literalinclude:: bandwidth.queries |
| 119 | + :start-after: -- q2 |
| 120 | + :end-before: -- q5 |
| 121 | + |
| 122 | +:Example: Undirected graph with edges after optimization. |
| 123 | + |
| 124 | +.. graphviz:: |
| 125 | + |
| 126 | + graph G { |
| 127 | + node [shape=circle, style=filled, fillcolor=white, color=black, fontcolor=black, fontsize=12]; |
| 128 | + edge [color=black, penwidth=1]; |
| 129 | + |
| 130 | + 0 -- 1; |
| 131 | + 1 -- 3; |
| 132 | + 1 -- 2; |
| 133 | + 2 -- 4; |
| 134 | + 4 -- 8; |
| 135 | + 8 -- 3; |
| 136 | + 3 -- 5; |
| 137 | + 3 -- 6; |
| 138 | + 3 -- 7; |
| 139 | + 8 -- 7; |
| 140 | + 6 -- 9; |
| 141 | + 7 -- 9; |
| 142 | + |
| 143 | + {rank=same; 0; 5; 6;} |
| 144 | + {rank=same; 1; 3; 9;} |
| 145 | + {rank=same; 2; 4; 8; 7;} |
| 146 | + |
| 147 | + } |
| 148 | + |
| 149 | +.. literalinclude:: bandwidth.queries |
| 150 | + :start-after: -- q5 |
| 151 | + :end-before: -- q8 |
| 152 | + |
| 153 | +See Also |
| 154 | +------------------------------------------------------------------------------- |
| 155 | + |
| 156 | +* :doc:`sampledata` |
| 157 | +* `Boost: bandwidth |
| 158 | + <https://www.boost.org/libs/graph/doc/bandwidth.html>`_ |
| 159 | + |
| 160 | +.. rubric:: Indices and tables |
| 161 | + |
| 162 | +* :ref:`genindex` |
| 163 | +* :ref:`search` |
0 commit comments