Expand description
§Graaf
Functions and types for working with graphs
§Examples
use {
graaf::op::{
AddEdge,
Indegree,
Outdegree,
},
std::collections::HashSet,
};
let mut graph = [HashSet::new(), HashSet::new(), HashSet::new()];
graph.add_edge(0, 1);
graph.add_edge(0, 2);
graph.add_edge(1, 2);
assert_eq!(graph.indegree(0), 0);
assert_eq!(graph.indegree(1), 1);
assert_eq!(graph.indegree(2), 2);
assert_eq!(graph.outdegree(0), 2);
assert_eq!(graph.outdegree(1), 1);
assert_eq!(graph.outdegree(2), 0);Modules§
- Graph algorithms
- Operations on graphs Operations on graphs
- Types that represent graphs