#include <kruskal.h>
Public Methods | |
Kruskal (EdgeVector< EdgeType > &graph, MST &result) | |
Computes a MST of a graph. | |
~Kruskal () | |
The destructor. | |
Private Methods | |
void | computeMST () |
Computes a MST of the graph. | |
void | initUnionFind () |
Initializes the union/find data structure. | |
NodeID | find (NodeID node) |
Performs a find operation. | |
bool | unite (NodeID node1, NodeID node2) |
Performs a union operation. | |
Private Attributes | |
EdgeVector< EdgeType > & | _graph |
Reference to the given graph. | |
MST & | _result |
Reference to a MST object which stores the result. | |
std::vector< NodeID > | _parent |
A vector which contains for each node the identifier of the parent node. | |
std::vector< char > | _height |
A vector which contains for each node the height of the belonging tree. | |
EdgeCount | edgesAddedToResult |
Counts the number of edges which have been added to the resulting MST. |
Definition at line 24 of file kruskal.h.
|
Computes a MST of a graph.
Definition at line 32 of file kruskal.h. References Kruskal< EdgeType >::_graph, Kruskal< EdgeType >::_result, and Kruskal< EdgeType >::computeMST(). |
|
The destructor. The given graph is deleted. Definition at line 42 of file kruskal.h. References Kruskal< EdgeType >::_graph. |
|
Performs a find operation. Path compression is applied.
Definition at line 100 of file kruskal.h. References Kruskal< EdgeType >::_parent. Referenced by Kruskal< EdgeType >::unite(). |
|
Performs a union operation.
Definition at line 122 of file kruskal.h. References Kruskal< EdgeType >::_height, Kruskal< EdgeType >::_parent, and Kruskal< EdgeType >::find(). Referenced by Kruskal< EdgeType >::computeMST(). |
|
A vector which contains for each node the height of the belonging tree. Only the values of canonical nodes are relevant. Definition at line 84 of file kruskal.h. Referenced by Kruskal< EdgeType >::initUnionFind(), and Kruskal< EdgeType >::unite(). |
|
A vector which contains for each node the identifier of the parent node. The canonical node of a set (= the root of a tree) points to itself. Definition at line 78 of file kruskal.h. Referenced by Kruskal< EdgeType >::find(), Kruskal< EdgeType >::initUnionFind(), and Kruskal< EdgeType >::unite(). |