Connexions

com.phasmidsoftware.gryphon.traverse.Connexions
See theConnexions companion object
case class Connexions[V, E](connexions: Map[V, DirectedEdge[V, E]]) extends AbstractVertexTraversalResult[V, DirectedEdge[V, E]]

Represents a particular traversal of vertices within a graph resulting from a depth-first-search starting at a particular vertex. Each vertex that is reached (not including the start vertex) is represented in the connexions Map by a DirectedEdge where the "white" (first) vertex is the start of a followed edge and the "black" (second) vertex will be the same as the key vertex. NOTE that not all edges will be followed and different random seeds will result in different results.

CONSIDER returning a directed, rooted tree of DirectedEdge.

Type parameters

V

the type representing a vertex in the graph.

Value parameters

connexions

a map where each key is a vertex of type V and its value is a tuple (V, V) representing the result associated with traversal from this vertex.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait TraversalResult[V, DirectedEdge[V, E]]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override def +(t: (V, DirectedEdge[V, E])): Connexions[V, E]

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.

Definition Classes
def addConnexion(v: V, connexion: Connexion[V]): Connexions[V, E]

Adds a connexion between the specified vertex and another vertex defined in the given Connexion instance. If the Connexion is directed, it is added as-is. If the Connexion is undirected, it is converted into a directed connexion pointing from the specified vertex to the other vertex before being added.

Adds a connexion between the specified vertex and another vertex defined in the given Connexion instance. If the Connexion is directed, it is added as-is. If the Connexion is undirected, it is converted into a directed connexion pointing from the specified vertex to the other vertex before being added.

Value parameters

connexion

the Connexion instance representing the connexion details (directed or undirected) between the vertices.

v

the vertex to which the connexion is to be added.

Attributes

Returns

a new Connexions[V, E] instance with the updated connexion added.

Throws
GraphException

if the provided connexion type is unexpected.

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

Creates a new TraversalResult instance with the specified map of vertices and their associated traversal results.

Creates a new TraversalResult instance with the specified map of vertices and their associated traversal results.

Value parameters

map

a map where each key is a vertex of type V and its value is a tuple (V, V) representing the result associated with traversal from this vertex.

Attributes

Returns

a new TraversalResult instance of type TraversalResult[V, (V, V)] initialized with the provided map.

Inherited methods

def edgeTraverse(x: Int): DirectedEdge[V, E]

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

Inherited from:
AbstractVertexTraversalResult
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.

Inherited from:
AbstractVertexTraversalResult
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 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

Inherited from:
AbstractVertexTraversalResult
def vertexTraverse(v: V): Option[DirectedEdge[V, E]]

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.

Inherited from:
AbstractVertexTraversalResult