DirectedGraph

com.phasmidsoftware.gryphon.adjunct.DirectedGraph
See theDirectedGraph companion class
object DirectedGraph

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 Product
trait Mirror
class Object
trait Matchable
class Any
Self type

Members list

Type members

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements.

The names of the product elements.

Attributes

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type.

The name of the type.

Attributes

Inherited from:
Mirror

Value members

Concrete methods

def apply[V, E](vertexMap: VertexMap[V]): DirectedGraph[V, E]

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 V as 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.

def apply[V, E]: DirectedGraph[V, E]

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].

def triplesToTryGraph[V, E](f: V => Vertex[V])(triples: Seq[Triplet[V, E, EdgeType]]): Try[Graph[V]]

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.