Update todos

This commit is contained in:
2025-10-11 21:44:20 +02:00
parent 66e1498c76
commit a4ed7ea44e
+3 -3
View File
@@ -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. // TODO: Vertex value must not be public.
#[derive(Copy, Clone, PartialEq, Eq, Debug)] #[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub struct Vertex(pub usize); pub struct Vertex(pub usize);
@@ -14,7 +13,10 @@ pub struct VertexIncidenceHeader {
pub first_incidence: Option<Incidence>, pub first_incidence: Option<Incidence>,
} }
// 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: 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 { pub struct Graph {
// TODO: Index 'incidence_headers' by a 'Vertex' instead of 'Vertex.0'? // TODO: Index 'incidence_headers' by a 'Vertex' instead of 'Vertex.0'?
pub incidence_headers: Vec<VertexIncidenceHeader>, pub incidence_headers: Vec<VertexIncidenceHeader>,
@@ -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. // TODO: 'fn add_vertex()' needs variants for custom vertex data.
pub fn add_vertex(&mut self) -> Vertex { pub fn add_vertex(&mut self) -> Vertex {
self.incidence_headers.push(VertexIncidenceHeader { self.incidence_headers.push(VertexIncidenceHeader {
@@ -72,7 +73,6 @@ impl Graph {
Vertex(self.incidence_headers.len() - 1) 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. // TODO: 'fn add_edge()' needs variants for custom edge data.
pub fn add_edge(&mut self, v1: Vertex, v2: Vertex) { pub fn add_edge(&mut self, v1: Vertex, v2: Vertex) {
self.add_incidence(v1, v2); self.add_incidence(v1, v2);