Get all neighbors (both incoming and outgoing connections)
(&self, node_id: &str)
| 258 | |
| 259 | /// Get all neighbors (both incoming and outgoing connections) |
| 260 | pub fn get_all_neighbors(&self, node_id: &str) -> Vec<&Node> { |
| 261 | let mut neighbors = Vec::new(); |
| 262 | |
| 263 | // Add outgoing neighbors |
| 264 | for edge in self.get_outgoing_edges(node_id) { |
| 265 | if let Some(node) = self.nodes.get(&edge.to_node) { |
| 266 | neighbors.push(node); |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | // Add incoming neighbors |
| 271 | for edge in self.get_incoming_edges(node_id) { |
| 272 | if let Some(node) = self.nodes.get(&edge.from_node) { |
| 273 | neighbors.push(node); |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | neighbors |
| 278 | } |
| 279 | |
| 280 | /// Remove a node and all its connected edges |
| 281 | pub fn remove_node(&mut self, node_id: &str) -> Result<Node, GraphError> { |
nothing calls this directly
no test coverage detected