MST

com.phasmidsoftware.gryphon.traverse.MST
object MST

Computes minimum spanning trees using Prim's algorithm. Delegates to PrimTraversal from the GraphTraversal family.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
MST.type

Members list

Value members

Concrete methods

def prim[V, E](traversable: Traversable[V], start: V)(using evidence$1: Zero[E], evidence$2: Ordering[E], random: Random = ...): TraversalResult[V, Edge[V, E]]

Runs Prim's algorithm from start, returning the MST as a traversal result.

Runs Prim's algorithm from start, returning the MST as a traversal result.

Each entry v → edge in the result records the cheapest edge connecting v to the growing MST. The start vertex is absent (it has no predecessor).

Type parameters

E

the edge-weight type; must be Monoid and Ordering.

V

the vertex type.

Value parameters

random

controls adjacency ordering.

start

the source vertex.

traversable

the weighted undirected graph.

Attributes

Returns

a TraversalResult[V, Edge[V, E]] mapping each MST vertex to its cheapest incoming edge.