PrimTraversal

com.phasmidsoftware.gryphon.traverse.PrimTraversal
case class PrimTraversal[V, E]()(using evidence$1: Zero[E], evidence$2: Ordering[E]) extends WeightedTraversal[V, E, Edge[V, E]]

Prim's minimum spanning tree traversal. See Prim's Algorithm.

Uses individual edge weight (not cumulative) as the frontier priority, so the cheapest available edge to any unvisited vertex is always chosen next. All edge types are admitted — the result type is TraversalResult[V, Edge[V, E]].

Requires only E: {Zero, Ordering} — Prim never accumulates path costs so Monoid.combine is not needed. Zero.identity seeds the initial frontier cost for the start vertex, which is immediately replaced by actual edge weights.

Type parameters

E

the edge-weight type; must have Zero and Ordering.

V

the vertex type.

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class WeightedTraversal[V, E, Edge[V, E]]
trait GraphTraversal[V, E, Edge[V, E]]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
def run(graph: Traversable[V])(start: V)(using random: Random = ...): TraversalResult[V, Edge[V, E]]

Runs the traversal from start on graph, returning a TraversalResult.

Runs the traversal from start on graph, returning a TraversalResult.

Value parameters

graph

the graph to traverse.

random

controls adjacency ordering.

start

the starting vertex.

Attributes

Returns

a TraversalResult[V, R] mapping each visited vertex to its result.

Inherited from:
WeightedTraversal