Factory object for creating instances of DirectedGraph. This object provides utility methods to construct a directed graph from an edge list representation.
Attributes
- Companion
- class
- Graph
-
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
DirectedGraph.type
Members list
Type members
Inherited and Abstract types
The names of the product elements.
The names of the product elements.
Attributes
- Inherited from:
- Mirror
The name of the type.
The name of the type.
Attributes
- Inherited from:
- Mirror
Value members
Concrete methods
Constructs a new, directed graph using the provided vertex map.
Constructs a new, directed graph using the provided vertex map.
Type parameters
- E
-
the type of the edges in the graph.
- V
-
the type of the vertices in the graph.
Value parameters
- vertexMap
-
a map containing the vertices of type
Vas keys and their associated adjacency lists or other vertex-specific data.
Attributes
- Returns
-
an instance of
DirectedGraph[V, E]initialized with the given vertex map.
Creates a new instance of a DirectedGraph with an empty vertex map.
Creates a new instance of a DirectedGraph with an empty vertex map.
This method provides a convenient way to initialize an empty directed graph without explicitly providing a VertexMap. The vertex map is initialized using the default empty VertexMap implementation.
Type parameters
- E
-
the type of the edges in the graph.
- V
-
the type of the vertices in the graph.
Attributes
- Returns
-
an empty instance of
DirectedGraph[V, E].
Converts a sequence of triplets representing graph edges into a Try of Graph[V].
Converts a sequence of triplets representing graph edges into a Try of Graph[V].
Each triplet in the input sequence consists of two vertices (source and target) and an attribute associated with the edge connecting the vertices. This method attempts to construct a directed graph from the provided triplets, returning a Success with the graph instance if the operation is successful, or a Failure if the construction process encounters an error.
Type parameters
- E
-
the type of the edges in the graph.
- V
-
the type of the vertices in the graph.
Value parameters
- triples
-
a sequence of triplets
Triplet[V, E]where: - the first element is the source vertex of typeV. - the second element is the target vertex of typeV. - the third element is the edge attribute of typeE.
Attributes
- Returns
-
a
Try[Graph[V]], where: -Success(Graph[V])contains the constructed graph if the operation is successful. -Failurecontains aGraphExceptionif the graph construction fails.