Represents a mapping of vertex attributes to their corresponding vertices within a graph. Provides functionality to manage and traverse vertices via DFS and BFS using the Visitor V1.2.0 typeclass engine.
The mutable discovered flag pattern has been removed; visited-node tracking is now handled entirely by the immutable VisitedSet[V] inside the traversal engine.
Type parameters
- V
-
the type representing the vertex attributes (invariant).
Value parameters
- map
-
a mapping from vertex attributes to their associated Vertex instances.
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Traversable[V]class Objecttrait Matchableclass AnyShow all
Members list
Value members
Concrete methods
Adds a vertex to the VertexMap.
Adds a vertex to the VertexMap.
Attributes
Adds a directed or undirected edge to the vertex map.
Adds a directed or undirected edge to the vertex map.
Attributes
Adds a vertex pair (with EdgeType) to the VertexMap.
Adds a vertex pair (with EdgeType) to the VertexMap.
Attributes
Returns the number of edges in the graph.
Returns the number of edges in the graph.
TODO: this mechanism uses a var and we should change that.
Attributes
- Returns
-
the number of edges in the graph.
Returns the number of vertices in the graph.
Returns the number of vertices in the graph.
Attributes
- Returns
-
the number of vertices in the graph.
Adds the edges from the provided EdgeList to this VertexMap.
Adds the edges from the provided EdgeList to this VertexMap.
Attributes
Adds a single triplet to the VertexMap.
Adds a single triplet to the VertexMap.
Attributes
Processes a sequence of triplets and adds them to the VertexMap.
Processes a sequence of triplets and adds them to the VertexMap.
Attributes
Adds a sequence of vertex pairs with their EdgeTypes to this VertexMap.
Adds a sequence of vertex pairs with their EdgeTypes to this VertexMap.
Attributes
Returns an iterator over the vertices adjacent to the given vertex.
Returns an iterator over the vertices adjacent to the given vertex.
Value parameters
- v
-
the vertex for which adjacent vertices are to be retrieved.
Attributes
- Returns
-
an iterator over the adjacent vertex attributes.
- Throws
-
GraphException
if the specified vertex is not found in the graph.
Returns the vertex for the key, throwing NoSuchElementException if absent.
Returns the vertex for the key, throwing NoSuchElementException if absent.
Attributes
Returns the vertex for key x, or applies defaultFunc if absent.
Returns the vertex for key x, or applies defaultFunc if absent.
Attributes
Performs BFS from v, accumulating results into visitor.
Performs BFS from v, accumulating results into visitor.
Value parameters
- goal
-
early-termination predicate (default: never stop early).
- v
-
the starting vertex.
- visitor
-
the visitor to accumulate results.
Attributes
BFS over edges rather than vertices. NOTE: this is a stub — the old implementation was also effectively a stub. TODO implement this properly.
BFS over edges rather than vertices. NOTE: this is a stub — the old implementation was also effectively a stub. TODO implement this properly.
Value parameters
- goal
-
early-termination predicate on destination vertices.
- v
-
the starting vertex.
- visitor
-
the visitor processing edges.
Attributes
Checks if the specified key is present in the VertexMap.
Checks if the specified key is present in the VertexMap.
Attributes
Creates an Adjacency from an optional edge.
Creates an Adjacency from an optional edge.
Attributes
Creates vertices and adjacencies from a triplet.
Creates vertices and adjacencies from a triplet.
Attributes
Performs DFS from v, accumulating results into visitor.
Performs DFS from v, accumulating results into visitor.
A local GraphNeighbours[V] derived from adjacentVertices is provided to the engine.
Value parameters
- v
-
the starting vertex.
- visitor
-
the visitor to accumulate results.
Attributes
Performs DFS for all vertices in the graph, including those not reachable from any single start vertex.
Performs DFS for all vertices in the graph, including those not reachable from any single start vertex.
Value parameters
- visitor
-
the visitor to accumulate results.
Attributes
Filters the adjacencies of a given vertex based on a specified predicate.
Filters the adjacencies of a given vertex based on a specified predicate.
Value parameters
- predicate
-
a function that evaluates each
Adjacency[V]and returns true if the adjacency satisfies the specified condition. - v
-
the vertex whose adjacencies are to be filtered.
Attributes
- Returns
-
an iterator over the adjacencies of the given vertex that satisfy the predicate.
Retrieves the vertex associated with the specified key.
Retrieves the vertex associated with the specified key.
Attributes
Returns the vertex for the key, or the default if not present.
Returns the vertex for the key, or the default if not present.
Attributes
Provides an iterator over the keys in the underlying map.
Provides an iterator over the keys in the underlying map.
Attributes
Retrieves the set of keys present in the VertexMap.
Retrieves the set of keys present in the VertexMap.
Attributes
Returns a new VertexMap with the same vertex keys but empty adjacency lists. Used to seed a reversed or transformed graph before re-adding edges.
Returns a new VertexMap with the same vertex keys but empty adjacency lists. Used to seed a reversed or transformed graph before re-adding edges.
Attributes
Modifies a vertex in this VertexMap using the provided function.
Modifies a vertex in this VertexMap using the provided function.
Value parameters
- f
-
the function to apply to the vertex.
- v
-
the identifier of the vertex to modify.
Attributes
- Returns
-
a new VertexMap with the vertex modified if it exists.
Provides a GraphNeighbours[V] instance derived from the graphNeighbours method. The GraphNeighbours[V] instance facilitates efficient access to the neighbors of a vertex within the graph, enabling traversal algorithms to query adjacent vertices.
Provides a GraphNeighbours[V] instance derived from the graphNeighbours method. The GraphNeighbours[V] instance facilitates efficient access to the neighbors of a vertex within the graph, enabling traversal algorithms to query adjacent vertices.
Attributes
- Returns
-
a
GraphNeighbours[V]instance for querying vertex neighbors.
Returns a string representation of the object.
Returns a string representation of the object.
The default representation is platform dependent.
Attributes
- Returns
-
a string representation of the object.
- Definition Classes
-
Any
Inherited methods
Filters the adjacent vertices of a given vertex based on a specified predicate.
Filters the adjacent vertices of a given vertex based on a specified predicate.
Value parameters
- predicate
-
a function that evaluates each adjacent vertex and returns true if the vertex satisfies the specified condition.
- v
-
the vertex whose adjacent vertices are to be filtered.
Attributes
- Returns
-
an iterator over the vertices that are adjacent to v and satisfy the predicate.
- Inherited from:
- Traversable
Retrieves the connexions (edges) reachable from start via DFS.
Retrieves the connexions (edges) reachable from start via DFS.
Type parameters
- E
-
the type of the edges in the graph.
Value parameters
- start
-
the starting vertex.
Attributes
- Returns
-
a
Connexions[V, E]object representing the discovered connexions. - Inherited from:
- Traversable
Derives a GraphNeighbours[V] instance from adjacentVertices. Used internally by the default implementations of vertexMappedTraversalDfs, vertexMappedTraversalBfs, and getConnexions.
Derives a GraphNeighbours[V] instance from adjacentVertices. Used internally by the default implementations of vertexMappedTraversalDfs, vertexMappedTraversalBfs, and getConnexions.
CONSIDER making this protected again but that requires multiple instances in each type of Traversal.
NOTE: do not be tempted to add a default Random implementation for this context. We need to enforce consistency of Random instances.
Attributes
- Inherited from:
- Traversable
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
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
Performs a BFS traversal applying fulfill to each visited vertex and returns a VertexTraversalResult mapping each vertex to its result.
Performs a BFS traversal applying fulfill to each visited vertex and returns a VertexTraversalResult mapping each vertex to its result.
Type parameters
- T
-
the result type produced by
fulfill.
Value parameters
- fulfill
-
transformation function applied to each vertex.
- start
-
the starting vertex.
Attributes
- Returns
-
Try[TraversalResult[V, T]]containing the traversal result or a failure. - Inherited from:
- Traversable
Performs a DFS traversal applying fulfill to each visited vertex and returns a VertexTraversalResult mapping each vertex to its result.
Performs a DFS traversal applying fulfill to each visited vertex and returns a VertexTraversalResult mapping each vertex to its result.
Type parameters
- T
-
the result type produced by
fulfill.
Value parameters
- fulfill
-
transformation function applied to each vertex.
- start
-
the starting vertex.
Attributes
- Returns
-
Try[TraversalResult[V, T]]containing the traversal result or a failure. - Inherited from:
- Traversable