lgl 0.1.1

Small directed graph library https://github.com/lwander/lgl
Documentation
  • Coverage
  • 87.5%
    7 out of 8 items documented0 out of 6 items with examples
  • Size
  • Source code size: 16.67 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.37 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • lwander

lgl

Small graph library written in Rust.

Motivation

I read that writing a graph library in Rust is difficult do Rust's builtin ownership and borrowing, since each vertex can be referenced by an arbitrary number of other vertices. So I figured I'd give it a shot to learn the language. Plus, this will hopefully serve as a useful utility for compiler writing in Rust later on.

Usage

let d1 = 1;
let d2 = 2;

let mut g = DirectedGraph::new();

g.add_vertex(&d1);
g.add_vertex(&d2);

g.add_edge(&d1, &d2);

let neighbors = g.neighbors(&d1);

assert!(g.is_edge(&d1, &d2));
assert!(!g.is_edge(&d2, &d1));
assert!(neighbors.contains(&d2));

Testing

$ cargo test