Skip to content
Simple but powerful graph data-structure library for Rust
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Ran formatter and bumped version to v0.2.2 Mar 24, 2019
.gitignore Added travis Mar 14, 2019
.travis.yml refractor benchmarks Mar 21, 2019
Cargo.lock completed benchmarks Mar 22, 2019
Cargo.toml Ran formatter and bumped version to v0.2.2 Mar 24, 2019
LICENSE.txt Initial commit Mar 14, 2019 Updated README Mar 15, 2019


Build Status Latest Version Documentation

Graphlib is a simple and powerful rust library for the graph data-structure.

This library attempts to provide a generic api for building, mutating and iterating over graphs that is similar to that of other data-structures found in Rust i.e. Vec, HashMap, VecDeque, etc.

Using Graphlib

use graphlib::Graph;

let mut graph: Graph<usize> = Graph::new();

// Add two vertices to the graph
let id1 = graph.add_vertex(1);
let id2 = graph.add_vertex(2);

// Add an edge between the two vertices
graph.add_edge(&id1, &id2);

assert_eq!(*graph.fetch(&id1).unwrap(), 1);
assert_eq!(*graph.fetch(&id2).unwrap(), 2);

// The graph has 2 vertices and one edge at this point
assert_eq!(graph.vertex_count(), 2);
assert_eq!(graph.edge_count(), 1);

// Remove one of the connected vertices

assert_eq!(graph.vertex_count(), 1);
assert_eq!(graph.edge_count(), 0);


We welcome anyone wishing to contribute to Graphlib! Check out the issues section of the repository before starting out.


Graphlib is licensed under the MIT license.

You can’t perform that action at this time.