46 |
46 |
47 ListGraph g; |
47 ListGraph g; |
48 typedef ListGraph::Node Node; |
48 typedef ListGraph::Node Node; |
49 typedef ListGraph::NodeIt NodeIt; |
49 typedef ListGraph::NodeIt NodeIt; |
50 typedef ListGraph::Edge Edge; |
50 typedef ListGraph::Edge Edge; |
51 typedef xy<int> Xy; |
51 typedef dim2::Point<int> Point; |
52 |
52 |
53 Node n1=g.addNode(); |
53 Node n1=g.addNode(); |
54 Node n2=g.addNode(); |
54 Node n2=g.addNode(); |
55 Node n3=g.addNode(); |
55 Node n3=g.addNode(); |
56 Node n4=g.addNode(); |
56 Node n4=g.addNode(); |
57 Node n5=g.addNode(); |
57 Node n5=g.addNode(); |
58 |
58 |
59 ListGraph::NodeMap<Xy> coords(g); |
59 ListGraph::NodeMap<Point> coords(g); |
60 ListGraph::NodeMap<double> sizes(g); |
60 ListGraph::NodeMap<double> sizes(g); |
61 ListGraph::NodeMap<int> colors(g); |
61 ListGraph::NodeMap<int> colors(g); |
62 ListGraph::NodeMap<int> shapes(g); |
62 ListGraph::NodeMap<int> shapes(g); |
63 ListGraph::EdgeMap<int> ecolors(g); |
63 ListGraph::EdgeMap<int> ecolors(g); |
64 ListGraph::EdgeMap<int> widths(g); |
64 ListGraph::EdgeMap<int> widths(g); |
65 |
65 |
66 coords[n1]=Xy(50,50); sizes[n1]=1; colors[n1]=1; shapes[n1]=0; |
66 coords[n1]=Point(50,50); sizes[n1]=1; colors[n1]=1; shapes[n1]=0; |
67 coords[n2]=Xy(50,70); sizes[n2]=2; colors[n2]=2; shapes[n2]=2; |
67 coords[n2]=Point(50,70); sizes[n2]=2; colors[n2]=2; shapes[n2]=2; |
68 coords[n3]=Xy(70,70); sizes[n3]=1; colors[n3]=3; shapes[n3]=0; |
68 coords[n3]=Point(70,70); sizes[n3]=1; colors[n3]=3; shapes[n3]=0; |
69 coords[n4]=Xy(70,50); sizes[n4]=2; colors[n4]=4; shapes[n4]=1; |
69 coords[n4]=Point(70,50); sizes[n4]=2; colors[n4]=4; shapes[n4]=1; |
70 coords[n5]=Xy(85,60); sizes[n5]=3; colors[n5]=5; shapes[n5]=2; |
70 coords[n5]=Point(85,60); sizes[n5]=3; colors[n5]=5; shapes[n5]=2; |
71 |
71 |
72 Edge e; |
72 Edge e; |
73 |
73 |
74 e=g.addEdge(n1,n2); ecolors[e]=0; widths[e]=1; |
74 e=g.addEdge(n1,n2); ecolors[e]=0; widths[e]=1; |
75 e=g.addEdge(n2,n3); ecolors[e]=0; widths[e]=1; |
75 e=g.addEdge(n2,n3); ecolors[e]=0; widths[e]=1; |
181 drawArrows().arrowWidth(1).arrowLength(1). |
181 drawArrows().arrowWidth(1).arrowLength(1). |
182 run(); |
182 run(); |
183 |
183 |
184 ListGraph h; |
184 ListGraph h; |
185 ListGraph::NodeMap<int> hcolors(h); |
185 ListGraph::NodeMap<int> hcolors(h); |
186 ListGraph::NodeMap<Xy> hcoords(h); |
186 ListGraph::NodeMap<Point> hcoords(h); |
187 |
187 |
188 int cols=int(sqrt(double(palette.size()))); |
188 int cols=int(sqrt(double(palette.size()))); |
189 for(int i=0;i<int(paletteW.size());i++) { |
189 for(int i=0;i<int(paletteW.size());i++) { |
190 Node n=h.addNode(); |
190 Node n=h.addNode(); |
191 hcoords[n]=Xy(i%cols,i/cols); |
191 hcoords[n]=Point(i%cols,i/cols); |
192 hcolors[n]=i; |
192 hcolors[n]=i; |
193 } |
193 } |
194 |
194 |
195 cout << "Create 'graph_to_eps_demo_out_colors.eps'" << endl; |
195 cout << "Create 'graph_to_eps_demo_out_colors.eps'" << endl; |
196 graphToEps(h,"graph_to_eps_demo_out_colors.eps"). |
196 graphToEps(h,"graph_to_eps_demo_out_colors.eps"). |