# HG changeset patch # User alpar # Date 1155205084 0 # Node ID 4b25e7003868a525d9345670ef9b699b6a892165 # Parent f40343b498efe5c666a359edbc3d77924d5f9bce - Change ColorSet to Palette - Minor change in graph_orientation demo. diff -r f40343b498ef -r 4b25e7003868 demo/coloring.cc --- a/demo/coloring.cc Thu Aug 10 10:11:07 2006 +0000 +++ b/demo/coloring.cc Thu Aug 10 10:18:04 2006 +0000 @@ -97,11 +97,11 @@ color[order[i]] = current; } - ColorSet colorSet; + Palette palette; graphToEps(graph, "coloring.eps"). title("Six Colored Plan Graph").copyright("(C) 2006 LEMON Project"). - coords(coords).nodeColors(composeMap(colorSet, color)). + coords(coords).nodeColors(composeMap(palette, color)). nodeScale(5.0).scaleToA4().run(); return 0; diff -r f40343b498ef -r 4b25e7003868 demo/graph_orientation.cc --- a/demo/graph_orientation.cc Thu Aug 10 10:11:07 2006 +0000 +++ b/demo/graph_orientation.cc Thu Aug 10 10:18:04 2006 +0000 @@ -25,13 +25,7 @@ using namespace lemon; - -typedef ListGraph::Node Node; -typedef ListGraph::NodeIt NodeIt; -typedef ListGraph::Edge Edge; -typedef ListGraph::EdgeIt EdgeIt; -typedef ListGraph::OutEdgeIt OutEdgeIt; -typedef ListGraph::InEdgeIt InEdgeIt; +GRAPH_TYPEDEFS(ListGraph) int main(int argc, char** argv) { @@ -113,7 +107,7 @@ nodeScale(15). coords(coords). negateY(). - edgeColors(composeMap(ColorSet(),rev)). + edgeColors(composeMap(Palette(),rev)). edgeWidthScale(1). nodeTexts(f).nodeTextSize(20). drawArrows().arrowWidth(10).arrowLength(10). diff -r f40343b498ef -r 4b25e7003868 demo/graph_to_eps_demo.cc --- a/demo/graph_to_eps_demo.cc Thu Aug 10 10:11:07 2006 +0000 +++ b/demo/graph_to_eps_demo.cc Thu Aug 10 10:18:04 2006 +0000 @@ -41,7 +41,7 @@ int main() { - ColorSet colorSet; + Palette palette; ListGraph g; typedef ListGraph::Node Node; @@ -88,8 +88,8 @@ copyright("(C) 2006 LEMON Project"). nodeScale(2).nodeSizes(sizes). nodeShapes(shapes). - nodeColors(composeMap(colorSet,colors)). - edgeColors(composeMap(colorSet,ecolors)). + nodeColors(composeMap(palette,colors)). + edgeColors(composeMap(palette,ecolors)). edgeWidthScale(.4).edgeWidths(widths). nodeTexts(id).nodeTextSize(3). run(); @@ -100,11 +100,11 @@ //scale(10). title("Sample .eps figure (with arrowheads)"). copyright("(C) 2006 LEMON Project"). - nodeColors(composeMap(colorSet,colors)). + nodeColors(composeMap(palette,colors)). coords(coords). nodeScale(2).nodeSizes(sizes). nodeShapes(shapes). - edgeColors(composeMap(colorSet,ecolors)). + edgeColors(composeMap(palette,ecolors)). edgeWidthScale(.4).edgeWidths(widths). nodeTexts(id).nodeTextSize(3). drawArrows().arrowWidth(1).arrowLength(1). @@ -129,8 +129,8 @@ nodeShapes(shapes). coords(coords). nodeScale(2).nodeSizes(sizes). - nodeColors(composeMap(colorSet,colors)). - edgeColors(composeMap(colorSet,ecolors)). + nodeColors(composeMap(palette,colors)). + edgeColors(composeMap(palette,ecolors)). edgeWidthScale(.4).edgeWidths(widths). nodeTexts(id).nodeTextSize(3). enableParallel().parEdgeDist(1.5). @@ -144,8 +144,8 @@ nodeScale(2).nodeSizes(sizes). coords(coords). nodeShapes(shapes). - nodeColors(composeMap(colorSet,colors)). - edgeColors(composeMap(colorSet,ecolors)). + nodeColors(composeMap(palette,colors)). + edgeColors(composeMap(palette,ecolors)). edgeWidthScale(.3).edgeWidths(widths). nodeTexts(id).nodeTextSize(3). enableParallel().parEdgeDist(1). @@ -159,8 +159,8 @@ nodeScale(2).nodeSizes(sizes). coords(coords). nodeShapes(shapes). - nodeColors(composeMap(colorSet,colors)). - edgeColors(composeMap(colorSet,ecolors)). + nodeColors(composeMap(palette,colors)). + edgeColors(composeMap(palette,ecolors)). edgeWidthScale(.3).edgeWidths(widths). nodeTexts(id).nodeTextSize(3). enableParallel().parEdgeDist(1). @@ -171,8 +171,8 @@ ListGraph::NodeMap hcolors(h); ListGraph::NodeMap hcoords(h); - int cols=int(sqrt(double(colorSet.size()))); - for(int i=0;i compMap(graph); connectedComponents(graph, compMap); @@ -64,7 +64,7 @@ graphToEps(graph, "connected_components.eps").undirected(). coords(coords).scaleToA4().enableParallel(). parEdgeDist(20.0).edgeWidthScale(2.0).nodeScale(20.0). - nodeColors(composeMap(colorSet, compMap)).run(); + nodeColors(composeMap(palette, compMap)).run(); std::cout << "Result: connected_components.eps" << std::endl; } @@ -81,7 +81,7 @@ readNodeMap("coordinates_y", yMap(coords)). run(); - ColorSet colorSet; + Palette palette; Graph::NodeMap compMap(graph); Graph::EdgeMap cutMap(graph); @@ -92,7 +92,7 @@ coords(coords).scaleToA4().enableParallel(). drawArrows().arrowWidth(10.0).arrowLength(10.0). parEdgeDist(20.0).edgeWidthScale(2.0).nodeScale(20.0). - nodeColors(composeMap(colorSet, compMap)). + nodeColors(composeMap(palette, compMap)). edgeColors(composeMap(functorMap(&color), cutMap)).run(); std::cout << "Result: strongly_connected_components.eps" << std::endl; @@ -111,7 +111,7 @@ readNodeMap("coordinates_y", yMap(coords)). run(); - ColorSet colorSet; + Palette palette; Graph::UEdgeMap compMap(graph); Graph::NodeMap cutMap(graph); @@ -121,7 +121,7 @@ graphToEps(graph, "bi_node_connected_components.eps").undirected(). coords(coords).scaleToA4().enableParallel(). parEdgeDist(20.0).edgeWidthScale(5.0).nodeScale(20.0). - edgeColors(composeMap(colorSet, compMap)). + edgeColors(composeMap(palette, compMap)). nodeColors(composeMap(functorMap(&color), cutMap)). run(); @@ -141,7 +141,7 @@ readNodeMap("coordinates_y", yMap(coords)). run(); - ColorSet colorSet; + Palette palette; Graph::NodeMap compMap(graph); Graph::UEdgeMap cutMap(graph); @@ -151,7 +151,7 @@ graphToEps(graph, "bi_edge_connected_components.eps").undirected(). coords(coords).scaleToA4().enableParallel(). parEdgeDist(20.0).edgeWidthScale(2.0).nodeScale(20.0). - nodeColors(composeMap(colorSet, compMap)). + nodeColors(composeMap(palette, compMap)). edgeColors(composeMap(functorMap(&color), cutMap)).run(); std::cout << "Result: bi_edge_connected_components.eps" << std::endl; @@ -170,7 +170,7 @@ readNodeMap("coordinates_y", yMap(coords)). run(); - ColorSet colorSet; + Palette palette; Graph::NodeMap partMap(graph); bipartitePartitions(graph, partMap); diff -r f40343b498ef -r 4b25e7003868 doc/graph_orientation.dox --- a/doc/graph_orientation.dox Thu Aug 10 10:11:07 2006 +0000 +++ b/doc/graph_orientation.dox Thu Aug 10 10:18:04 2006 +0000 @@ -53,9 +53,22 @@ following line seems to be useful. \skipline namespace -The following typedefs will also save a lot of typing. -\skip typedef -\until InEdgeIt +The following macro will also save a lot of typing by defining some +convenience typedefs. + +\skipline TYPEDEF + +Actually, the macro above would be equivalent with the following +typedefs. + +\code +typedef ListGraph::Node Node; +typedef ListGraph::NodeIt NodeIt; +typedef ListGraph::Edge Edge; +typedef ListGraph::EdgeIt EdgeIt; +typedef ListGraph::OutEdgeIt OutEdgeIt; +typedef ListGraph::InEdgeIt InEdgeIt; +\endcode \subsection go-alg-main The main() function @@ -152,7 +165,7 @@ \c bool values of \c rev are transformed into different \ref lemon::Color "RGB color"s using the class -\ref lemon::ColorSet "ColorSet" +\ref lemon::Palette "Palette" and the \ref map_adaptors "map adaptor" called \ref lemon::ComposeMap "composeMap". diff -r f40343b498ef -r 4b25e7003868 lemon/color.h --- a/lemon/color.h Thu Aug 10 10:11:07 2006 +0000 +++ b/lemon/color.h Thu Aug 10 10:18:04 2006 +0000 @@ -81,7 +81,7 @@ ///This is a true \ref concept::ReferenceMap "reference map", so you can also ///change the actual colors. -class ColorSet : public MapBase +class Palette : public MapBase { std::vector colors; public: @@ -96,7 +96,7 @@ ///If \c num is less then 26/27 then the default color list is cut. Otherwise ///the color list is filled repeatedly with the default color list. ///(The colors can be changed later on.) - ColorSet(bool have_white=false,int num=0) + Palette(bool have_white=false,int num=0) { do { if(have_white) colors.push_back(Color(1,1,1)); diff -r f40343b498ef -r 4b25e7003868 lemon/graph_to_eps.h --- a/lemon/graph_to_eps.h Thu Aug 10 10:11:07 2006 +0000 +++ b/lemon/graph_to_eps.h Thu Aug 10 10:18:04 2006 +0000 @@ -426,7 +426,7 @@ ///Sets the map of the node colors ///\param x must be a node map with \ref Color values. /// - ///\sa ColorSet + ///\sa Palette template GraphToEps > nodeColors(const X &x) { @@ -442,7 +442,7 @@ ///Sets the map of the node text colors ///\param x must be a node map with \ref Color values. /// - ///\sa ColorSet + ///\sa Palette template GraphToEps > nodeTextColors(const X &x) { @@ -460,7 +460,7 @@ ///Sets the map of the edge colors ///\param x must be a edge map with \ref Color values. /// - ///\sa ColorSet + ///\sa Palette template GraphToEps > edgeColors(const X &x) {