class GraphAlgorithms {

	public static <V, E extends GEdge<V>> Set<V> getSources(GDirectedGraph<V, E> g) {

		Set<V> sources = new HashSet<>();
		Collection<V> vertices = g.getVertices();
		for (V v : vertices) {
			Collection<E> inEdges = g.getInEdges(v);
			if (inEdges.isEmpty()) {
				sources.add(v);
			}
		}

		return sources;
	}

	private  GraphAlgorithms();

}