class GraphAlgorithms {

	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;
	}

	private  GraphAlgorithms();

}