public static <V, E extends GEdge<V>> GDirectedGraph<V, E> createSubGraph(
			GDirectedGraph<V, E> g, Collection<V> vertices) {

		vertices = CollectionUtils.asSet(vertices); // ensure fast lookup

		GDirectedGraph<V, E> subGraph = g.emptyCopy();

		for (E e : g.getEdges()) {
			V start = e.getStart();
			V end = e.getEnd();
			if (vertices.contains(start) && vertices.contains(end)) {
				subGraph.addEdge(e);
			}
		}
		return subGraph;
	}
Creates a subgraph of the given graph for each edge of the given graph that is 
contained in the list of vertices.

@param g the existing graph
@param vertices the vertices to be in the new graph
@return the new subgraph
Ghidra/Framework/Graph/src/main/java/ghidra/graph/GraphAlgorithms.java