public Rectangle2D getBounds(Graphics2D g2){
        Rectangle2D r = null;
        for (int i = 0; i < nodes.size(); i++){
            Node n = (Node) nodes.get(i);
            Rectangle2D b = n.getBounds();
            if (r == null) r = b;
            else r.add(b);
        }
        for (int i = 0; i < edges.size(); i++){
            Edge e = (Edge) edges.get(i);
            r.add(e.getBounds(g2));
        }
        for (int i = 0; i < labels.size(); i++){
            PSTLabel label = (PSTLabel) labels.get(i);
            Rectangle2D b = label.getBounds();
            if(r == null) r = b;
            else r.add(b);
        }
        return r == null ? new Rectangle2D.Double() : r;
    }