Changeset 1788:614ce2dd3cba in lemon-0.x for doc/maps.dox
- Timestamp:
- 11/14/05 19:34:16 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2329
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/maps.dox
r1183 r1788 28 28 \c EdgeMap and \c NodeMap. Both are reference maps and you can easily 29 29 assign data to the nodes and to the edges of the graph. For example if you 30 have a graph \c Gdefined as30 have a graph \c g defined as 31 31 \code 32 ListGraph G;32 ListGraph g; 33 33 \endcode 34 34 and you want to assign a floating point value to each edge, you can do 35 35 it like this. 36 36 \code 37 ListGraph::EdgeMap<double> length( G);37 ListGraph::EdgeMap<double> length(g); 38 38 \endcode 39 39 Note that you must give the underlying graph to the constructor. … … 95 95 An alternative way to define maps is to use \c MapBase 96 96 97 \todo For this, \c MapBase seems to be a better name then \c NullMap.98 99 97 \code 100 98 struct MyMap : public MapBase<Graph::Edge,double> … … 117 115 public: 118 116 Value operator[](Key e) const { 119 return orig_len .get(e)-(pot.get(G.target(e))-pot.get(G.source(e)));117 return orig_len[e]-(pot[g.target(e)]-pot[g.source(e)]); 120 118 } 121 119 122 120 ReducedLengthMap(const Graph &_g, 123 const Graph::EdgeMap & o,124 const Graph::NodeMap & p)125 : G(g), orig_len(o), pot(p) {};121 const Graph::EdgeMap &_o, 122 const Graph::NodeMap &_p) 123 : g(_g), orig_len(_o), pot(_p) {}; 126 124 }; 127 125 \endcode
Note: See TracChangeset
for help on using the changeset viewer.