/* -*- C++ -*- * * This file is a part of LEMON, a generic C++ optimization library * * Copyright (C) 2003-2008 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport * (Egervary Research Group on Combinatorial Optimization, EGRES). * * Permission to use, modify and distribute this software is granted * provided that this copyright notice appears in all copies. For * precise terms see the accompanying LICENSE file. * * This software is provided "AS IS" with no warranty of any kind, * express or implied, and with no claim as to its suitability for any * purpose. * */ ///\ingroup demos ///\file ///\brief An introduction to LEMON maps /// /// \include maps_summary.cc #include #include using namespace lemon; template < typename GRAPH, typename MAP > typename MAP::Value summary( GRAPH& gr, MAP& m ) { typename MAP::Value summ = typename MAP::Value(); for( typename GRAPH::NodeIt n(gr); n != lemon::INVALID; ++n ) summ += m[n]; return summ; } int main() { ListGraph gr; ListGraph::NodeMap value(gr, 0.0); //TODO: build a graph std::cout << "The summary of assigned values is " << summary(gr,value) << std::endl; return 0; }