title: How to find boundary of a graph?
body: <p>I would like to find the boundary of a graph which each vertex is given its 2D coordinate (x,y). The boundary path must be a closed polygon and cover most area. For example, in the figure, the boundary path would be: 1-2-3-4-1<a href="https://i.stack.imgur.com/h6Gyt.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/h6Gyt.jpg" alt="enter image description here"></a></p>
  
  <p>I can do this by firstly removing all dead ends, and then start from the most left node, then I will keep "turn right" until I end up with the start point. For example, after removing all dead ends (5,8,7) and continue removing dead end (6) I end up with nodes 1,2,3 and 4. After that, I start from the most left node, Node 1. I turn right to node 2. At node 2, I have 2 options: either go to node 3 or node 4. But I keep turning right, so I will go to node 3. At node 3 I only have an option to go to node 4. Similarly at node 4 I only have 1 option to go back to node 1. Since I end up with node 1. I conclude that the path is 1-2-3-4. </p>
  
  <p>However, I am wondering if there is a "magical" function in any existing graph theory libraries that can do it in an elegant way ? Thank you in advance.</p>
  
  <p>Tim</p>