Add docs for MakeTestGraph generator methods

This commit is contained in:
2026-10-16 20:23:58 +02:00
parent 3fb3e67e8e
commit f41b77903f
+13
View File
@@ -5,6 +5,7 @@ use crate::models::{AppendGraph, FrozenGraph};
use crate::traits::{GraphTopology, GraphTopologyAddition, GraphTopologyConversion, Incidence};
pub trait MakeTestGraph: GraphTopology + Sized {
/// Returns a versatile, pre-defined standard test graph.
// Since this is only a test fixture, the complex return type here is deemed acceptable.
#[allow(clippy::type_complexity)]
fn standard() -> (
@@ -14,20 +15,32 @@ pub trait MakeTestGraph: GraphTopology + Sized {
[Vec<Incidence<Self::Vertex, Self::Edge>>; 10],
);
/// Returns an empty graph.
fn empty() -> Self;
/// Returns a graph with a single vertex and no edges.
fn single_vertex() -> (Self, Self::Vertex);
/// Returns a graph with two vertices connected by a single edge.
fn single_edge() -> (Self, [Self::Vertex; 2], Self::Edge);
/// Returns a graph with vertices *v0*, *v1*, and *v2*, where *v0* is isolated, and the other
/// two are connected by a single edge.
fn disconnected() -> (Self, [Self::Vertex; 3]);
/// Returns a graph with a single vertex that has a single loop edge.
fn loop_edge() -> (Self, Self::Vertex, Self::Edge);
/// Returns a graph with two vertices that are connected by `K` multi-edges.
fn multiple_edges<const K: usize>() -> (Self, [Self::Vertex; 2], [Self::Edge; K]);
/// Returns a graph that is a path with three vertices and two edges between them, returned in
/// order.
fn two_edge_path() -> (Self, [Self::Vertex; 3], [Self::Edge; 2]);
/// Returns a graph that is a path with three vertices *v0*, *v1*, and *v2*, and two edges
/// *e0 = (v0, v1)* and *e1 = (v1, v2)* between them, and two loops on the first two vertices
/// *e2 = (v0, v0)* and *e3 = (v1, v1)*.
fn two_edge_path_with_loops() -> (Self, [Self::Vertex; 3], [Self::Edge; 4]);
}