src/work/alpar/graph_to_eps.cc
author alpar
Wed, 05 Jan 2005 12:26:59 +0000
changeset 1052 172ce6c3ac6e
parent 1050 bcc0766a7b86
child 1055 f901ff02b2d7
permissions -rw-r--r--
Two examples showing a bit more convenient way to implement named parameters.
alpar@1051
     1
#include <iostream>
alpar@1050
     2
#include<math.h>
alpar@1051
     3
alpar@1046
     4
#include<lemon/xy.h>
alpar@1046
     5
#include<lemon/maps.h>
alpar@1046
     6
#include<lemon/list_graph.h>
alpar@1046
     7
alpar@1050
     8
alpar@1050
     9
///\file \ingroup misc
alpar@1046
    10
///Simple graph drawer
alpar@1046
    11
alpar@1046
    12
namespace lemon {
alpar@1046
    13
alpar@1050
    14
///Data structure representing RGB colors.
alpar@1050
    15
alpar@1050
    16
///Data structure representing RGB colors.
alpar@1050
    17
///\ingroup misc
alpar@1046
    18
class Color
alpar@1046
    19
{
alpar@1046
    20
  double _r,_g,_b;
alpar@1046
    21
public:
alpar@1050
    22
  ///Default constructor
alpar@1046
    23
  Color() {}
alpar@1050
    24
  ///Constructor
alpar@1046
    25
  Color(double r,double g,double b) :_r(r),_g(g),_b(b) {};
alpar@1050
    26
  ///Returns the red component
alpar@1046
    27
  double getR() {return _r;}
alpar@1050
    28
  ///Returns the green component
alpar@1046
    29
  double getG() {return _g;}
alpar@1050
    30
  ///Returns the blue component
alpar@1046
    31
  double getB() {return _b;}
alpar@1050
    32
  ///Set the color components
alpar@1046
    33
  void set(double r,double g,double b) { _r=r;_g=g;_b=b; };
alpar@1046
    34
};
alpar@1046
    35
  
alpar@1050
    36
///Default traits class of \ref GraphToEps
alpar@1050
    37
alpar@1050
    38
///Default traits class of \ref GraphToEps
alpar@1050
    39
///
alpar@1050
    40
///\c G is the type of the underlying graph.
alpar@1046
    41
template<class G>
alpar@1046
    42
struct DefaultGraphToEpsTraits
alpar@1046
    43
{
alpar@1046
    44
  typedef G Graph;
alpar@1046
    45
  typedef typename Graph::Node Node;
alpar@1046
    46
  typedef typename Graph::NodeIt NodeIt;
alpar@1046
    47
  typedef typename Graph::Edge Edge;
alpar@1046
    48
  typedef typename Graph::EdgeIt EdgeIt;
alpar@1046
    49
  typedef typename Graph::InEdgeIt InEdgeIt;
alpar@1046
    50
  typedef typename Graph::OutEdgeIt OutEdgeIt;
alpar@1046
    51
  
alpar@1046
    52
alpar@1046
    53
  const Graph &g;
alpar@1051
    54
alpar@1051
    55
  std::ostream& os;
alpar@1051
    56
  
alpar@1050
    57
  ConstMap<typename Graph::Node,xy<double> > _coords;
alpar@1050
    58
  ConstMap<typename Graph::Node,double > _nodeSizes;
alpar@1046
    59
alpar@1050
    60
  ConstMap<typename Graph::Node,Color > _nodeColors;
alpar@1050
    61
  ConstMap<typename Graph::Edge,Color > _edgeColors;
alpar@1050
    62
alpar@1050
    63
  ConstMap<typename Graph::Edge,double > _edgeWidths;
alpar@1050
    64
  
alpar@1050
    65
  double _edgeWidthScale;
alpar@1050
    66
  
alpar@1050
    67
  double _nodeScale;
alpar@1050
    68
  double _xBorder, _yBorder;
alpar@1050
    69
  double _scale;
alpar@1050
    70
  double _nodeBorderQuotient;
alpar@1050
    71
  
alpar@1050
    72
  bool _drawArrows;
alpar@1050
    73
  double _arrowLength, _arrowWidth;
alpar@1050
    74
  
alpar@1050
    75
  ///Constructor
alpar@1050
    76
alpar@1050
    77
  ///Constructor
alpar@1051
    78
  ///\param _g is a reference to the graph to be printed
alpar@1051
    79
  ///\param _os is a reference to the output stream.
alpar@1051
    80
  ///By default it is <tt>std::cout</tt>
alpar@1051
    81
  DefaultGraphToEpsTraits(const G &_g,std::ostream& _os=std::cout) :
alpar@1051
    82
    g(_g), os(_os),
alpar@1051
    83
    _coords(xy<double>(1,1)), _nodeSizes(1.0),
alpar@1050
    84
    _nodeColors(Color(1,1,1)), _edgeColors(Color(0,0,0)),
alpar@1050
    85
    _edgeWidths(1), _edgeWidthScale(0.3),
alpar@1050
    86
    _nodeScale(1.0), _xBorder(10), _yBorder(10), _scale(1.0),
alpar@1050
    87
    _nodeBorderQuotient(.1),
alpar@1050
    88
    _drawArrows(false), _arrowLength(1), _arrowWidth(0.3) {}
alpar@1046
    89
};
alpar@1046
    90
alpar@1050
    91
///Helper class to implement the named parameters of \ref graphToEps()
alpar@1050
    92
alpar@1050
    93
///Helper class to implement the named parameters of \ref graphToEps()
alpar@1050
    94
///\todo Is 'helper class' a good name for this?
alpar@1050
    95
///
alpar@1046
    96
template<class T> class GraphToEps : public T 
alpar@1046
    97
{
alpar@1046
    98
  typedef typename T::Graph Graph;
alpar@1046
    99
  typedef typename Graph::Node Node;
alpar@1046
   100
  typedef typename Graph::NodeIt NodeIt;
alpar@1046
   101
  typedef typename Graph::Edge Edge;
alpar@1046
   102
  typedef typename Graph::EdgeIt EdgeIt;
alpar@1046
   103
  typedef typename Graph::InEdgeIt InEdgeIt;
alpar@1046
   104
  typedef typename Graph::OutEdgeIt OutEdgeIt;
alpar@1046
   105
alpar@1046
   106
  bool dontPrint;
alpar@1046
   107
alpar@1046
   108
public:
alpar@1046
   109
  GraphToEps(const T &t) : T(t), dontPrint(false) {};
alpar@1046
   110
  
alpar@1050
   111
  template<class X> struct CoordsTraits : public T {
alpar@1050
   112
    const X &_coords;
alpar@1050
   113
    CoordsTraits(const T &t,const X &x) : T(t), _coords(x) {}
alpar@1046
   114
  };
alpar@1050
   115
  ///Sets the map of the node coordinates
alpar@1050
   116
alpar@1050
   117
  ///Sets the map of the node coordinates.
alpar@1050
   118
  ///\param x must be a node map with xy<double> or xy<int> values. 
alpar@1050
   119
  template<class X> GraphToEps<CoordsTraits<X> > coords(const X &x) {
alpar@1046
   120
    dontPrint=true;
alpar@1050
   121
    return GraphToEps<CoordsTraits<X> >(CoordsTraits<X>(*this,x));
alpar@1046
   122
  }
alpar@1050
   123
  template<class X> struct NodeSizesTraits : public T {
alpar@1050
   124
    const X &_nodeSizes;
alpar@1050
   125
    NodeSizesTraits(const T &t,const X &x) : T(t), _nodeSizes(x) {}
alpar@1046
   126
  };
alpar@1050
   127
  ///Sets the map of the node sizes
alpar@1050
   128
alpar@1050
   129
  ///Sets the map of the node sizes
alpar@1050
   130
  ///\param x must be a node map with \c double (or convertible) values. 
alpar@1050
   131
  template<class X> GraphToEps<NodeSizesTraits<X> > nodeSizes(const X &x)
alpar@1046
   132
  {
alpar@1046
   133
    dontPrint=true;
alpar@1050
   134
    return GraphToEps<NodeSizesTraits<X> >(NodeSizesTraits<X>(*this,x));
alpar@1046
   135
  }
alpar@1050
   136
   template<class X> struct EdgeWidthsTraits : public T {
alpar@1050
   137
    const X &_edgeWidths;
alpar@1050
   138
    EdgeWidthsTraits(const T &t,const X &x) : T(t), _edgeWidths(x) {}
alpar@1046
   139
  };
alpar@1050
   140
  ///Sets the map of the edge widths
alpar@1050
   141
alpar@1050
   142
  ///Sets the map of the edge widths
alpar@1050
   143
  ///\param x must be a edge map with \c double (or convertible) values. 
alpar@1050
   144
  template<class X> GraphToEps<EdgeWidthsTraits<X> > edgeWidths(const X &x)
alpar@1046
   145
  {
alpar@1046
   146
    dontPrint=true;
alpar@1050
   147
    return GraphToEps<EdgeWidthsTraits<X> >(EdgeWidthsTraits<X>(*this,x));
alpar@1046
   148
  }
alpar@1050
   149
alpar@1050
   150
  template<class X> struct NodeColorsTraits : public T {
alpar@1050
   151
    const X &_nodeColors;
alpar@1050
   152
    NodeColorsTraits(const T &t,const X &x) : T(t), _nodeColors(x) {}
alpar@1046
   153
  };
alpar@1050
   154
  ///Sets the map of the node colors
alpar@1050
   155
alpar@1050
   156
  ///Sets the map of the node colors
alpar@1050
   157
  ///\param x must be a node map with \ref Color values. 
alpar@1050
   158
  template<class X> GraphToEps<NodeColorsTraits<X> >
alpar@1050
   159
  nodeColors(const X &x)
alpar@1046
   160
  {
alpar@1046
   161
    dontPrint=true;
alpar@1050
   162
    return GraphToEps<NodeColorsTraits<X> >(NodeColorsTraits<X>(*this,x));
alpar@1046
   163
  }
alpar@1050
   164
  template<class X> struct EdgeColorsTraits : public T {
alpar@1050
   165
    const X &_edgeColors;
alpar@1050
   166
    EdgeColorsTraits(const T &t,const X &x) : T(t), _edgeColors(x) {}
alpar@1050
   167
  };
alpar@1050
   168
  ///Sets the map of the edge colors
alpar@1050
   169
alpar@1050
   170
  ///Sets the map of the edge colors
alpar@1050
   171
  ///\param x must be a edge map with \ref Color values. 
alpar@1050
   172
  template<class X> GraphToEps<EdgeColorsTraits<X> >
alpar@1050
   173
  edgeColors(const X &x)
alpar@1050
   174
  {
alpar@1050
   175
    dontPrint=true;
alpar@1050
   176
    return GraphToEps<EdgeColorsTraits<X> >(EdgeColorsTraits<X>(*this,x));
alpar@1050
   177
  }
alpar@1050
   178
  ///Sets a global scale factor for node sizes
alpar@1050
   179
alpar@1050
   180
  ///Sets a global scale factor for node sizes
alpar@1050
   181
  ///
alpar@1050
   182
  GraphToEps<T> &nodeScale(double d) {_nodeScale=d;return *this;}
alpar@1050
   183
  ///Sets a global scale factor for edge widths
alpar@1050
   184
alpar@1050
   185
  ///Sets a global scale factor for edge widths
alpar@1050
   186
  ///
alpar@1050
   187
  GraphToEps<T> &edgeWidthScale(double d) {_edgeWidthScale=d;return *this;}
alpar@1050
   188
  ///Sets a global scale factor for the whole picture
alpar@1050
   189
alpar@1050
   190
  ///Sets a global scale factor for the whole picture
alpar@1050
   191
  ///
alpar@1050
   192
  GraphToEps<T> &scale(double d) {_scale=d;return *this;}
alpar@1050
   193
  ///Sets the width of the border around the picture
alpar@1050
   194
alpar@1050
   195
  ///Sets the width of the border around the picture
alpar@1050
   196
  ///
alpar@1050
   197
  GraphToEps<T> &border(double b) {_xBorder=_yBorder=b;return *this;}
alpar@1050
   198
  ///Sets the width of the border around the picture
alpar@1050
   199
alpar@1050
   200
  ///Sets the width of the border around the picture
alpar@1050
   201
  ///
alpar@1050
   202
  GraphToEps<T> &border(double x, double y) {
alpar@1050
   203
    _xBorder=x;_yBorder=y;return *this;
alpar@1050
   204
  }
alpar@1050
   205
  ///Sets whether to draw arrows
alpar@1050
   206
alpar@1050
   207
  ///Sets whether to draw arrows
alpar@1050
   208
  ///
alpar@1050
   209
  GraphToEps<T> &drawArrows(bool b=true) {_drawArrows=b;return *this;}
alpar@1050
   210
  ///Sets the length of the arrowheads
alpar@1050
   211
alpar@1050
   212
  ///Sets the length of the arrowheads
alpar@1050
   213
  ///
alpar@1050
   214
  GraphToEps<T> &arrowLength(double d) {_arrowLength*=d;return *this;}
alpar@1050
   215
  ///Sets the width of the arrowheads
alpar@1050
   216
alpar@1050
   217
  ///Sets the width of the arrowheads
alpar@1050
   218
  ///
alpar@1050
   219
  GraphToEps<T> &arrowWidth(double d) {_arrowWidth*=d;return *this;}
alpar@1046
   220
  
alpar@1046
   221
  ~GraphToEps() 
alpar@1046
   222
  {
alpar@1046
   223
    if(dontPrint) return;
alpar@1046
   224
    
alpar@1051
   225
    os << "%!PS-Adobe-2.0 EPSF-2.0\n";
alpar@1046
   226
    //\todo: Chech whether the graph is empty.
alpar@1046
   227
    BoundingBox<double> bb;
alpar@1050
   228
    for(NodeIt n(g);n!=INVALID;++n) {
alpar@1050
   229
      double ns=_nodeSizes[n]*_nodeScale;
alpar@1050
   230
      xy<double> p(ns,ns);
alpar@1050
   231
      bb+=p+_coords[n];
alpar@1050
   232
      bb+=-p+_coords[n];
alpar@1046
   233
      }
alpar@1051
   234
    os << "%%BoundingBox: "
alpar@1050
   235
	 << bb.left()*  _scale-_xBorder << ' '
alpar@1050
   236
	 << bb.bottom()*_scale-_yBorder << ' '
alpar@1050
   237
	 << bb.right()* _scale+_xBorder << ' '
alpar@1050
   238
	 << bb.top()*   _scale+_yBorder << '\n';
alpar@1050
   239
    //x1 y1 x2 y2 cr cg cb w
alpar@1051
   240
    os << "/l { setlinewidth setrgbcolor newpath moveto lineto stroke } bind def\n";
alpar@1051
   241
    os << "/c { newpath dup 3 index add 2 index moveto 0 360 arc } bind def\n";
alpar@1046
   242
    // x y r cr cg cb
alpar@1051
   243
    os << "/n { setrgbcolor 2 index 2 index 2 index c fill\n"
alpar@1050
   244
	 << "     0 0 0 setrgbcolor dup "
alpar@1050
   245
	 << _nodeBorderQuotient << " mul setlinewidth "
alpar@1050
   246
	 << 1+_nodeBorderQuotient/2 << " div c stroke\n"
alpar@1046
   247
	 << "   } bind def\n";
alpar@1051
   248
    os << "/arrl " << _arrowLength << " def\n";
alpar@1051
   249
    os << "/arrw " << _arrowWidth << " def\n";
alpar@1050
   250
    // l dx_norm dy_norm
alpar@1051
   251
    os << "/lrl { 2 index mul exch 2 index mul exch rlineto pop} bind def\n";
alpar@1050
   252
    //len w dx_norm dy_norm x1 y1 cr cg cb
alpar@1051
   253
    os << "/arr { setrgbcolor /y1 exch def /x1 exch def /dy exch def /dx exch def\n"
alpar@1050
   254
	 << "       /w exch def /len exch def\n"
alpar@1050
   255
      //	 << "       0.1 setlinewidth x1 y1 moveto dx len mul dy len mul rlineto stroke"
alpar@1050
   256
	 << "       newpath x1 dy w 2 div mul add y1 dx w 2 div mul sub moveto\n"
alpar@1050
   257
	 << "       len w sub arrl sub dx dy lrl\n"
alpar@1050
   258
	 << "       arrw dy dx neg lrl\n"
alpar@1050
   259
	 << "       dx arrl w add mul dy w 2 div arrw add mul sub\n"
alpar@1050
   260
	 << "       dy arrl w add mul dx w 2 div arrw add mul add rlineto\n"
alpar@1050
   261
	 << "       dx arrl w add mul neg dy w 2 div arrw add mul sub\n"
alpar@1050
   262
	 << "       dy arrl w add mul neg dx w 2 div arrw add mul add rlineto\n"
alpar@1050
   263
	 << "       arrw dy dx neg lrl\n"
alpar@1050
   264
	 << "       len w sub arrl sub neg dx dy lrl\n"
alpar@1050
   265
	 << "       closepath fill } bind def\n";
alpar@1051
   266
    os << "\ngsave\n";
alpar@1051
   267
    if(_scale!=1.0) os << _scale << " dup scale\n";
alpar@1051
   268
    os << "%Edges:\ngsave\n";
alpar@1046
   269
    for(NodeIt n(g);n!=INVALID;++n)
alpar@1046
   270
      for(OutEdgeIt e(g,n);e!=INVALID;++e)
alpar@1050
   271
	if(_drawArrows) {
alpar@1050
   272
	  xy<double> d(_coords[g.target(e)]-_coords[g.source(e)]);
alpar@1050
   273
	  double l=sqrt(d.normSquare());
alpar@1050
   274
	  d/=l;
alpar@1050
   275
	  xy<double> x1(d*_nodeScale*_nodeSizes[g.source(e)]+
alpar@1050
   276
			_coords[g.source(e)]);
alpar@1051
   277
	  os << l-(_nodeSizes[g.source(e)]+
alpar@1050
   278
		     _nodeSizes[g.target(e)])*_nodeScale << ' '
alpar@1050
   279
	       << _edgeWidths[e]*_edgeWidthScale << ' '
alpar@1050
   280
	       << d.x << ' ' << d.y << ' '
alpar@1050
   281
	       << x1.x << ' ' << x1.y << ' '
alpar@1050
   282
	       << _edgeColors[e].getR() << ' '
alpar@1050
   283
	       << _edgeColors[e].getG() << ' '
alpar@1050
   284
	       << _edgeColors[e].getB() << " arr\n";
alpar@1050
   285
	}
alpar@1051
   286
    	else os << _coords[g.source(e)].x << ' '
alpar@1050
   287
		  << _coords[g.source(e)].y << ' '
alpar@1050
   288
		  << _coords[g.target(e)].x << ' '
alpar@1050
   289
		  << _coords[g.target(e)].y << ' '
alpar@1050
   290
		  << _edgeColors[e].getR() << ' '
alpar@1050
   291
		  << _edgeColors[e].getG() << ' '
alpar@1050
   292
		  << _edgeColors[e].getB() << ' '
alpar@1050
   293
		  << _edgeWidths[e]*_edgeWidthScale << " l\n";
alpar@1051
   294
    os << "grestore\n%Nodes:\ngsave\n";
alpar@1046
   295
    for(NodeIt n(g);n!=INVALID;++n)
alpar@1051
   296
      os << _coords[n].x << ' ' << _coords[n].y << ' '
alpar@1050
   297
	   << _nodeSizes[n]*_nodeScale << ' '
alpar@1050
   298
	   << _nodeColors[n].getR() << ' '
alpar@1050
   299
	   << _nodeColors[n].getG() << ' '
alpar@1050
   300
	   << _nodeColors[n].getB() << " n\n"; 
alpar@1051
   301
    os << "grestore\ngrestore\n";
alpar@1046
   302
  } 
alpar@1046
   303
};
alpar@1046
   304
alpar@1046
   305
alpar@1050
   306
///Generates an EPS file from a graph
alpar@1050
   307
alpar@1050
   308
///\ingroup misc
alpar@1050
   309
///Generates an EPS file from a graph.
alpar@1051
   310
///\param g is a reference to the graph to be printed
alpar@1051
   311
///\param os is a reference to the output stream.
alpar@1051
   312
///By default it is <tt>std::cout</tt>
alpar@1050
   313
///
alpar@1051
   314
///This function also has a lot of \ref named-templ-param "named parameters",
alpar@1050
   315
///they are declared as the members of class \ref GraphToEps. The following
alpar@1050
   316
///example shows how to use these parameters.
alpar@1050
   317
///\code
alpar@1050
   318
/// graphToEps(g).scale(10).coords(coords)
alpar@1050
   319
///              .nodeScale(2).nodeSizes(sizes)
alpar@1050
   320
///              .edgeWidthScale(.4);
alpar@1050
   321
///\endcode
alpar@1050
   322
///\sa GraphToEps
alpar@1046
   323
template<class G>
alpar@1051
   324
GraphToEps<DefaultGraphToEpsTraits<G> > graphToEps(G &g,std::ostream& os=std::cout)
alpar@1046
   325
{
alpar@1046
   326
  return GraphToEps<DefaultGraphToEpsTraits<G> >(DefaultGraphToEpsTraits<G>(g));
alpar@1046
   327
}
alpar@1046
   328
 
alpar@1046
   329
}
alpar@1046
   330
