I've got a graph and an iterator object gives me all its nodes according to a depth first search.

The source code looks like this:

DepthFirstIterator dfit = new DepthFirstIterator(graph);
while(dfit.hasNext()) {
// ???

I want to create another graph object inside the while loop. How should I treat the graph nodes which come from "dfit.next()"? Do I need a stack?
Simply copying the graph isn't possible, because the two graphs must come from two different libraries (JGraphT (origin) and Prefuse (target)).

All I can do additionally is to check whether two nodes in the origin are connected.

I'd appreciate any help!