src/demo/graph_to_eps_demo.cc
changeset 1339 26a88d12d1a6
parent 1178 3c176c65d33b
child 1359 1581f961cfaa
equal deleted inserted replaced
7:57b86c02677c 8:ace7df64c321
    16  */
    16  */
    17 
    17 
    18 #include<lemon/graph_to_eps.h>
    18 #include<lemon/graph_to_eps.h>
    19 #include<lemon/maps.h>
    19 #include<lemon/maps.h>
    20 #include<lemon/list_graph.h>
    20 #include<lemon/list_graph.h>
       
    21 #include<lemon/graph_utils.h>
    21 
    22 
    22 
    23 
    23 using namespace std;
    24 using namespace std;
    24 using namespace lemon;
    25 using namespace lemon;
    25 
       
    26 class IdMap :public MapBase<ListGraph::Node,int>
       
    27 {
       
    28   const ListGraph &g;
       
    29 public:
       
    30   IdMap(const ListGraph &_g) :g(_g) {}
       
    31   Value operator[](Key n) const { return g.id(n); }
       
    32 };
       
    33 
    26 
    34 int main()
    27 int main()
    35 {
    28 {
    36   ColorSet colorSet;
    29   ColorSet colorSet;
    37 
    30 
    68   e=g.addEdge(n5,n4); ecolors[e]=0; widths[e]=1;
    61   e=g.addEdge(n5,n4); ecolors[e]=0; widths[e]=1;
    69   e=g.addEdge(n4,n1); ecolors[e]=0; widths[e]=1;
    62   e=g.addEdge(n4,n1); ecolors[e]=0; widths[e]=1;
    70   e=g.addEdge(n2,n4); ecolors[e]=1; widths[e]=2;
    63   e=g.addEdge(n2,n4); ecolors[e]=1; widths[e]=2;
    71   e=g.addEdge(n3,n4); ecolors[e]=2; widths[e]=1;
    64   e=g.addEdge(n3,n4); ecolors[e]=2; widths[e]=1;
    72   
    65   
    73   IdMap id(g);
    66   IdMap<ListGraph,Node> id(g);
    74 
    67 
    75   graphToEps(g,"graph_to_eps_demo_out.eps").scale(10).coords(coords).
    68   graphToEps(g,"graph_to_eps_demo_out.eps").scale(10).coords(coords).
    76     title("Sample .eps figure").
    69     title("Sample .eps figure").
    77     copyright("(C) 2005 LEMON Project").
    70     copyright("(C) 2005 LEMON Project").
    78     nodeScale(2).nodeSizes(sizes).
    71     nodeScale(2).nodeSizes(sizes).