pgr_lengauerTarjanDominatorTree -Experimental¶
pgr_lengauerTarjanDominatorTree
— Returns the immediate dominator of all vertices.
Warning
Possible server crash
- These functions might create a server crash
Warning
Experimental functions
- They are not officially of the current release.
- They likely will not be officially be part of the next release:
- The functions might not make use of ANY-INTEGER and ANY-NUMERICAL
- Name might change.
- Signature might change.
- Functionality might change.
- pgTap tests might be missing.
- Might need c/c++ coding.
- May lack documentation.
- Documentation if any might need to be rewritten.
- Documentation examples might need to be automatically generated.
- Might need a lot of feedback from the comunity.
- Might depend on a proposed function of pgRouting
- Might depend on a deprecated function of pgRouting
Availability
- Version 3.2.0
- New experimental function
Description¶
The algorithm calculates the immidiate dominator of each vertex called idom, once idom of each vertex is calculated then by making every idom of each vertex as its parent, the dominator tree can be built.
The main Characteristics are:
- The algorithm works in directed graph only.
- The returned values are not ordered.
- The algorithm returns idom of each vertex.
- If the root vertex not present in the graph then it returns empty set.
- Running time: \(O((V+E)log(V+E))\)
Signatures¶
Summary
pgr_lengauerTarjanDominatorTree(Edges SQL, root vertex)
RETURNS SET OF (seq, vertex_id, idom)
OR EMPTY SET
Example: | The lengauerTarjanDominatorTree with root vertex \(1\) |
---|
SELECT * FROM pgr_lengauertarjandominatortree(
$$SELECT id,source,target,cost,reverse_cost FROM edge_table$$,
1
);
seq | vertex_id | idom
-----+-----------+------
1 | 1 | 0
2 | 2 | 1
3 | 3 | 4
4 | 4 | 9
5 | 5 | 2
6 | 6 | 5
7 | 7 | 8
8 | 8 | 5
9 | 9 | 5
10 | 10 | 5
11 | 11 | 5
12 | 12 | 5
13 | 13 | 10
14 | 14 | 0
15 | 15 | 0
16 | 16 | 0
17 | 17 | 0
(17 rows)
Parameters¶
Column | Type | Description |
---|---|---|
Edges SQL | TEXT |
SQL query as described above. |
root vertex | BIGINT |
Identifier of the starting vertex. |
Inner query¶
Column | Type | Default | Description |
---|---|---|---|
id | ANY-INTEGER |
Identifier of the edge. | |
source | ANY-INTEGER |
Identifier of the first end point vertex of the edge. | |
target | ANY-INTEGER |
Identifier of the second end point vertex of the edge. | |
cost | ANY-NUMERICAL |
Weight of the edge (source, target)
|
|
reverse_cost | ANY-NUMERICAL |
-1 | Weight of the edge (target, source),
|
Where:
ANY-INTEGER: | SMALLINT, INTEGER, BIGINT |
---|---|
ANY-NUMERICAL: | SMALLINT, INTEGER, BIGINT, REAL, FLOAT |
Result Columns¶
Returns set of (seq, vertex_id,idom)
Column | Type | Description |
---|---|---|
seq | INTEGER |
Sequential value starting from 1. |
vertex_id | BIGINT |
Identifier of vertex . |
idom | BIGINT |
Immediate dominator of vertex. |
Additional Examples¶
The examples in this section use the following Network for queries marked as directed and cost and reverse_cost columns are used
Example: | When the edge is disonnectd from graph then it will returns immidiate dominator of all other vertex as zero. |
---|
SELECT * FROM pgr_lengauertarjandominatortree(
$$SELECT id,source,target,cost,reverse_cost FROM edge_table$$,
16
);
seq | vertex_id | idom
-----+-----------+------
1 | 1 | 0
2 | 2 | 0
3 | 3 | 0
4 | 4 | 0
5 | 5 | 0
6 | 6 | 0
7 | 7 | 0
8 | 8 | 0
9 | 9 | 0
10 | 10 | 0
11 | 11 | 0
12 | 12 | 0
13 | 13 | 0
14 | 14 | 0
15 | 15 | 0
16 | 16 | 0
17 | 17 | 16
(17 rows)
See Also¶
- Boost: lengauerTarjanDominatorTree algorithm documentation
- Wikipedia: dominator tree
- Sample Data network.
Indices and tables