Add GraphTopology::incident_edges() and tests

This commit is contained in:
2026-05-13 10:59:38 +02:00
parent 384dca2d20
commit f862ac55ec
4 changed files with 185 additions and 1 deletions
+8
View File
@@ -130,6 +130,14 @@ impl GraphTopology for AppendGraph {
(0..self.incidences.len()).step_by(2).map(Incidence)
}
fn incident_edges(&self, v: Self::Vertex) -> impl Iterator<Item = Self::Edge> {
RawIncidenceIterator {
graph: self,
incidence: self.vertices[v.0].first_incidence,
}
.map(|(_, e)| e.normalize())
}
fn incidences(&self, v: Self::Vertex) -> impl Iterator<Item = (Self::Vertex, Self::Edge)> {
RawIncidenceIterator {
graph: self,