Giraffe.Graph (giraffe v0.1.1)
Public interface for working with graphs. Delegates to specific implementations based on whether the graph is directed or undirected.
Summary
Types
@type t() :: %Giraffe.Graph{ impl: Giraffe.Graph.Directed.t() | Giraffe.Graph.Undirected.t(), type: :directed | :undirected }
@type vertex() :: any()
@type weight() :: number()
Functions
Creates a new graph.
Options
:type
- The type of graph. Can be:directed
or:undirected
. Defaults to:directed
.
Examples
iex> Giraffe.Graph.new(type: :directed)
%Giraffe.Graph{impl: %Giraffe.Graph.Directed{vertices: MapSet.new([]), edges: %{}}, type: :directed}
iex> Giraffe.Graph.new(type: :undirected)
%Giraffe.Graph{impl: %Giraffe.Graph.Undirected{vertices: MapSet.new([]), edges: %{}}, type: :undirected}