From a4ed7ea44e618683633a22e91ec8d171393bd027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20M=C3=BCller?= Date: Sat, 11 Oct 2025 21:44:20 +0200 Subject: [PATCH] Update todos --- src/models.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/models.rs b/src/models.rs index 96ef011..e54ba13 100644 --- a/src/models.rs +++ b/src/models.rs @@ -1,4 +1,3 @@ -// TODO: Vertex (and Incidence?) should be references of Graph data, not plain indices into the internal (Vec) data structures. // TODO: Vertex value must not be public. #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub struct Vertex(pub usize); @@ -14,7 +13,10 @@ pub struct VertexIncidenceHeader { pub first_incidence: Option, } +// TODO: Graph cannot support deleting vertices because of the external indices "Vertex". They could be made stable with e.g. slotmap or generational arena. // TODO: Graph fields must not be public. +// TODO: Add functions to reserve memory for vertices and edges. +// TODO: Add function to delete edges. pub struct Graph { // TODO: Index 'incidence_headers' by a 'Vertex' instead of 'Vertex.0'? pub incidence_headers: Vec, @@ -62,7 +64,6 @@ impl Graph { } } - // TODO: 'fn add_vertex()' should not be publicly accessible for all graph implementations. // TODO: 'fn add_vertex()' needs variants for custom vertex data. pub fn add_vertex(&mut self) -> Vertex { self.incidence_headers.push(VertexIncidenceHeader { @@ -72,7 +73,6 @@ impl Graph { Vertex(self.incidence_headers.len() - 1) } - // TODO: 'fn add_edge()' should not be publicly accessible for all graph implementations. // TODO: 'fn add_edge()' needs variants for custom edge data. pub fn add_edge(&mut self, v1: Vertex, v2: Vertex) { self.add_incidence(v1, v2);