public static <V, E extends GEdge<V>> GDirectedGraph<V, E> toTree(GDirectedGraph<V, E> g,
			V root, Comparator<E> edgeComparator) {
		GraphToTreeAlgorithm<V, E> algorithm = new GraphToTreeAlgorithm<V, E>(g, edgeComparator);
		return algorithm.toTree(root);
	}
Converts a general directed graph into a tree graph with the given vertex as the root. It
does this by first doing a topological sort (which ignores back edges) and greedily accepting
the first incoming edge based on the sorted vertex order. 
@param <V> the vertex type
@param <E> the edge type
@param g the graph to be converted into a tree
@param root the vertex to be used as the root
@param edgeComparator provides a priority ordering of edges with higher priority edges 
getting first shot at claiming children for its sub-tree.
@return a graph with edges removed such that the graph is a tree.
Ghidra/Framework/Graph/src/main/java/ghidra/graph/GraphAlgorithms.java