GraphTraversal

com.phasmidsoftware.gryphon.traverse.GraphTraversal
trait GraphTraversal[V, E, R]

A family of graph traversal algorithms unified under a single abstraction.

All four classic algorithms — DFS, BFS, Dijkstra, Prim — share the same underlying Traversal engine from Visitor. They differ only in:

  • the frontier type (Stack, Queue, IndexedPrioQueue)
  • the frontier element type (V for DFS/BFS, (E,V) for Dijkstra/Prim)
  • the cost-update strategy (none, cumulative, edge-only)

Type parameters

E

the edge-attribute type (Unit for DFS/BFS)

R

the result type recorded per vertex

V

the vertex type

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class BFSTraversal[V]
class DFSTraversal[V]
class WeightedTraversal[V, E, R]
class DijkstraTraversal[V, E]
class PrimTraversal[V, E]

Members list

Value members

Abstract methods

def run(graph: Traversable[V])(start: V)(using random: Random = ...): TraversalResult[V, R]

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.