Kruskal - Family of functions

_images/boost-inside.jpeg

Boost Graph Inside

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 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)

  • When negative: edge (source, target) does not exist, therefore it’s not part of the graph.
reverse_cost ANY-NUMERICAL -1

Weight of the edge (target, source),

  • When negative: edge (target, source) does not exist, therefore it’s not part of the graph.

Where:

ANY-INTEGER:SMALLINT, INTEGER, BIGINT
ANY-NUMERICAL:SMALLINT, INTEGER, BIGINT, REAL, FLOAT