haccepted-0.1.0.0: Data structures and algorithms
Safe HaskellNone
LanguageHaskell2010

Kruskal

Description

Kruskal's algorithm

An algorithm to find the minimum spanning forest of an edge-weighted graph.

Sources:

Synopsis

Documentation

data WEdge Source #

Constructors

WEdge 

Fields

Instances

Instances details
Eq WEdge Source # 
Instance details

Defined in Kruskal

Methods

(==) :: WEdge -> WEdge -> Bool #

(/=) :: WEdge -> WEdge -> Bool #

Show WEdge Source # 
Instance details

Defined in Kruskal

Methods

showsPrec :: Int -> WEdge -> ShowS #

show :: WEdge -> String #

showList :: [WEdge] -> ShowS #

NFData WEdge Source # 
Instance details

Defined in Kruskal

Methods

rnf :: WEdge -> () #

kruskal :: Bounds -> [WEdge] -> [WEdge] Source #

Runs Kruskal's algorithm on the graph represented by the given list of edges. Returns the edges that are part of a minimum spanning forest. Vertices should be non-negative. O(|V| + |E|log|E|).