In graphToEps(), nodes may have different shapes (circles or squares).
2 * src/lemon/graph_to_eps.h - Part of LEMON, a generic C++ optimization library
4 * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
5 * (Egervary Combinatorial Optimization Research Group, EGRES).
7 * Permission to use, modify and distribute this software is granted
8 * provided that this copyright notice appears in all copies. For
9 * precise terms see the accompanying LICENSE file.
11 * This software is provided "AS IS" with no warranty of any kind,
12 * express or implied, and with no claim as to its suitability for any
17 #ifndef LEMON_GRAPH_TO_EPS_H
18 #define LEMON_GRAPH_TO_EPS_H
27 #include<lemon/maps.h>
28 #include<lemon/bezier.h>
32 ///\brief Simple graph drawer
34 ///\author Alpar Juttner
38 ///Data structure representing RGB colors.
40 ///Data structure representing RGB colors.
46 ///Default constructor
49 Color(double r,double g,double b) :_r(r),_g(g),_b(b) {};
50 ///Returns the red component
51 double getR() {return _r;}
52 ///Returns the green component
53 double getG() {return _g;}
54 ///Returns the blue component
55 double getB() {return _b;}
56 ///Set the color components
57 void set(double r,double g,double b) { _r=r;_g=g;_b=b; };
60 ///Default traits class of \ref GraphToEps
62 ///Default traits class of \ref GraphToEps
64 ///\c G is the type of the underlying graph.
66 struct DefaultGraphToEpsTraits
69 typedef typename Graph::Node Node;
70 typedef typename Graph::NodeIt NodeIt;
71 typedef typename Graph::Edge Edge;
72 typedef typename Graph::EdgeIt EdgeIt;
73 typedef typename Graph::InEdgeIt InEdgeIt;
74 typedef typename Graph::OutEdgeIt OutEdgeIt;
81 ConstMap<typename Graph::Node,xy<double> > _coords;
82 ConstMap<typename Graph::Node,double > _nodeSizes;
83 ConstMap<typename Graph::Node,int > _nodeShapes;
85 ConstMap<typename Graph::Node,Color > _nodeColors;
86 ConstMap<typename Graph::Edge,Color > _edgeColors;
88 ConstMap<typename Graph::Edge,double > _edgeWidths;
90 double _edgeWidthScale;
93 double _xBorder, _yBorder;
95 double _nodeBorderQuotient;
98 double _arrowLength, _arrowWidth;
100 bool _showNodes, _showEdges;
102 bool _enableParallel;
106 ConstMap<typename Graph::Node,bool > _nodeTexts;
107 double _nodeTextSize;
109 bool _showNodePsText;
110 ConstMap<typename Graph::Node,bool > _nodePsTexts;
111 char *_nodePsTextsPreamble;
114 bool _pleaseRemoveOsStream;
118 ///\param _g is a reference to the graph to be printed
119 ///\param _os is a reference to the output stream.
120 ///\param _os is a reference to the output stream.
121 ///\param _pros If it is \c true, then the \c ostream referenced by \c _os
122 ///will be explicitly deallocated by the destructor.
123 ///By default it is <tt>std::cout</tt>
124 DefaultGraphToEpsTraits(const G &_g,std::ostream& _os=std::cout,
127 _coords(xy<double>(1,1)), _nodeSizes(1.0), _nodeShapes(0),
128 _nodeColors(Color(1,1,1)), _edgeColors(Color(0,0,0)),
129 _edgeWidths(1), _edgeWidthScale(0.3),
130 _nodeScale(1.0), _xBorder(10), _yBorder(10), _scale(1.0),
131 _nodeBorderQuotient(.1),
132 _drawArrows(false), _arrowLength(1), _arrowWidth(0.3),
133 _showNodes(true), _showEdges(true),
134 _enableParallel(false), _parEdgeDist(1),
135 _showNodeText(false), _nodeTexts(false), _nodeTextSize(1),
136 _showNodePsText(false), _nodePsTexts(false), _nodePsTextsPreamble(0),
138 _pleaseRemoveOsStream(_pros) {}
141 ///Helper class to implement the named parameters of \ref graphToEps()
143 ///Helper class to implement the named parameters of \ref graphToEps()
144 ///\todo Is 'helper class' a good name for this?
146 template<class T> class GraphToEps : public T
148 typedef typename T::Graph Graph;
149 typedef typename Graph::Node Node;
150 typedef typename Graph::NodeIt NodeIt;
151 typedef typename Graph::Edge Edge;
152 typedef typename Graph::EdgeIt EdgeIt;
153 typedef typename Graph::InEdgeIt InEdgeIt;
154 typedef typename Graph::OutEdgeIt OutEdgeIt;
158 enum NodeShapes { CIRCLE=0, SQUARE=1 };
163 edgeLess(const Graph &_g) : g(_g) {}
164 bool operator()(Edge a,Edge b) const
166 Node ai=min(g.source(a),g.target(a));
167 Node aa=max(g.source(a),g.target(a));
168 Node bi=min(g.source(b),g.target(b));
169 Node ba=max(g.source(b),g.target(b));
171 (ai==bi && (aa < ba ||
172 (aa==ba && ai==g.source(a) && bi==g.target(b))));
175 bool isParallel(Edge e,Edge f) const
177 return (g.source(e)==g.source(f)&&g.target(e)==g.target(f))||
178 (g.source(e)==g.target(f)&&g.target(e)==g.source(f));
180 static xy<double> rot(xy<double> v)
182 return xy<double>(v.y,-v.x);
185 static std::string psOut(const xy &p)
187 std::ostringstream os;
188 os << p.x << ' ' << p.y;
193 GraphToEps(const T &t) : T(t), dontPrint(false) {};
195 template<class X> struct CoordsTraits : public T {
197 CoordsTraits(const T &t,const X &x) : T(t), _coords(x) {}
199 ///Sets the map of the node coordinates
201 ///Sets the map of the node coordinates.
202 ///\param x must be a node map with xy<double> or xy<int> values.
203 template<class X> GraphToEps<CoordsTraits<X> > coords(const X &x) {
205 return GraphToEps<CoordsTraits<X> >(CoordsTraits<X>(*this,x));
207 template<class X> struct NodeSizesTraits : public T {
209 NodeSizesTraits(const T &t,const X &x) : T(t), _nodeSizes(x) {}
211 ///Sets the map of the node sizes
213 ///Sets the map of the node sizes
214 ///\param x must be a node map with \c double (or convertible) values.
215 template<class X> GraphToEps<NodeSizesTraits<X> > nodeSizes(const X &x)
218 return GraphToEps<NodeSizesTraits<X> >(NodeSizesTraits<X>(*this,x));
220 template<class X> struct NodeShapesTraits : public T {
221 const X &_nodeShapes;
222 NodeShapesTraits(const T &t,const X &x) : T(t), _nodeShapes(x) {}
224 ///Sets the map of the node shapes
226 ///Sets the map of the node shapes
227 ///\param x must be a node map with \c int (or convertible) values.
228 ///\todo Incomplete doc.
229 template<class X> GraphToEps<NodeShapesTraits<X> > nodeShapes(const X &x)
232 return GraphToEps<NodeShapesTraits<X> >(NodeShapesTraits<X>(*this,x));
234 template<class X> struct NodeTextsTraits : public T {
236 NodeTextsTraits(const T &t,const X &x) : T(t), _nodeTexts(x) {}
238 ///Sets the text printed on the nodes
240 ///Sets the text printed on the nodes
241 ///\param x must be a node map with type that can be pushed to a standard
243 template<class X> GraphToEps<NodeTextsTraits<X> > nodeTexts(const X &x)
247 return GraphToEps<NodeTextsTraits<X> >(NodeTextsTraits<X>(*this,x));
249 template<class X> struct NodePsTextsTraits : public T {
250 const X &_nodePsTexts;
251 NodePsTextsTraits(const T &t,const X &x) : T(t), _nodePsTexts(x) {}
253 ///Inserts a PostScript block to the nodes
255 ///With this command it is possible to insert a verbatim PostScript
256 ///block to the nodes.
257 ///The PS current point will be moved to the centre of the node before
258 ///the PostScript block inserted.
260 ///Before and after the block a newline character is inserted to you
261 ///don't have to bother with the separators.
263 ///\param x must be a node map with type that can be pushed to a standard
266 ///\sa nodePsTextsPreamble()
267 ///\todo Offer the choise not to move to the centre but pass the coordinates
268 ///to the Postscript block inserted.
269 template<class X> GraphToEps<NodePsTextsTraits<X> > nodePsTexts(const X &x)
272 _showNodePsText=true;
273 return GraphToEps<NodePsTextsTraits<X> >(NodePsTextsTraits<X>(*this,x));
275 template<class X> struct EdgeWidthsTraits : public T {
276 const X &_edgeWidths;
277 EdgeWidthsTraits(const T &t,const X &x) : T(t), _edgeWidths(x) {}
279 ///Sets the map of the edge widths
281 ///Sets the map of the edge widths
282 ///\param x must be a edge map with \c double (or convertible) values.
283 template<class X> GraphToEps<EdgeWidthsTraits<X> > edgeWidths(const X &x)
286 return GraphToEps<EdgeWidthsTraits<X> >(EdgeWidthsTraits<X>(*this,x));
289 template<class X> struct NodeColorsTraits : public T {
290 const X &_nodeColors;
291 NodeColorsTraits(const T &t,const X &x) : T(t), _nodeColors(x) {}
293 ///Sets the map of the node colors
295 ///Sets the map of the node colors
296 ///\param x must be a node map with \ref Color values.
297 template<class X> GraphToEps<NodeColorsTraits<X> >
298 nodeColors(const X &x)
301 return GraphToEps<NodeColorsTraits<X> >(NodeColorsTraits<X>(*this,x));
303 template<class X> struct EdgeColorsTraits : public T {
304 const X &_edgeColors;
305 EdgeColorsTraits(const T &t,const X &x) : T(t), _edgeColors(x) {}
307 ///Sets the map of the edge colors
309 ///Sets the map of the edge colors
310 ///\param x must be a edge map with \ref Color values.
311 template<class X> GraphToEps<EdgeColorsTraits<X> >
312 edgeColors(const X &x)
315 return GraphToEps<EdgeColorsTraits<X> >(EdgeColorsTraits<X>(*this,x));
317 ///Sets a global scale factor for node sizes
319 ///Sets a global scale factor for node sizes
321 GraphToEps<T> &nodeScale(double d) {_nodeScale=d;return *this;}
322 ///Sets a global scale factor for edge widths
324 ///Sets a global scale factor for edge widths
326 GraphToEps<T> &edgeWidthScale(double d) {_edgeWidthScale=d;return *this;}
327 ///Sets a global scale factor for the whole picture
329 ///Sets a global scale factor for the whole picture
331 GraphToEps<T> &scale(double d) {_scale=d;return *this;}
332 ///Sets the width of the border around the picture
334 ///Sets the width of the border around the picture
336 GraphToEps<T> &border(double b) {_xBorder=_yBorder=b;return *this;}
337 ///Sets the width of the border around the picture
339 ///Sets the width of the border around the picture
341 GraphToEps<T> &border(double x, double y) {
342 _xBorder=x;_yBorder=y;return *this;
344 ///Sets whether to draw arrows
346 ///Sets whether to draw arrows
348 GraphToEps<T> &drawArrows(bool b=true) {_drawArrows=b;return *this;}
349 ///Sets the length of the arrowheads
351 ///Sets the length of the arrowheads
353 GraphToEps<T> &arrowLength(double d) {_arrowLength*=d;return *this;}
354 ///Sets the width of the arrowheads
356 ///Sets the width of the arrowheads
358 GraphToEps<T> &arrowWidth(double d) {_arrowWidth*=d;return *this;}
360 ///Enables parallel edges
362 ///Enables parallel edges
363 ///\todo Partially implemented
364 GraphToEps<T> &enableParallel(bool b=true) {_enableParallel=b;return *this;}
370 GraphToEps<T> &parEdgeDist(double d) {_parEdgeDist*=d;return *this;}
376 GraphToEps<T> &hideEdges(bool b=true) {_showEdges=!b;return *this;}
381 GraphToEps<T> &hideNodes(bool b=true) {_showNodes=!b;return *this;}
383 ///Sets the size of the node texts
385 ///Sets the size of the node texts
387 GraphToEps<T> &nodeTextSize(double d) {_nodeTextSize=d;return *this;}
388 ///Gives a preamble block for node Postscript block.
390 ///Gives a preamble block for node Postscript block.
393 GraphToEps<T> & nodePsTextsPreamble(const char *str) {
394 _nodePsTextsPreamble=s ;return *this;
396 ///Sets whether the the graph is undirected
398 ///Sets whether the the graph is undirected
400 GraphToEps<T> &undir(bool b=true) {_undir=b;return *this;}
401 ///Sets whether the the graph is directed
403 ///Sets whether the the graph is directed.
404 ///Use it to show the undirected edges as a pair of directed ones.
405 GraphToEps<T> &bidir(bool b=true) {_undir=!b;return *this;}
408 bool isInsideNode(xy<double> p, double r,int t)
412 return p.normSquare()<=r*r;
414 return p.x<=r&&p.x>=-r&&p.y<=r&&p.y>=-r;
422 if(dontPrint) return;
424 os << "%!PS-Adobe-2.0 EPSF-2.0\n";
425 //\todo: Chech whether the graph is empty.
426 BoundingBox<double> bb;
427 for(NodeIt n(g);n!=INVALID;++n) {
428 double ns=_nodeSizes[n]*_nodeScale;
433 os << "%%BoundingBox: "
434 << bb.left()* _scale-_xBorder << ' '
435 << bb.bottom()*_scale-_yBorder << ' '
436 << bb.right()* _scale+_xBorder << ' '
437 << bb.top()* _scale+_yBorder << '\n';
438 //x1 y1 x2 y2 x3 y3 cr cg cb w
439 os << "/lb { setlinewidth setrgbcolor newpath moveto\n"
440 << " 4 2 roll 1 index 1 index curveto stroke } bind def\n";
441 os << "/l { setlinewidth setrgbcolor newpath moveto lineto stroke } bind def\n";
443 os << "/c { newpath dup 3 index add 2 index moveto 0 360 arc closepath } bind def\n";
445 os << "/sq { newpath 2 index 1 index add 2 index 2 index add moveto\n"
446 << " 2 index 1 index sub 2 index 2 index add lineto\n"
447 << " 2 index 1 index sub 2 index 2 index sub lineto\n"
448 << " 2 index 1 index add 2 index 2 index sub lineto\n"
449 << " closepath pop pop pop} bind def\n";
451 os << "/nc { setrgbcolor 2 index 2 index 2 index c fill\n"
452 << " 0 0 0 setrgbcolor dup "
453 << _nodeBorderQuotient << " mul setlinewidth "
454 << 1+_nodeBorderQuotient/2 << " div c stroke\n"
456 os << "/nsq { setrgbcolor 2 index 2 index 2 index sq fill\n"
457 << " 0 0 0 setrgbcolor dup "
458 << _nodeBorderQuotient << " mul setlinewidth "
459 << 1+_nodeBorderQuotient/2 << " div sq stroke\n"
461 os << "/arrl " << _arrowLength << " def\n";
462 os << "/arrw " << _arrowWidth << " def\n";
464 os << "/lrl { 2 index mul exch 2 index mul exch rlineto pop} bind def\n";
465 //len w dx_norm dy_norm x1 y1 cr cg cb
466 os << "/arr { setrgbcolor /y1 exch def /x1 exch def /dy exch def /dx exch def\n"
467 << " /w exch def /len exch def\n"
468 // << " 0.1 setlinewidth x1 y1 moveto dx len mul dy len mul rlineto stroke"
469 << " newpath x1 dy w 2 div mul add y1 dx w 2 div mul sub moveto\n"
470 << " len w sub arrl sub dx dy lrl\n"
471 << " arrw dy dx neg lrl\n"
472 << " dx arrl w add mul dy w 2 div arrw add mul sub\n"
473 << " dy arrl w add mul dx w 2 div arrw add mul add rlineto\n"
474 << " dx arrl w add mul neg dy w 2 div arrw add mul sub\n"
475 << " dy arrl w add mul neg dx w 2 div arrw add mul add rlineto\n"
476 << " arrw dy dx neg lrl\n"
477 << " len w sub arrl sub neg dx dy lrl\n"
478 << " closepath fill } bind def\n";
479 os << "/cshow { 2 index 2 index moveto dup stringwidth pop\n"
480 << " neg 2 div fosi .35 mul neg rmoveto show pop pop} def\n";
483 if(_scale!=1.0) os << _scale << " dup scale\n";
486 os << "%Edges:\ngsave\n";
487 if(_enableParallel) {
488 std::vector<Edge> el;
489 for(EdgeIt e(g);e!=INVALID;++e)
490 if(!_undir||g.source(e)<g.target(e)) el.push_back(e);
491 sort(el.begin(),el.end(),edgeLess(g));
493 typename std::vector<Edge>::iterator j;
494 for(typename std::vector<Edge>::iterator i=el.begin();i!=el.end();i=j) {
495 for(j=i+1;j!=el.end()&&isParallel(*i,*j);++j) ;
498 for(typename std::vector<Edge>::iterator e=i;e!=j;++e)
499 sw+=_edgeWidths[*e]*_edgeWidthScale+_parEdgeDist;
502 xy<double> dvec(_coords[g.target(*i)]-_coords[g.source(*i)]);
503 double l=sqrt(dvec.normSquare());
504 xy<double> d(dvec/l);
506 // m=xy<double>(_coords[g.target(*i)]+_coords[g.source(*i)])/2.0;
508 // m=xy<double>(_coords[g.source(*i)])+
509 // dvec*(double(_nodeSizes[g.source(*i)])/
510 // (_nodeSizes[g.source(*i)]+_nodeSizes[g.target(*i)]));
512 m=xy<double>(_coords[g.source(*i)])+
513 d*(l+_nodeSizes[g.source(*i)]-_nodeSizes[g.target(*i)])/2.0;
515 for(typename std::vector<Edge>::iterator e=i;e!=j;++e) {
516 sw+=_edgeWidths[*e]*_edgeWidthScale/2.0;
517 xy<double> mm=m+rot(d)*sw/.75;
520 const int INERPOL_PREC=20;
521 xy<double> s=_coords[g.source(*e)];
522 xy<double> t=_coords[g.target(*e)];
523 double rn=_nodeSizes[g.target(*e)]*_nodeScale;
524 node_shape=_nodeShapes[g.target(*e)];
525 Bezier3 bez(s,mm,mm,t);
527 for(int i=0;i<INERPOL_PREC;++i)
528 if(isInsideNode(bez((t1+t2)/2)-t,rn,node_shape)) t2=(t1+t2)/2;
530 xy<double> apoint=bez((t1+t2)/2);
531 rn = _arrowLength+_edgeWidths[*e]*_edgeWidthScale;
534 for(int i=0;i<INERPOL_PREC;++i)
535 if((bez((t1+t2)/2)-apoint).normSquare()>rn) t1=(t1+t2)/2;
537 xy<double> linend=bez((t1+t2)/2);
538 bez=bez.before((t1+t2)/2);
539 // rn=_nodeSizes[g.source(*e)]*_nodeScale;
540 // node_shape=_nodeShapes[g.source(*e)];
542 // for(int i=0;i<INERPOL_PREC;++i)
543 // if(isInsideNode(bez((t1+t2)/2)-t,rn,node_shape)) t1=(t1+t2)/2;
544 // else t2=(t1+t2)/2;
545 // bez=bez.after((t1+t2)/2);
546 os << _edgeWidths[*e]*_edgeWidthScale << " setlinewidth "
547 << _edgeColors[*e].getR() << ' '
548 << _edgeColors[*e].getG() << ' '
549 << _edgeColors[*e].getB() << " setrgbcolor newpath\n"
550 << bez.p1.x << ' ' << bez.p1.y << " moveto\n"
551 << bez.p2.x << ' ' << bez.p2.y << ' '
552 << bez.p3.x << ' ' << bez.p3.y << ' '
553 << bez.p4.x << ' ' << bez.p4.y << " curveto stroke\n";
554 xy<double> dd(rot(linend-apoint));
555 dd*=(_edgeWidths[*e]*_edgeWidthScale+_arrowWidth)/
556 sqrt(dd.normSquare());
557 os << "newpath " << psOut(apoint) << " moveto "
558 << psOut(linend+dd) << " lineto "
559 << psOut(linend-dd) << " lineto closepath fill\n";
562 os << _coords[g.source(*e)].x << ' '
563 << _coords[g.source(*e)].y << ' '
564 << mm.x << ' ' << mm.y << ' '
565 << _coords[g.target(*e)].x << ' '
566 << _coords[g.target(*e)].y << ' '
567 << _edgeColors[*e].getR() << ' '
568 << _edgeColors[*e].getG() << ' '
569 << _edgeColors[*e].getB() << ' '
570 << _edgeWidths[*e]*_edgeWidthScale << " lb\n";
572 sw+=_edgeWidths[*e]*_edgeWidthScale/2.0+_parEdgeDist;
576 else for(EdgeIt e(g);e!=INVALID;++e)
577 if(!_undir||g.source(e)<g.target(e))
579 xy<double> d(_coords[g.target(e)]-_coords[g.source(e)]);
580 double l=sqrt(d.normSquare());
582 xy<double> x1(d*_nodeScale*_nodeSizes[g.source(e)]+
583 _coords[g.source(e)]);
584 os << l-(_nodeSizes[g.source(e)]+
585 _nodeSizes[g.target(e)])*_nodeScale << ' '
586 << _edgeWidths[e]*_edgeWidthScale << ' '
587 << d.x << ' ' << d.y << ' '
588 << x1.x << ' ' << x1.y << ' '
589 << _edgeColors[e].getR() << ' '
590 << _edgeColors[e].getG() << ' '
591 << _edgeColors[e].getB() << " arr\n";
593 else os << _coords[g.source(e)].x << ' '
594 << _coords[g.source(e)].y << ' '
595 << _coords[g.target(e)].x << ' '
596 << _coords[g.target(e)].y << ' '
597 << _edgeColors[e].getR() << ' '
598 << _edgeColors[e].getG() << ' '
599 << _edgeColors[e].getB() << ' '
600 << _edgeWidths[e]*_edgeWidthScale << " l\n";
604 os << "%Nodes:\ngsave\n";
605 for(NodeIt n(g);n!=INVALID;++n) {
606 os << _coords[n].x << ' ' << _coords[n].y << ' '
607 << _nodeSizes[n]*_nodeScale << ' '
608 << _nodeColors[n].getR() << ' '
609 << _nodeColors[n].getG() << ' '
610 << _nodeColors[n].getB() << ' ';
611 switch(_nodeShapes[n]) {
622 os << "%Node texts:\ngsave\n";
623 os << "/fosi " << _nodeTextSize << " def\n";
624 os << "(Helvetica) findfont fosi scalefont setfont\n";
625 os << "0 0 0 setrgbcolor\n";
626 for(NodeIt n(g);n!=INVALID;++n)
627 os << _coords[n].x << ' ' << _coords[n].y
628 << " (" << _nodeTexts[n] << ") cshow\n";
631 if(_showNodePsText) {
632 os << "%Node PS blocks:\ngsave\n";
633 for(NodeIt n(g);n!=INVALID;++n)
634 os << _coords[n].x << ' ' << _coords[n].y
635 << " moveto\n" << _nodePsTexts[n] << "\n";
642 if(_pleaseRemoveOsStream) {delete &os;}
647 ///Generates an EPS file from a graph
650 ///Generates an EPS file from a graph.
651 ///\param g is a reference to the graph to be printed
652 ///\param os is a reference to the output stream.
653 ///By default it is <tt>std::cout</tt>
655 ///This function also has a lot of \ref named-templ-param "named parameters",
656 ///they are declared as the members of class \ref GraphToEps. The following
657 ///example shows how to use these parameters.
659 /// graphToEps(g).scale(10).coords(coords)
660 /// .nodeScale(2).nodeSizes(sizes)
661 /// .edgeWidthScale(.4);
664 ///\sa graphToEps(G &g, char *file_name)
666 GraphToEps<DefaultGraphToEpsTraits<G> >
667 graphToEps(G &g, std::ostream& os=std::cout)
670 GraphToEps<DefaultGraphToEpsTraits<G> >(DefaultGraphToEpsTraits<G>(g,os));
673 ///Generates an EPS file from a graph
676 ///This function does the same as
677 ///\ref graphToEps(G &g,std::ostream& os)
678 ///but it writes its output into the file \c file_name
679 ///instead of a stream.
680 ///\sa graphToEps(G &g, std::ostream& os)
682 GraphToEps<DefaultGraphToEpsTraits<G> >
683 graphToEps(G &g,char *file_name)
685 return GraphToEps<DefaultGraphToEpsTraits<G> >
686 (DefaultGraphToEpsTraits<G>(g,*new std::ofstream(file_name),true));
689 } //END OF NAMESPACE LEMON
691 #endif // LEMON_GRAPH_TO_EPS_H