Crates.io | easy_graph |
lib.rs | easy_graph |
version | 0.1.5 |
source | src |
created_at | 2020-03-03 06:33:29.083354 |
updated_at | 2020-03-06 06:46:10.340314 |
description | Data structure that represent generic vertices and undirected connections |
homepage | |
repository | https://github.com/F3kilo/easy_graph.git |
max_upload_size | |
id | 214794 |
size | 17,897 |
Easy rust realization of generic graph
Data structure that represent generic vertices and undirected connections
let verts = vec![0, 1, 2, 3, 4, 10];
let conns = vec![(0, 1), (1, 2), (2, 3), (3, 4), (10, 0), (4, 10)];
let graph = Graph::from_data(verts.into_iter(), conns.into_iter());
assert_eq!(verts.len(), graph.len());
let new_vertex = 15;
assert!(graph.add_vertex(new_vertex));
assert!(graph.contains(&new_vertex));
graph.add_edge(&1, &4);
assert!(graph.is_connected(&1, &4));
assert!(graph.is_connected(&4, &1));