Polish the doc.
2 * demo/hello_lemon.cc - Part of LEMON, a generic C++ optimization library
4 * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
5 * (Egervary Research Group on Combinatorial Optimization, EGRES).
7 * Permission to use, modify and distribute this software is granted
8 * provided that this copyright notice appears in all copies. For
9 * precise terms see the accompanying LICENSE file.
11 * This software is provided "AS IS" with no warranty of any kind,
12 * express or implied, and with no claim as to its suitability for any
19 ///\brief LEMON style "Hello World!" program
21 /// This program is intended to be a "Hello World!" program that shows
22 /// the very basic notions of the LEMON library: \ref graphs "graphs" and
23 /// \ref maps-page "maps". Click on the links to read more about these.
25 /// \include hello_lemon.cc
28 #include <lemon/list_graph.h>
32 typedef lemon::ListGraph Graph;
33 typedef Graph::EdgeIt EdgeIt;
34 typedef Graph::Edge Edge;
35 typedef Graph::NodeIt NodeIt;
36 typedef Graph::Node Node;
37 typedef Graph::EdgeMap<int> LengthMap;
49 Edge s_v2=g.addEdge(s, v2);
50 Edge s_v3=g.addEdge(s, v3);
51 Edge v2_v4=g.addEdge(v2, v4);
52 Edge v2_v5=g.addEdge(v2, v5);
53 Edge v3_v5=g.addEdge(v3, v5);
54 Edge v4_t=g.addEdge(v4, t);
55 Edge v5_t=g.addEdge(v5, t);
67 std::cout << "Hello World!" << std::endl;
68 std::cout << std::endl;
69 std::cout << "This is library LEMON here! We have a graph!" << std::endl;
70 std::cout << std::endl;
72 std::cout << "Nodes:";
73 for (NodeIt i(g); i!=INVALID; ++i)
74 std::cout << " " << g.id(i);
75 std::cout << std::endl;
77 std::cout << "Edges:";
78 for (EdgeIt i(g); i!=INVALID; ++i)
79 std::cout << " (" << g.id(g.source(i)) << "," << g.id(g.target(i)) << ")";
80 std::cout << std::endl;
81 std::cout << std::endl;
83 std::cout << "There is a map on the edges (length)!" << std::endl;
84 std::cout << std::endl;
85 for (EdgeIt i(g); i!=INVALID; ++i)
86 std::cout << "length(" << g.id(g.source(i)) << ","
87 << g.id(g.target(i)) << ")="<<length[i]<<std::endl;
89 std::cout << std::endl;