Release 0.3.0 #8
@@ -37,6 +37,8 @@ impl<G: GraphTopologyAddition> MakeTestGraph for G {
|
||||
[Vec<Incidence<Self::Vertex, Self::Edge>>; 10],
|
||||
) {
|
||||
let mut graph = Self::default();
|
||||
graph.reserve_vertices(10);
|
||||
graph.reserve_edges(18);
|
||||
let vertices = core::array::from_fn(|_| graph.add_vertex());
|
||||
let edges = [
|
||||
(vertices[0], vertices[1]),
|
||||
@@ -121,6 +123,7 @@ impl<G: GraphTopologyAddition> MakeTestGraph for G {
|
||||
|
||||
fn single_edge() -> (Self, [Self::Vertex; 2], Self::Edge) {
|
||||
let mut graph = Self::default();
|
||||
graph.reserve_vertices(2);
|
||||
let vertices = core::array::from_fn(|_| graph.add_vertex());
|
||||
let e = graph.add_edge(vertices[0], vertices[1]);
|
||||
(graph, vertices, e)
|
||||
@@ -128,6 +131,7 @@ impl<G: GraphTopologyAddition> MakeTestGraph for G {
|
||||
|
||||
fn disconnected() -> (Self, [Self::Vertex; 3]) {
|
||||
let mut graph = Self::default();
|
||||
graph.reserve_vertices(3);
|
||||
let vertices = core::array::from_fn(|_| graph.add_vertex());
|
||||
graph.add_edge(vertices[1], vertices[2]);
|
||||
(graph, vertices)
|
||||
@@ -142,6 +146,8 @@ impl<G: GraphTopologyAddition> MakeTestGraph for G {
|
||||
|
||||
fn multiple_edges<const K: usize>() -> (Self, [Self::Vertex; 2], [Self::Edge; K]) {
|
||||
let mut graph = Self::default();
|
||||
graph.reserve_vertices(2);
|
||||
graph.reserve_edges(K);
|
||||
let vertices = core::array::from_fn(|_| graph.add_vertex());
|
||||
let edges = core::array::from_fn(|_| graph.add_edge(vertices[0], vertices[1]));
|
||||
(graph, vertices, edges)
|
||||
@@ -149,6 +155,8 @@ impl<G: GraphTopologyAddition> MakeTestGraph for G {
|
||||
|
||||
fn two_edge_path() -> (Self, [Self::Vertex; 3], [Self::Edge; 2]) {
|
||||
let mut graph = Self::default();
|
||||
graph.reserve_vertices(3);
|
||||
graph.reserve_edges(2);
|
||||
let vertices = core::array::from_fn(|_| graph.add_vertex());
|
||||
let edges = core::array::from_fn(|i| graph.add_edge(vertices[i], vertices[i + 1]));
|
||||
(graph, vertices, edges)
|
||||
@@ -156,6 +164,8 @@ impl<G: GraphTopologyAddition> MakeTestGraph for G {
|
||||
|
||||
fn two_edge_path_with_loops() -> (Self, [Self::Vertex; 3], [Self::Edge; 4]) {
|
||||
let mut graph = Self::default();
|
||||
graph.reserve_vertices(3);
|
||||
graph.reserve_edges(4);
|
||||
let vertices = core::array::from_fn(|_| graph.add_vertex());
|
||||
// Path edges.
|
||||
let e0 = graph.add_edge(vertices[0], vertices[1]);
|
||||
|
||||
Reference in New Issue
Block a user