AbstractVertexTraversalResult

com.phasmidsoftware.gryphon.traverse.AbstractVertexTraversalResult
abstract class AbstractVertexTraversalResult[V, T](map: Map[V, T]) extends TraversalResult[V, T]

Abstract base class for edge traversal within a graph. This class supports traversing edges in a graph-like structure by providing a specific implementation for edge traversal while delegating the vertex traversal to throw an exception, as it is not applicable for edge-based traversal.

Type parameters

T

the type representing the result of the edge traversal

V

the type representing a vertex in the graph

Value parameters

map

the underlying map of vertex -> T elements

Attributes

Graph
Supertypes
trait TraversalResult[V, T]
class Object
trait Matchable
class Any
Known subtypes
class Connexions[V, E]
class TopologicalSort[V]
class VertexTraversalResult[V, T]

Members list

Value members

Abstract methods

def unit(map: Map[V, T]): TraversalResult[V, T]

Constructs a traversal instance using the provided map of vertices and their associated traversal results.

Constructs a traversal instance using the provided map of vertices and their associated traversal results.

Value parameters

map

a mapping where keys represent vertices of type V, and values represent traversal results of type T.

Attributes

Returns

a new TraversalResult[V, T] instance built from the specified map.

Concrete methods

def +(t: (V, T)): TraversalResult[V, T]

Adds a new mapping of a vertex to its corresponding traversal result to the existing map, returning a new VertexTraversalResult instance with the updated mapping.

Adds a new mapping of a vertex to its corresponding traversal result to the existing map, returning a new VertexTraversalResult instance with the updated mapping.

Value parameters

t

a tuple where the first element is a vertex of type V, and the second element is its associated traversal result of type T.

Attributes

Returns

a new VertexTraversalResult instance of type VertexTraversalResult[V, E, T] containing the updated map.

def edgeTraverse(x: Int): T

Traverses a specified edge within a graph-like structure and produces a result of type T.

Traverses a specified edge within a graph-like structure and produces a result of type T.

Value parameters

x

the index of the edge to be traversed

Attributes

Returns

the result of the traversal

def keySet: Set[V]

Retrieves the set of keys from the underlying map that represents the traversal result.

Retrieves the set of keys from the underlying map that represents the traversal result.

Attributes

Returns

a set of keys of type V contained in the underlying map.

def size: Int

Returns the number of key-value pairs in the map.

Returns the number of key-value pairs in the map.

Attributes

Returns

the size of the map as an integer

def vertexTraverse(v: V): Option[T]

Traverses the specified vertex in the graph and retrieves the associated traversal result from the underlying map. If the vertex does not exist, a NoSuchElementException is thrown.

Traverses the specified vertex in the graph and retrieves the associated traversal result from the underlying map. If the vertex does not exist, a NoSuchElementException is thrown.

Value parameters

v

the vertex to be traversed and looked up in the map.

Attributes

Returns

the traversal result of type T associated with the provided vertex.

Throws
NoSuchElementException

if the vertex does not exist in the map.