btree_network

Crates.iobtree_network
lib.rsbtree_network
version0.2.3
sourcesrc
created_at2021-01-21 04:55:46.295821
updated_at2021-01-25 00:15:05.796584
descriptionA generic network (undirected graph) data structure.
homepagehttps://github.com/jameone/btree_network
repositoryhttps://github.com/jameone/btree_network
max_upload_size
id344743
size49,240
James Spears (jameone)

documentation

README

Binary Tree Network (btree_network)

CodeBuild Version badge Docs badge

This library is a minimal implementation of a network (abstract data structure) by way of a single binary tree map (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).

Example

use crate::BTreeNetwork;

fn main() {
    let mut network: BTreeNetwork<String> = BTreeNetwork::new();
    // Add nodes.
    network.add_vertex(String::from("Tarzan"));
    network.add_vertex(String::from("Jane"));
    // Add a relationship.
    network.add_edge(String::from("Tarzan"), String::from("Jane"));
    
    // Assert relationship now exists.
    assert!(network.adjacdent(String::from("Tarzan"), String::from("Jane")));
}

Usage

Add the following to your Cargo.toml file:

[dependencies]
btree_network = "0.2.3"

API

Please see the API for a full list of available methods.

License

This work is dually licensed under MIT OR Apache-2.0.

Commit count: 22

cargo fmt