Add EdgeMap and private generic EntityMap, update tests

This commit is contained in:
2026-05-07 16:03:17 +02:00
parent e074fdf944
commit 6fe3acb306
7 changed files with 375 additions and 140 deletions
+3 -1
View File
@@ -1,4 +1,4 @@
use crate::maps::VertexMap;
use crate::maps::{EdgeMap, VertexMap};
// TODO: Add functions to reserve memory for vertices and edges.
// TODO: Add iterator of incident edges for a vertex.
@@ -12,6 +12,8 @@ pub trait GraphTopology {
fn vertex_capacity(&self) -> usize;
fn vertex_map<T: Clone>(&self, default: T) -> VertexMap<Self::Vertex, T>;
fn edge_count(&self) -> usize;
fn edge_capacity(&self) -> usize;
fn edge_map<T: Clone>(&self, default: T) -> EdgeMap<Self::Edge, T>;
fn degree(&self, v: Self::Vertex) -> usize;
fn are_adjacent(&self, v1: Self::Vertex, v2: Self::Vertex) -> bool;
fn vertices(&self) -> impl Iterator<Item = Self::Vertex>;