1 unstable release
new 0.1.0 | Jan 16, 2025 |
---|
#1062 in Data structures
109 downloads per month
Used in 3 crates
150KB
4K
SLoC
wolf-graph
By Wolf McNally
Status
A work in progress 🚧
Slender stem with fragile buds 🌱
Use at your own risk 🤷🏽♂️
Introduction
The wolf-graph
crate provides data structures and algorithms for working with graphs in Rust. It allows representing and manipulating various types of graphs including general graphs, directed acyclic graphs (DAGs), trees, and compound graphs. Graphs can be manipulated with reference semantics or value semantics.
Main Features
- Define graphs with generic node, edge and graph data associated with each element
- Supports directed and undirected graphs
- Provides mutable and immutable graph types with value semantics
- Includes specialized graph adapter types like DAG, Tree and Compound (a graph+tree structure)
- Provides graph query and traversal methods
- Includes basic algorithms like depth-first search, topological sort, and checking for cycles
- Serde support for easy serialization/deserialization
- Supports DOT (Graphviz) and Mermaid formats for visualization provided in the
wolf-graph-dot
andwolf-graph-mermaid
crates.
Main Components
- Traits defining functionality for visitable graphs, and mutable versions of each
- Concrete Graph, DAG, Tree and Compound types built on those traits
- Uses FUIDs (Friendly Unique Identifiers) for node and edge identifiers
- DFS Visitor trait and algorithm enabling custom traversals
- Algorithms for topological sort, cycle detection, and graph differences
- Errors and utility types
- Strong test coverage
Documentation
Currently the best documentation is the unit tests in the tests
directory.
Dependencies
~0.8–1.5MB
~31K SLoC