Add VertexMap to attach data to vertices

This commit is contained in:
2026-05-06 20:28:00 +02:00
parent 6e9867a65e
commit f40c03b113
6 changed files with 168 additions and 54 deletions
+4
View File
@@ -1,3 +1,5 @@
use crate::maps::VertexMap;
// TODO: Add functions to reserve memory for vertices and edges.
// TODO: Add iterator of incident edges for a vertex.
// TODO: Add finding incident vertices for an edge.
@@ -8,6 +10,8 @@ pub trait GraphTopology {
fn vertex_count(&self) -> usize;
fn edge_count(&self) -> usize;
fn vertex_capacity(&self) -> usize;
fn vertex_map<T: Clone>(&self, default: T) -> VertexMap<Self::Vertex, 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>;