diff -r da94e3b332f3 -r 48dddc283cfc doc/groups.dox --- a/doc/groups.dox Tue Oct 09 09:36:54 2007 +0000 +++ b/doc/groups.dox Tue Oct 09 15:46:12 2007 +0000 @@ -97,6 +97,57 @@ make arithmetic operations between one or two maps (negation, scaling, addition, multiplication etc.) or e.g. convert a map to another one of different Value type. + +The typical usage of this classes is the passing implicit maps to +algorithms. If a function type algorithm is called then the function +type map adaptors can be used comfortable. For example let's see the +usage of map adaptors with the \c graphToEps() function: +\code + Color nodeColor(int deg) { + if (deg >= 2) { + return Color(0.5, 0.0, 0.5); + } else if (deg == 1) { + return Color(1.0, 0.5, 1.0); + } else { + return Color(0.0, 0.0, 0.0); + } + } + + Graph::NodeMap degree_map(graph); + + graphToEps(graph, "graph.eps") + .coords(coords).scaleToA4().undirected() + .nodeColors(composeMap(functorMap(nodeColor), degree_map)) + .run(); +\endcode +The \c functorMap() function makes an \c int to \c Color map from the +\e nodeColor() function. The \c composeMap() compose the \e degree_map +and the previous created map. The composed map is proper function to +get color of each node. + +The usage with class type algorithms is little bit harder. In this +case the function type map adaptors can not be used, because the +function map adaptors give back temporarly objects. +\code + Graph graph; + + typedef Graph::EdgeMap DoubleEdgeMap; + DoubleEdgeMap length(graph); + DoubleEdgeMap speed(graph); + + typedef DivMap TimeMap; + + TimeMap time(length, speed); + + Dijkstra dijkstra(graph, time); + dijkstra.run(source, target); +\endcode + +We have a length map and a maximum speed map on a graph. The minimum +time to pass the edge can be calculated as the division of the two +maps which can be done implicitly with the \c DivMap template +class. We use the implicit minimum time map as the length map of the +\c Dijkstra algorithm. */ /** @@ -115,9 +166,10 @@ LEMON provides flexible data structures to work with paths. -All of them have the same interface, especially they can be built or extended -using a standard Builder subclass. This make is easy to have e.g. the Dijkstra -algorithm to store its result in any kind of path structure. +All of them have similar interfaces, and it can be copied easily with +assignment operator and copy constructor. This make it easy and +efficient to have e.g. the Dijkstra algorithm to store its result in +any kind of path structure. \sa lemon::concepts::Path