Selecting a Mesh Perimeter

I have been trying to figure ot a way to select the perimeter of a mesh object.

Basically I am working with a topographical model of an island that I have cut out of a heaviily subdivided mesh. I need to extrude the perimeter of this mesh as a next step.

I am wondering if anyone has any suggestions for automating the selection of the vertices and edges that make up this perimeter.

EditMode SHIFT+M

You may use this great python script
it select perimeter of MAT-frontierss or VertexGroup-Frontiers