alpar@1046
   331
using namespace lemon;
alpar@1046
   332
alpar@1046
   333
class ColorSet : public MapBase<int,Color>
alpar@1046
   334
{
alpar@1046
   335
public:
alpar@1046
   336
  Color operator[](int i) const
alpar@1046
   337
  {
alpar@1046
   338
    switch(i%8){
alpar@1046
   339
    case 0: return Color(0,0,0);
alpar@1046
   340
    case 1: return Color(1,0,0);
alpar@1046
   341
    case 2: return Color(0,1,0);
alpar@1046
   342
    case 3: return Color(0,0,1);
alpar@1046
   343
    case 4: return Color(1,1,0);
alpar@1046
   344
    case 5: return Color(1,0,1);
alpar@1046
   345
    case 6: return Color(0,1,1);
alpar@1046
   346
    case 7: return Color(1,1,1);
alpar@1046
   347
    }
alpar@1046
   348
    return Color(0,0,0);
alpar@1046
   349
  }
alpar@1046
   350
} colorSet;
alpar@1046
   351
alpar@1046
   352
int main()
alpar@1046
   353
{
alpar@1046
   354
  ListGraph g;
alpar@1046
   355
  typedef ListGraph::Node Node;
alpar@1046
   356
  typedef ListGraph::NodeIt NodeIt;
alpar@1046
   357
  typedef ListGraph::Edge Edge;
alpar@1050
   358
  typedef xy<int> Xy;
alpar@1046
   359
  
alpar@1046
   360
  Node n1=g.addNode();
alpar@1046
   361
  Node n2=g.addNode();
alpar@1046
   362
  Node n3=g.addNode();
alpar@1046
   363
  Node n4=g.addNode();
alpar@1046
   364
  Node n5=g.addNode();
alpar@1046
   365
alpar@1046
   366
  ListGraph::NodeMap<Xy> coords(g);
alpar@1046
   367
  ListGraph::NodeMap<double> sizes(g);
alpar@1046
   368
  ListGraph::NodeMap<int> colors(g);
alpar@1047
   369
  ListGraph::EdgeMap<int> ecolors(g);
alpar@1050
   370
  ListGraph::EdgeMap<int> widths(g);
alpar@1046
   371
  
alpar@1046
   372
  coords[n1]=Xy(50,50);  sizes[n1]=1; colors[n1]=1;
alpar@1046
   373
  coords[n2]=Xy(50,70);  sizes[n2]=2; colors[n2]=2;
alpar@1046
   374
  coords[n3]=Xy(70,70);  sizes[n3]=1; colors[n3]=3;
alpar@1046
   375
  coords[n4]=Xy(70,50);  sizes[n4]=2; colors[n4]=4;
alpar@1046
   376
  coords[n5]=Xy(85,60);  sizes[n5]=3; colors[n5]=5;
alpar@1046
   377
  
alpar@1046
   378
  Edge e;
alpar@1046
   379
alpar@1050
   380
  e=g.addEdge(n1,n2); ecolors[e]=0; widths[e]=1;
alpar@1050
   381
  e=g.addEdge(n2,n3); ecolors[e]=0; widths[e]=1;
alpar@1050
   382
  e=g.addEdge(n3,n5); ecolors[e]=0; widths[e]=3;
alpar@1050
   383
  e=g.addEdge(n5,n4); ecolors[e]=0; widths[e]=1;
alpar@1050
   384
  e=g.addEdge(n4,n1); ecolors[e]=0; widths[e]=1;
alpar@1050
   385
  e=g.addEdge(n2,n4); ecolors[e]=1; widths[e]=2;
alpar@1050
   386
  e=g.addEdge(n3,n4); ecolors[e]=2; widths[e]=1;
alpar@1046
   387
  
alpar@1050
   388
  graphToEps(g).scale(10).coords(coords).
alpar@1050
   389
    nodeScale(2).nodeSizes(sizes).
alpar@1050
   390
    nodeColors(composeMap(colorSet,colors)).
alpar@1050
   391
    edgeColors(composeMap(colorSet,ecolors)).
alpar@1050
   392
    edgeWidthScale(.4).edgeWidths(widths).
alpar@1050
   393
    drawArrows().arrowWidth(1).arrowLength(1)
alpar@1050
   394
    ;
alpar@1046
   395
}