com.phasmidsoftware.gryphon.builder

Members list

Type members

Classlikes

class GraphBuilder[V, E, G <: Graph[V]](build: Seq[Triplet[V, E, EdgeType]] => Try[G])(using evidence$1: Parseable[V], evidence$2: Parseable[E])

A purely functional builder that constructs a typed graph from a resource file or file-system path, using the GraphParser / Parseable infrastructure.

A purely functional builder that constructs a typed graph from a resource file or file-system path, using the GraphParser / Parseable infrastructure.

GraphBuilder is parameterised on the vertex type V, edge type E, and the concrete graph type G. Callers obtain an instance via the companion-object factory methods GraphBuilder.undirected and GraphBuilder.directed, which supply the appropriate triplesToTryGraph function for each graph flavour.

The two Parseable context bounds are satisfied automatically for the built-in types Int, Double, String, etc., and can be provided by the caller for custom domain types (e.g. Building, TunnelProperties).

Type parameters

E

the edge attribute type.

G

the concrete graph type, must be a subtype of Graph[V].

V

the vertex attribute type.

Value parameters

build

a function that converts a sequence of parsed triplets into a Try[G].

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object GraphBuilder

Companion object providing factory methods for the two standard graph flavours.

Companion object providing factory methods for the two standard graph flavours.

Usage (built-in types):

val g: Try[UndirectedGraph[Int, Double]] =
 GraphBuilder.undirected[Int, Double].fromResource("prim.graph")

val g: Try[DirectedGraph[Int, Double]] =
 GraphBuilder.directed[Int, Double].fromResource("routes.graph")

Usage (custom types — supply Parseable instances for V and E):

given Parseable[Building] = ...
given Parseable[TunnelProperties] = ...

val g: Try[UndirectedGraph[Building, TunnelProperties]] =
 GraphBuilder.undirected[Building, TunnelProperties].fromResource("tunnels.graph")

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type