Fix ElementMap capacity in FrozenGraph::edge_map

This commit is contained in:
2026-09-19 18:07:33 +02:00
parent 345dbc0d5d
commit 64c48287a7
+2 -1
View File
@@ -142,8 +142,9 @@ impl GraphTopology for FrozenGraph {
self.incidences.len() / 2 self.incidences.len() / 2
} }
// TODO: Find a way to reduce the needed capacity for the edge ElementMap. This could be improved by finding a small vertex cover and store those vertices first. See https://en.wikipedia.org/wiki/Vertex_cover#Approximate_evaluation
fn edge_map<T: Clone>(&self, default: T) -> ElementMap<Self::Edge, T> { fn edge_map<T: Clone>(&self, default: T) -> ElementMap<Self::Edge, T> {
ElementMap::new(default, |e| e.0, self.edge_count()) ElementMap::new(default, |e| e.0, self.incidences.len() - 1)
} }
fn degree(&self, v: Self::Vertex) -> usize { fn degree(&self, v: Self::Vertex) -> usize {