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

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

		return sinks;
	}
Returns all sink vertices (those with no outgoing edges) in the graph.

@param g the graph
@return sink vertices
Ghidra/Framework/Graph/src/main/java/ghidra/graph/GraphAlgorithms.java