Add GraphTopology::edges() and tests

This commit is contained in:
2026-05-05 22:54:33 +02:00
parent c589095737
commit 6e9867a65e
4 changed files with 97 additions and 29 deletions
+1 -1
View File
@@ -1,5 +1,4 @@
// TODO: Add functions to reserve memory for vertices and edges.
// TODO: Add iterator of all edges.
// TODO: Add iterator of incident edges for a vertex.
// TODO: Add finding incident vertices for an edge.
// TODO: Split out GraphTopologyAddition trait.
@@ -13,6 +12,7 @@ pub trait GraphTopology {
fn are_adjacent(&self, v1: Self::Vertex, v2: Self::Vertex) -> bool;
fn vertices(&self) -> impl Iterator<Item = Self::Vertex>;
fn neighbors(&self, v: Self::Vertex) -> impl Iterator<Item = Self::Vertex>;
fn edges(&self) -> impl Iterator<Item = Self::Edge>;
fn add_vertex(&mut self) -> Self::Vertex;
fn add_edge(&mut self, v1: Self::Vertex, v2: Self::Vertex) -> Self::Edge;
}