Factory object for creating instances of DirectedGraph. This object provides utility methods to construct a directed graph from an edge list representation.
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 type V. - the second element is the target vertex of type V. - the third element is the edge attribute of type E.
Attributes
Returns
a Try[Graph[V]], where: - Success(Graph[V]) contains the constructed graph if the operation is successful. - Failure contains a GraphException if the graph construction fails.