Kruskal  Family of functions  pgRouting Manual (3.3)
Kruskal  Family of functions
Description
Kruskal’s algorithm is a greedy minimum spanning tree algorithm that in each cycle finds and adds the edge of the least possible weight that connects any two trees in the forest.
The main Characteristics are:

It’s implementation is only on undirected graph.

Process is done only on edges with positive costs.

The total weight of all the edges in the tree or forest is minimized.

When the graph is connected

The resulting edges make up a tree


When the graph is not connected,

Finds a minimum spanning tree for each connected component.

The resulting edges make up a forest.


Kruskal’s running time: \(O(E * log E)\)
Inner query
Column 
Type 
Default 
Description 

id 

Identifier of the edge. 

source 

Identifier of the first end point vertex of the edge. 

target 

Identifier of the second end point vertex of the edge. 

cost 

Weight of the edge (source, target)


reverse_cost 

1 
Weight of the edge (target, source) ,

Where:
 ANYINTEGER :

SMALLINT, INTEGER, BIGINT
 ANYNUMERICAL :

SMALLINT, INTEGER, BIGINT, REAL, FLOAT
See Also
Indices and tables