gleaph
A graph library written in pure Gleam!
gleam add gleaph@1
import gleam/list
import gleaph as gp
pub fn main() -> Nil {
let graph = [
gp.new_node(0) |> gp.with_value("A")
gp.new_node(1) |> gp.with_value("B")
gp.new_node(2) |> gp.with_value("C")
]
|> list.fold(gp.new(), gp.add_node)
let graph = [
gp.new_edge(from: 0, to: 1) |> gp.with_relation(100)
gp.new_edge(from: 1, to: 2) |> gp.with_relation(200)
gp.new_edge(from: 2, to: 0) |> gp.with_relation(300)
] |> list.fold(graph, gp.add_edge)
}
Further documentation can be found at https://hexdocs.pm/gleaph.
Development
gleam run # Run the project
gleam test # Run the tests