libgraph
libgraph is a Rust crate providing a generic graph data structure and fundamental graph algorithms. It supports undirected graphs with optional metadata associated with edges, and includes various graph generation methods as well as common traversal algorithms like Depth-First Search.
Features
- Generic Graph Structure:
Graph<Metadata>allows associating custom data with edges. - Flexible Edge Handling: Add edges with or without metadata, check for existence, and retrieve metadata.
- Graph Generators: Create Hamiltonian cycles, minimum spanning trees, full (complete) graphs, and random graphs with specified density.
- Depth-First Search (DFS): Traverse graphs with a customizable visitor function.
- Tree Traversal: Specialized traversal for tree structures with a customizable visitor function.
Usage
Here's a simple example of creating a graph and performing a DFS:
use dfs;
use Graph;
use Vertex;
use StdRng;
use SeedableRng;
Dependencies
This crate depends on:
itertoolsrandserde
License
This project is licensed under the MIT License. See the LICENSE file for details.