@SuppressWarnings({ "rawtypes", "unchecked" })
	@Override
	public GDirectedGraph<V, E> emptyCopy() {

		if (delegate instanceof GDirectedGraph) {
			return ((GDirectedGraph) delegate).emptyCopy();
		}

		Class<? extends Graph> clazz = delegate.getClass();

		try {
			Constructor<? extends Graph> constructor = clazz.getConstructor((Class<?>[]) null);
			Graph newGraph = constructor.newInstance((Object[]) null);
			return new JungToGDirectedGraphAdapter(newGraph);
		}
		catch (Exception e) {
			// shouldn't happen
			Msg.showError(this, null, "Error Creating Graph",
				"Unable to create a new instance of graph: " + clazz, e);
			return null;
		}
	}
A class that turns a {@link Graph} into a {@link GDirectedGraph}.

@param <V> the vertex type
@param <E> the edge type
Ghidra/Framework/Graph/src/main/java/ghidra/graph/jung/JungToGDirectedGraphAdapter.java