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