public static <V, E extends GEdge<V>> Set<E> retainEdges(GDirectedGraph<V, E> graph,
			Set<V> vertices) {

		//@formatter:off
		Collection<E> edges = graph.getEdges();
		Set<E> results = 
			edges.stream()
				 .filter(e -> vertices.contains(e.getStart()))
				 .filter(e -> vertices.contains(e.getEnd()))
				 .collect(Collectors.toSet())
				 ;
		//@formatter:on

		return results;
	}
Retain all edges in the graph where each edge's endpoints are in the given set of 
vertices. 

@param graph the graph
@param vertices the vertices of the edges to keep
@return the set of edges
Ghidra/Framework/Graph/src/main/java/ghidra/graph/GraphAlgorithms.java