Assuming you have a variety, then the mesh boundary is those edges that belong to only one polygon. Edges that are not on the border will belong to two polygons. Boundary vertices are vertices that belong to the boundary edges.
A naive way to find boundary vertices is to iterate over all of your edges, count how many polygons they belong to, and if they belong to only one polygon, then collect the vertices of the edges as boundary vertices. However, you will have to remove duplicate vertices from your collection.
, , , . , , , , . , . .