Refactor tests: use MakeTestGraph in model-specific tests, deconstruct vertex arrays where useful, adjust local variable names

This commit is contained in:
2026-09-04 09:28:00 +02:00
parent 016d127bd1
commit 4c6a8a43e4
11 changed files with 153 additions and 195 deletions
+6 -6
View File
@@ -101,14 +101,14 @@ pub trait GraphTopology {
/// Panics if `v` is not a valid vertex of this graph.
fn degree(&self, v: Self::Vertex) -> usize;
/// Returns `true` if there is at least one edge between `v1` and `v2`, and `false` otherwise.
/// Returns `true` if there is at least one edge between `u` and `v`, and `false` otherwise.
///
/// A vertex is adjacent to itself if and only if it has a loop edge.
///
/// # Panics
///
/// Panics if `v1` or `v2` is not a valid vertex of this graph.
fn are_adjacent(&self, v1: Self::Vertex, v2: Self::Vertex) -> bool;
/// Panics if `u` or `v` is not a valid vertex of this graph.
fn are_adjacent(&self, u: Self::Vertex, v: Self::Vertex) -> bool;
/// Returns an iterator over all vertices in the graph.
fn vertices(&self) -> impl Iterator<Item = Self::Vertex>;
@@ -206,12 +206,12 @@ pub trait GraphTopologyAddition: GraphTopology + Default {
/// Adds a new isolated vertex and returns its handle.
fn add_vertex(&mut self) -> Self::Vertex;
/// Adds a new edge between `v1` and `v2` and returns its handle.
/// Adds a new edge between `u` and `v` and returns its handle.
///
/// # Panics
///
/// Panics if `v1` or `v2` is not a valid vertex of this graph.
fn add_edge(&mut self, v1: Self::Vertex, v2: Self::Vertex) -> Self::Edge;
/// Panics if `u` or `v` is not a valid vertex of this graph.
fn add_edge(&mut self, u: Self::Vertex, v: Self::Vertex) -> Self::Edge;
}
/// A trait that adds deletion operations to an undirected graph topology.