Any way to find neighboring vertices of a vertex?

As the question states is there any efficient way to find neighboring vertices of a single vertex?

My meshes have vertex count of around 8000 and I can’t decimate them anymore because they are being used for medical visualization and anymore decimation will make them look really bad.

So back to the point, any proper way to detect neighbors? I would appreciate any suggestion.

Tried google?

The first 3 relevant results:

The short answer is: no. First you have to make clear what you mean by neighboring. Just vertices close to each other without any other vertices in between, or just vertices that are connected by a triangle edge? Next keep in mind that a mesh could have duplicated vertices. Should they count as one vertex?

Finding all neighbors for all vertices is an O(n²) operation. However this information could be stored in a datastructure. Quick and dirty an array of lists of integers (List<int>[]) Now add a List for each vertex in your mesh. So the index into the array will match with the vertex index. The corresponding list can be filled with the neighbor vertices. So you can simply look up the neighbors for a certain vertex.