public DirectedGraph[] getComponents() {
		Vertex u, v;
		Edge e;
		DirectedGraph g;
		Set<Vertex> accountedFor = new HashSet<>(this.numVertices());
		Set<Vertex> toDo = new HashSet<>(this.numVertices());
		List<DirectedGraph> components = new ArrayList<>();
		GraphIterator<Vertex> vertIter = this.vertexIterator();
		Iterator<Vertex> iter;
		int i;

		while (vertIter.hasNext()) {
			v = vertIter.next();
			if (!accountedFor.contains(v)) {
				//start a new graph grown out from v
				g = new DirectedGraph();
				toDo.add(v);
				while (!toDo.isEmpty()) {
					//get a vertex in toDo
					iter = toDo.iterator();
					if (iter.hasNext()) {
						u = iter.next();
						g.add(u);
						accountedFor.add(u);
						Edge[] incomingEdges = this.incomingEdges(u);
						for (i = 0; i < incomingEdges.length; i++) {
							e = incomingEdges[i];
							g.add(e);
							if (!accountedFor.contains(e.from())) {
								toDo.add(e.from());
							}
						}
						Edge[] outgoingEdges = this.outgoingEdges(u);
						for (i = 0; i < outgoingEdges.length; i++) {
							e = outgoingEdges[i];
							g.add(e);
							if (!accountedFor.contains(e.to())) {
								toDo.add(e.to());
							}
						}
						Edge[] selfEdges = this.selfEdges(u);
						for (i = 0; i < selfEdges.length; i++) {
							e = selfEdges[i];
							g.add(e);
						}
						toDo.remove(u);
					}
				}
				components.add(g);
			}
		}
		return components.toArray(new DirectedGraph[0]);
	}
Returns an array of directed graphs. Each array element is a 
DirectedGraph consisting of a single
connected component of this graph.
Ghidra/Framework/Generic/src/main/java/ghidra/util/graph/DirectedGraph.java