protected static <V, E extends GEdge<V>> V unifySinks(MutableGDirectedGraphWrapper<V, E> graph,
			GraphNavigator<V, E> graphNavigator) {

		Set<V> sinks = graphNavigator.getSinks(graph);
		if (sinks.isEmpty()) {
			throw new IllegalArgumentException("The graph does not contain at least one sink node");
		}

		if (sinks.size() == 1) {
			return sinks.iterator().next();
		}

		// Turn the sinks into children of a single sink.
		V dummy = graph.addDummyVertex(DUMMY_SINK_NAME);
		sinks.forEach(s -> {

			if (graphNavigator.isTopDown()) {
				graph.addDummyEdge(s, dummy);
			}
			else {
				graph.addDummyEdge(dummy, s);
			}
		});
		return dummy;
	}
Converts multiple sink/exit nodes in a graph into a single sink of which those become
parents.

@param graph the graph
@param graphNavigator the navigator to determine graph direction
@return the new single sink
@throws IllegalArgumentException if there is not at least one sink node in the graph
Ghidra/Framework/Graph/src/main/java/ghidra/graph/algo/AbstractDominanceAlgorithm.java