graph

Package Version Hex Docs Supports all targets

A package for working with graphs in Gleam!

While the package already exposes all functions you might need to implement complex graphs algorithms, it might still be missing some crucial functions to provide a pleasant developer experience working with graphs.

This is still a work in progress and I’m trying to figure out the best API to expose, so if you think something is missing, please open an issue!

gleam add graph
import graph

pub fn main() {
  let my_graph =
    graph.new()
    |> graph.insert_node(1, "one node")
    |> graph.insert_node(2, "other node")
    |> graph.insert_directed_edge("edge label", from: 1, to: 2)

  my_graph |> graph.has_edge(from: 1, to: 2)
  // -> True

  my_graph |> graph.has_edge(from: 2, to: 1)
  // -> False
}
Search Document