Iterate parent (reverse) edges of a vertex. Returns typed [`ParentEdge`] values. When `include_deleted` is true, deleted parent edges are included; otherwise they are filtered out. This is the typed replacement for [`iter_adjacent`](Self::iter_adjacent) with parent-edge flag ranges. New code should prefer this over `iter_adjacent`.
(
&self,
node: GraphNode<NodeId>,
include_deleted: bool,
)
| 240 | /// with parent-edge flag ranges. New code should prefer this over |
| 241 | /// `iter_adjacent`. |
| 242 | fn iter_parents( |
| 243 | &self, |
| 244 | node: GraphNode<NodeId>, |
| 245 | include_deleted: bool, |
| 246 | ) -> Result<Vec<ParentEdge>, PristineError> { |
| 247 | // Flag-range bounds: |
| 248 | // alive only → [0x20, 0x35] (PARENT ..= all()-DELETED) |
| 249 | // with deleted → [0x20, 0xB5] (PARENT ..= all()) |
| 250 | // |
| 251 | // The wider range may include forward-deleted edges (0x80–0x90) |
| 252 | // when include_deleted is true; the loop filters them out. |
| 253 | let min_flag = EdgeFlags::PARENT; |
| 254 | let max_flag = if include_deleted { |
| 255 | EdgeFlags::all() |
| 256 | } else { |
| 257 | EdgeFlags::all() - EdgeFlags::DELETED |
| 258 | }; |
| 259 | |
| 260 | let adj = self.iter_adjacent(node, min_flag, max_flag)?; |
| 261 | let mut result = Vec::new(); |
| 262 | for edge_result in adj { |
| 263 | let edge = edge_result?; |
| 264 | if !edge.flag().contains(EdgeFlags::PARENT) { |
| 265 | continue; |
| 266 | } |
| 267 | if let Some(parent) = ParentEdge::from_serialized(&edge) { |
| 268 | result.push(parent); |
| 269 | } |
| 270 | } |
| 271 | Ok(result) |
| 272 | } |
| 273 | } |