pgr_makeConnected
 Experimental¶
pgr_makeConnected
— Set of edges that will connect the graph.
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 ANYINTEGER and ANYNUMERICAL
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¶
Adds the minimum number of edges needed to make the input graph connected. The algorithm first identifies all of the connected components in the graph, then adds edges to connect those components together in a path. For example, if a graph contains three connected components A, B, and C, make_connected will add two edges. The two edges added might consist of one connecting a vertex in A with a vertex in B and one connecting a vertex in B with a vertex in C.
The main characteristics are:
Works for undirected graphs.
It will give a minimum list of all edges which are needed in the graph to make connect it.
The algorithm does not considers traversal costs in the calculations.
The algorithm does not considers geometric topology in the calculations.
Running time: \(O(V + E)\)
Signatures¶
(seq, start_vid, end_vid)
 Example:
Query done on Sample Data network gives the list of edges that are needed to connect the graph.
SELECT * FROM pgr_makeConnected(
'SELECT id, source, target, cost, reverse_cost FROM edges'
);
seq  start_vid  end_vid
++
1  5  2
2  4  13
(2 rows)
Parameters¶
Parameter 
Type 
Description 


Edges SQL as described below. 
Inner Queries¶
Edges SQL¶
Column 
Type 
Default 
Description 


ANYINTEGER 
Identifier of the edge. 


ANYINTEGER 
Identifier of the first end point vertex of the edge. 


ANYINTEGER 
Identifier of the second end point vertex of the edge. 


ANYNUMERICAL 
Weight of the edge ( 


ANYNUMERICAL 
1 
Weight of the edge (

Where:
 ANYINTEGER:
SMALLINT
,INTEGER
,BIGINT
 ANYNUMERICAL:
SMALLINT
,INTEGER
,BIGINT
,REAL
,FLOAT
Result columns¶
Returns set of (seq, start_vid, end_vid)
Column 
Type 
Description 



Sequential value starting from 1. 


Identifier of the first end point vertex of the edge. 


Identifier of the second end point vertex of the edge. 
See Also¶
The queries use the Sample Data network.
Indices and tables