private Graph traceTreeBackwards(GraphNode t) { GraphNode q; Graph out = new Graph(); while (t != null) { try { q = out.addNode(t.getObject(), t.getX(), t.getY(), t.getId()); data(q).setIncidentEdge(data(t).getIncidentEdge()); if (source != null) q.addEdge( source, data(source).getIncidentEdge().getWeight(), data(source).getIncidentEdge().getObject()); source = q; t = data(t).getPrev(); } catch (IdCollisionException e) { // can't happen unless this graph has collisions (impossible) } } return out; }