Extracting the boundary of a 2D graph

Given a 2D finite element mesh, we wish to determine the boundary nodes and edges using simple graph operations.
Using networkx, the following code builds the graph and then extracts the boundary edges:

import networkx as nx
#Use a MultiGraph to allow parallel edges
G = nx.MultiGraph()
#Each element is a cycle
G.add_edges_from([(1,2),(2,6),(6,5),(5,1)])
G.add_edges_from([(2,3),(3,7),(7,6),(6,2)])
G.add_edges_from([(3,4),(4,8),(8,7),(7,3)])
G.add_edges_from([(5,6),(6,10),(10,9),(9,5)])
G.add_edges_from([(6,7),(7,11),(11,10),(10,6)])
G.add_edges_from([(7,8),(8,12),(12,11),(11,7)])
# Create a boundary graph
G_boundary = nx.Graph()
for v1,v2 [...]