This library is a minimal implementation of a graph
(abstract data structure) by way of two binary tree maps
(BTreeMap
). This implementation is often referred to as
an adjacency list.
The primary goals of this implementation are to be
minimal and idiomatic to the Rust language. The alloc
crate is the only dependency when compiled with default
features and is not optional. As one might assume, alloc
is required for reason the implementation relies on BTreeMap
(and the BTreeSet
wrapper).
Secondary concerns include serialization,
deserialization, and encoding. For these the serde
,
serde_json
, serde_yaml
, and serde_cbor
crates
are included and available under the feature flags:
serde
, serde_json
, serde_yaml
, and serde_cbor
.
Please see the encoding module's API
for the available optional trait definitions. Note: using
serde_json
, serde_yaml
, or serde_cbor
features will
require inclusion of the serde
feature, else the library
will not compile.
```rust use crate::BTreeGraph;
fn main() {
let mut graph: BTreeGraph
// Assert relationship now exists.
assert!(graph.adjacdent(String::from("Tarzan"), String::from("Jane")));
} ```
Add the following to your Cargo.toml
file:
toml
[dependencies]
btree_graph = "0.1.3"
Please see the API for a full list of available methods.
This work is dually licensed under MIT OR Apache-2.0.