Initial release #1

Merged
warrence merged 102 commits from dev into main 2026-06-30 10:26:52 +02:00
Showing only changes of commit 340fde2133 - Show all commits
+9 -6
View File
@@ -98,8 +98,8 @@ impl Graph {
vertex_header.first_incidence = next;
} else {
let graph: &Graph = self;
let mut incidence = self.vertices[source_vertex].first_incidence;
let (_, previous) = std::iter::from_fn(move || graph.step_incidence(&mut incidence))
let (_, previous) = self
.raw_incidences(source_vertex)
.find(|(_, f)| {
graph.incidences[*f]
.next
@@ -110,6 +110,11 @@ impl Graph {
}
}
fn raw_incidences(&self, v: Vertex) -> impl Iterator<Item = (VertexSlot, Edge)> {
let mut incidence = self.vertices[v].first_incidence;
std::iter::from_fn(move || self.step_incidence(&mut incidence))
}
fn step_incidence(&self, incidence: &mut Option<IncidenceSlot>) -> Option<(VertexSlot, Edge)> {
let current = (*incidence)?;
let e = self.incidences.get_idx(current.0).unwrap();
@@ -171,8 +176,7 @@ impl GraphTopology for Graph {
}
fn adjacent_vertices(&self, v: Self::Vertex) -> impl Iterator<Item = Self::Vertex> {
let mut incidence = self.vertices[v].first_incidence;
std::iter::from_fn(move || self.step_incidence(&mut incidence))
self.raw_incidences(v)
.map(|(vs, _)| self.vertices.get_idx(vs.0).unwrap())
}
@@ -197,8 +201,7 @@ impl GraphTopology for Graph {
}
fn incidences(&self, v: Self::Vertex) -> impl Iterator<Item = (Self::Vertex, Self::Edge)> {
let mut incidence = self.vertices[v].first_incidence;
std::iter::from_fn(move || self.step_incidence(&mut incidence))
self.raw_incidences(v)
.map(|(vs, e)| (self.vertices.get_idx(vs.0).unwrap(), self.normalize_edge(e)))
}