Convert mesh to graph by merging nearby vertices during triangle processing
Instead of building adjacency after the whole mesh is processed, you can build it incrementally as you iterate through triangles.
1. For each triangle, create a small local graph of its 3 vertices (fully connected).
2. Clamp or round vertex positions to a fixed precision (e.g. 0.01 or 0.1 units) to handle float errors.
3. Use a hash table (keyed by clamped position) to cache vertices.
Key format can be a packed integer or a string fallback like "x_y_z".
4. When a new vertex reuses an existing key, merge it —
"steal" its existing connections and link the current triangle’s vertices to it.
This automatically stitches triangles together without needing a second pass.
This method builds the navigation graph in one pass, with automatic adjacency discovery, tolerance for float noise, and minimal overhead.