Snap `snap_from` to `snap_to`, and update all of `snap_from`s adjacencies
(
graph: &mut GeometryGraph<D>,
snap_from: NodeIndex<usize>,
snap_to: NodeIndex<usize>,
)
| 301 | |
| 302 | /// Snap `snap_from` to `snap_to`, and update all of `snap_from`s adjacencies |
| 303 | fn snap_graph_nodes<D>( |
| 304 | graph: &mut GeometryGraph<D>, |
| 305 | snap_from: NodeIndex<usize>, |
| 306 | snap_to: NodeIndex<usize>, |
| 307 | ) where |
| 308 | D: EdgeType, |
| 309 | { |
| 310 | debug_assert_ne!(snap_from, snap_to); |
| 311 | |
| 312 | let neighbors: Vec<_> = graph.neighbors(snap_from).collect(); |
| 313 | let mut neighbors_to_snap = Vec::new(); |
| 314 | for neighbor in neighbors { |
| 315 | // don't add a self-edge |
| 316 | if neighbor != snap_to { |
| 317 | graph.update_edge(snap_to, neighbor, ()); |
| 318 | if graph[neighbor].0 == graph[snap_from].0 { |
| 319 | neighbors_to_snap.push(neighbor); |
| 320 | } |
| 321 | } |
| 322 | } |
| 323 | graph[snap_from] = graph[snap_to]; |
| 324 | |
| 325 | for neighbor in neighbors_to_snap { |
| 326 | snap_graph_nodes(graph, neighbor, snap_to); |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | fn snap_graph_grid<D>(mut graph: GeometryGraph<D>, tolerance: f64) -> GeometryGraph<D> |
| 331 | where |
no outgoing calls
no test coverage detected