[Lemon-commits] [lemon_svn] athos: r2085 - hugo/trunk/demo
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:50:01 CET 2006
Author: athos
Date: Fri Jul 22 17:15:29 2005
New Revision: 2085
Modified:
hugo/trunk/demo/dijkstra_demo.cc
hugo/trunk/demo/hello_lemon.cc
hugo/trunk/demo/kruskal_demo.cc
hugo/trunk/demo/lp_maxflow_demo.cc
hugo/trunk/demo/reader_writer_demo.cc
hugo/trunk/demo/sub_graph_adaptor_demo.cc
Log:
Documented some more demo programs.
Modified: hugo/trunk/demo/dijkstra_demo.cc
==============================================================================
--- hugo/trunk/demo/dijkstra_demo.cc (original)
+++ hugo/trunk/demo/dijkstra_demo.cc Fri Jul 22 17:15:29 2005
@@ -1,3 +1,28 @@
+/* -*- C++ -*-
+ * demo/lp_maxflow_demo.cc - Part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2005 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 Demonstrating LEMON implementation of the Dijkstra algorithm
+///
+/// Dijkstra's algorithm computes shortest paths between two nodes in
+/// a graph with edge lengths. Here we only show some of the
+/// facilities supplied by our implementation: for the detailed
+/// documentation of the LEMON Dijkstra class read \ref lemon::Dijkstra "this".
+
#include <iostream>
#include <lemon/list_graph.h>
@@ -51,7 +76,7 @@
std::cout << "The id of s is " << g.id(s)<< ", the id of t is " << g.id(t)<<"."<<std::endl;
- std::cout << "Dijkstra algorithm test..." << std::endl;
+ std::cout << "Dijkstra algorithm demo..." << std::endl;
Dijkstra<Graph, LengthMap> dijkstra_test(g,len);
Modified: hugo/trunk/demo/hello_lemon.cc
==============================================================================
--- hugo/trunk/demo/hello_lemon.cc (original)
+++ hugo/trunk/demo/hello_lemon.cc Fri Jul 22 17:15:29 2005
@@ -1,3 +1,27 @@
+/* -*- C++ -*-
+ * demo/lp_maxflow_demo.cc - Part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2005 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 LEMON style "Hello World!" program
+///
+/// This program is intended to be a "Hello World!" program that shows
+/// the very basic notions of the LEMON library: \ref graphs "graphs" and
+/// \ref maps-page "maps". Click on the links to read more about these.
+
#include <iostream>
#include <lemon/list_graph.h>
Modified: hugo/trunk/demo/kruskal_demo.cc
==============================================================================
--- hugo/trunk/demo/kruskal_demo.cc (original)
+++ hugo/trunk/demo/kruskal_demo.cc Fri Jul 22 17:15:29 2005
@@ -18,8 +18,8 @@
///\file
///\brief Minimum weight spanning tree by Kruskal algorithm (demo).
///
-///This demo program shows how to find a minimum weight spannin tree
-///of a graph by using the Kruskal algorithm.
+/// This demo program shows how to find a minimum weight spanning tree
+/// in a graph by using the Kruskal algorithm.
#include <iostream>
#include <vector>
Modified: hugo/trunk/demo/lp_maxflow_demo.cc
==============================================================================
--- hugo/trunk/demo/lp_maxflow_demo.cc (original)
+++ hugo/trunk/demo/lp_maxflow_demo.cc Fri Jul 22 17:15:29 2005
@@ -18,10 +18,10 @@
///\file
///\brief Max flow problem solved with an LP solver (demo).
///
-///This demo program shows how to solve a maximum (or maximal) flow
-///problem using the LEMON LP solver interface. We would like to lay
-///the emphasis on the simplicity of the way one can formulate the LP
-///constraints with LEMON that arise in graph theory.
+/// This demo program shows how to solve a maximum (or maximal) flow
+/// problem using the LEMON LP solver interface. We would like to lay
+/// the emphasis on the simplicity of the way one can formulate LP
+/// constraints that arise in graph theory in our library LEMON .
#ifdef HAVE_CONFIG_H
#include <config.h>
Modified: hugo/trunk/demo/reader_writer_demo.cc
==============================================================================
--- hugo/trunk/demo/reader_writer_demo.cc (original)
+++ hugo/trunk/demo/reader_writer_demo.cc Fri Jul 22 17:15:29 2005
@@ -1,3 +1,28 @@
+/* -*- C++ -*-
+ * demo/lp_maxflow_demo.cc - Part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2005 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 Demonstrating graph input and output
+///
+/// This simple demo program gives an example of how to read and write
+/// a graph and additional maps (on the nodes or the edges) from/to a
+/// stream.
+
+
#include <iostream>
#include <lemon/smart_graph.h>
#include <lemon/invalid.h>
@@ -18,7 +43,7 @@
reader.run();
std::cout << "Hello! We have read a graph from file " << filename<<
- " and some maps on it: now we write this to the standard output!" <<
+ " and some maps on it:\n now we write it to the standard output!" <<
std::endl;
Modified: hugo/trunk/demo/sub_graph_adaptor_demo.cc
==============================================================================
--- hugo/trunk/demo/sub_graph_adaptor_demo.cc (original)
+++ hugo/trunk/demo/sub_graph_adaptor_demo.cc Fri Jul 22 17:15:29 2005
@@ -1,9 +1,31 @@
-// -*- c++ -*-
+/* -*- C++ -*-
+ * demo/lp_maxflow_demo.cc - Part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2005 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 Computing maximum number of edge-disjoint shortest paths
+///
+/// This program computes a maximum number of edge-disjoint shortest paths
+/// between nodes \c s and \c t.
+
// Use a DIMACS max flow file as input.
// sub_graph_adaptor_demo < dimacs_max_flow_file
-// This program computes a maximum number of edge-disjoint shortest paths
-// between s and t.
+// Modified to eat lemon graph format!
+
#include <iostream>
#include <fstream>
@@ -16,11 +38,9 @@
#include <lemon/preflow.h>
#include <tight_edge_filter_map.h>
+#include <lemon/graph_reader.h>
-//#include <lemon/graph_reader.h>
-//#include <lemon/graph_writer.h>
-
using namespace lemon;
using std::cout;
@@ -30,8 +50,11 @@
{
if(argc<2)
{
- std::cerr << "USAGE: sub_graph_adaptor_demo input_file.dim" << std::endl;
- std::cerr << "The file 'input_file.dim' has to contain a max flow instance in DIMACS format (e.g. sub_graph_adaptor_demo.dim is such a file)." << std::endl;
+ std::cerr << "USAGE: sub_graph_adaptor_demo input_file.lgf" << std::endl;
+ std::cerr << "The file 'input_file.lgf' has to contain a max flow "
+ << "instance in \n LEMON format "
+ << "(e.g. sub_gad_input.lgf is such a file)."
+ << std::endl;
return 0;
}
@@ -51,17 +74,12 @@
Node s, t;
LengthMap length(g);
- readDimacs(is, g, length, s, t);
+ //readDimacs(is, g, length, s, t);
+
-// GraphWriter<SmartGraph> writer(std::cout, g);
-// writer.writeEdgeMap("length", length);
-// writer.writeNode("source",s);
-// writer.writeNode("target",t);
-// writer.run();
-
-// GraphReader<ListGraph> reader(is,g);
-// reader.readNode("source",s).readNode("target",t)
-// .readEdgeMap("length",length).run();
+ GraphReader<SmartGraph> reader(is,g);
+ reader.readNode("source",s).readNode("target",t)
+ .readEdgeMap("length",length).run();
cout << "edges with lengths (of form id, source--length->target): " << endl;
for(EdgeIt e(g); e!=INVALID; ++e)
More information about the Lemon-commits
mailing list