src/demo/graph_to_eps_demo.cc
changeset 1087 d496d1d5a5e7
parent 1073 bedab8bd915f
child 1088 358526a620f8
equal deleted inserted replaced
0:0c52852dd696 1:a1554066c372
    65   Node n5=g.addNode();
    65   Node n5=g.addNode();
    66 
    66 
    67   ListGraph::NodeMap<Xy> coords(g);
    67   ListGraph::NodeMap<Xy> coords(g);
    68   ListGraph::NodeMap<double> sizes(g);
    68   ListGraph::NodeMap<double> sizes(g);
    69   ListGraph::NodeMap<int> colors(g);
    69   ListGraph::NodeMap<int> colors(g);
       
    70   ListGraph::NodeMap<int> shapes(g);
    70   ListGraph::EdgeMap<int> ecolors(g);
    71   ListGraph::EdgeMap<int> ecolors(g);
    71   ListGraph::EdgeMap<int> widths(g);
    72   ListGraph::EdgeMap<int> widths(g);
    72   
    73   
    73   coords[n1]=Xy(50,50);  sizes[n1]=1; colors[n1]=1;
    74   coords[n1]=Xy(50,50);  sizes[n1]=1; colors[n1]=1; shapes[n1]=0;
    74   coords[n2]=Xy(50,70);  sizes[n2]=2; colors[n2]=2;
    75   coords[n2]=Xy(50,70);  sizes[n2]=2; colors[n2]=2; shapes[n2]=0;
    75   coords[n3]=Xy(70,70);  sizes[n3]=1; colors[n3]=3;
    76   coords[n3]=Xy(70,70);  sizes[n3]=1; colors[n3]=3; shapes[n3]=0;
    76   coords[n4]=Xy(70,50);  sizes[n4]=2; colors[n4]=4;
    77   coords[n4]=Xy(70,50);  sizes[n4]=2; colors[n4]=4; shapes[n4]=1;
    77   coords[n5]=Xy(85,60);  sizes[n5]=3; colors[n5]=5;
    78   coords[n5]=Xy(85,60);  sizes[n5]=3; colors[n5]=5; shapes[n5]=0;
    78   
    79   
    79   Edge e;
    80   Edge e;
    80 
    81 
    81   e=g.addEdge(n1,n2); ecolors[e]=0; widths[e]=1;
    82   e=g.addEdge(n1,n2); ecolors[e]=0; widths[e]=1;
    82   e=g.addEdge(n2,n3); ecolors[e]=0; widths[e]=1;
    83   e=g.addEdge(n2,n3); ecolors[e]=0; widths[e]=1;
    88   
    89   
    89   IdMap id(g);
    90   IdMap id(g);
    90 
    91 
    91   graphToEps(g,"graph_to_eps_demo_out.eps").scale(10).coords(coords).
    92   graphToEps(g,"graph_to_eps_demo_out.eps").scale(10).coords(coords).
    92     nodeScale(2).nodeSizes(sizes).
    93     nodeScale(2).nodeSizes(sizes).
       
    94     nodeShapes(shapes).
    93     nodeColors(composeMap(colorSet,colors)).
    95     nodeColors(composeMap(colorSet,colors)).
    94     edgeColors(composeMap(colorSet,ecolors)).
    96     edgeColors(composeMap(colorSet,ecolors)).
    95     edgeWidthScale(.4).edgeWidths(widths).
    97     edgeWidthScale(.4).edgeWidths(widths).
    96     nodeTexts(id).nodeTextSize(3);
    98     nodeTexts(id).nodeTextSize(3);
    97 
    99 
    98   graphToEps(g,"graph_to_eps_demo_out_arr.eps").scale(10).coords(coords).
   100   graphToEps(g,"graph_to_eps_demo_out_arr.eps").scale(10).coords(coords).
    99     nodeScale(2).nodeSizes(sizes).
   101     nodeScale(2).nodeSizes(sizes).
       
   102     nodeShapes(shapes).
   100     nodeColors(composeMap(colorSet,colors)).
   103     nodeColors(composeMap(colorSet,colors)).
   101     edgeColors(composeMap(colorSet,ecolors)).
   104     edgeColors(composeMap(colorSet,ecolors)).
   102     edgeWidthScale(.4).edgeWidths(widths).
   105     edgeWidthScale(.4).edgeWidths(widths).
   103     nodeTexts(id).nodeTextSize(3).
   106     nodeTexts(id).nodeTextSize(3).
   104     drawArrows().arrowWidth(1).arrowLength(1);
   107     drawArrows().arrowWidth(1).arrowLength(1);
   114   e=g.addEdge(n1,n2); ecolors[e]=6; widths[e]=1;
   117   e=g.addEdge(n1,n2); ecolors[e]=6; widths[e]=1;
   115   e=g.addEdge(n1,n2); ecolors[e]=7; widths[e]=1;
   118   e=g.addEdge(n1,n2); ecolors[e]=7; widths[e]=1;
   116 
   119 
   117   graphToEps(g,"graph_to_eps_demo_out_par.eps").scale(10).coords(coords).
   120   graphToEps(g,"graph_to_eps_demo_out_par.eps").scale(10).coords(coords).
   118     nodeScale(2).nodeSizes(sizes).
   121     nodeScale(2).nodeSizes(sizes).
       
   122     nodeShapes(shapes).
   119     nodeColors(composeMap(colorSet,colors)).
   123     nodeColors(composeMap(colorSet,colors)).
   120     edgeColors(composeMap(colorSet,ecolors)).
   124     edgeColors(composeMap(colorSet,ecolors)).
   121     edgeWidthScale(.4).edgeWidths(widths).
   125     edgeWidthScale(.4).edgeWidths(widths).
   122     nodeTexts(id).nodeTextSize(3).
   126     nodeTexts(id).nodeTextSize(3).
   123     enableParallel().parEdgeDist(1.5);
   127     enableParallel().parEdgeDist(1.5);
   124 
   128 
   125   graphToEps(g,"graph_to_eps_demo_out_par_arr.eps").scale(10).coords(coords).
   129   graphToEps(g,"graph_to_eps_demo_out_par_arr.eps").scale(10).coords(coords).
   126     nodeScale(2).nodeSizes(sizes).
   130     nodeScale(2).nodeSizes(sizes).
       
   131     nodeShapes(shapes).
   127     nodeColors(composeMap(colorSet,colors)).
   132     nodeColors(composeMap(colorSet,colors)).
   128     edgeColors(composeMap(colorSet,ecolors)).
   133     edgeColors(composeMap(colorSet,ecolors)).
   129     edgeWidthScale(.3).edgeWidths(widths).
   134     edgeWidthScale(.3).edgeWidths(widths).
   130     nodeTexts(id).nodeTextSize(3).
   135     nodeTexts(id).nodeTextSize(3).
   131     enableParallel().parEdgeDist(1).
   136     enableParallel().parEdgeDist(1).
       
   137     //    hideNodes().
   132     drawArrows().arrowWidth(1).arrowLength(1);
   138     drawArrows().arrowWidth(1).arrowLength(1);
   133 }
   139 }