maps_summary.cc File Reference


Detailed Description

/* -*- 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.
 *
 */


#include <iostream>
#include <lemon/list_graph.h>

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<double>  value(gr, 0.0);

  //TODO: build a graph  
  
  std::cout << "The summary of assigned values is " << summary(gr,value) << std::endl;

  return 0;
}
#include <iostream>
#include <lemon/list_graph.h>

Generated on Thu Jun 4 04:03:09 2009 for LEMON by  doxygen 1.5.9