talira

libgraph

Graph data structure library for Elixir, with a priority queue and DOT export

open sourceMITfree

libgraph is an Elixir library with a Graph data structure for directed and undirected graphs, built as a more idiomatic alternative to Erlang's :digraph: graphs are built and changed in a pipeline, and every query takes the graph as its first argument. It also includes a PriorityQueue tuned for graph algorithms, reducers for mapping over a graph, and a Serializer behaviour with a Graphviz DOT serializer built in. Install it from Hex as libgraph.

Problems it solves

  • model dependencies between items as a graph in my Elixir app
  • a graph data structure in Elixir nicer to use than :digraph
  • export my Elixir graph to Graphviz DOT

Features

  • directed and undirected graphs with an idiomatic Elixir API
  • PriorityQueue oriented towards graphs
  • reducers for mapping over a graph
  • Graphviz DOT serializer

Limitations

  • By default vertices are identified by a 32-bit hash, and a collision silently merges distinct vertices unless you pass a vertex_identifier1
  • Its tests don't yet fully cover undirected graphs, its author says1