# HG changeset patch # User athos # Date 1122045329 0 # Node ID 2b329fd595ef8924d3a8c74a9ee1777ae79bfe04 # Parent 5fd89def7cbc1c5e75cea84980d14dce2f4f1a67 Documented some more demo programs. diff -r 5fd89def7cbc -r 2b329fd595ef demo/dijkstra_demo.cc --- a/demo/dijkstra_demo.cc Fri Jul 22 15:03:23 2005 +0000 +++ b/demo/dijkstra_demo.cc Fri Jul 22 15:15:29 2005 +0000 @@ -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 #include @@ -51,7 +76,7 @@ std::cout << "The id of s is " << g.id(s)<< ", the id of t is " << g.id(t)<<"."< dijkstra_test(g,len); diff -r 5fd89def7cbc -r 2b329fd595ef demo/hello_lemon.cc --- a/demo/hello_lemon.cc Fri Jul 22 15:03:23 2005 +0000 +++ b/demo/hello_lemon.cc Fri Jul 22 15:15:29 2005 +0000 @@ -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 #include diff -r 5fd89def7cbc -r 2b329fd595ef demo/kruskal_demo.cc --- a/demo/kruskal_demo.cc Fri Jul 22 15:03:23 2005 +0000 +++ b/demo/kruskal_demo.cc Fri Jul 22 15:15:29 2005 +0000 @@ -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 #include diff -r 5fd89def7cbc -r 2b329fd595ef demo/lp_maxflow_demo.cc --- a/demo/lp_maxflow_demo.cc Fri Jul 22 15:03:23 2005 +0000 +++ b/demo/lp_maxflow_demo.cc Fri Jul 22 15:15:29 2005 +0000 @@ -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 diff -r 5fd89def7cbc -r 2b329fd595ef demo/reader_writer_demo.cc --- a/demo/reader_writer_demo.cc Fri Jul 22 15:03:23 2005 +0000 +++ b/demo/reader_writer_demo.cc Fri Jul 22 15:15:29 2005 +0000 @@ -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 #include #include @@ -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; diff -r 5fd89def7cbc -r 2b329fd595ef demo/sub_graph_adaptor_demo.cc --- a/demo/sub_graph_adaptor_demo.cc Fri Jul 22 15:03:23 2005 +0000 +++ b/demo/sub_graph_adaptor_demo.cc Fri Jul 22 15:15:29 2005 +0000 @@ -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 #include @@ -16,11 +38,9 @@ #include #include +#include -//#include -//#include - 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 writer(std::cout, g); -// writer.writeEdgeMap("length", length); -// writer.writeNode("source",s); -// writer.writeNode("target",t); -// writer.run(); -// GraphReader reader(is,g); -// reader.readNode("source",s).readNode("target",t) -// .readEdgeMap("length",length).run(); + GraphReader 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)