Usually if a vertex can be shared most modelling tools will share it. So in case of a simple quad you should have 4 vertices and 6 triangle indices (2 * 3 == 2 triangles). Two of the vertices will be shared. However in most cases when it comes to more complex models vertices need to be split because they aren’t equal in each detail.
A vertex is made up by:
the position
the vertex normal vector
texture coodinates (UV)
vertex color
vertex tangent
If any of those things have to be different for an adjacent triangle, the vertices can’t be shared since they are different. For example a cube has 24 vertices instead of 8 because each “face” / quad will need different UVs and much more important a unique normal. At each corner of the cube you will have 3 vertices at the same position but with 3 different normals so they can’t be shared since they are not the same.
If you just want to find vertices which shared the same position you have to iterate through the vertices array, there’s no way around that since the vertices are not connected in any way.