Ordering in the graph concept.
2 * demo/lp_maxflow_demo.cc - Part of LEMON, a generic C++ optimization library
4 * Copyright (C) 2005 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.
26 #include <lemon/list_graph.h>
30 typedef lemon::ListGraph Graph;
31 typedef Graph::EdgeIt EdgeIt;
32 typedef Graph::Edge Edge;
33 typedef Graph::NodeIt NodeIt;
34 typedef Graph::Node Node;
35 typedef Graph::EdgeMap<int> LengthMap;
47 Edge s_v2=g.addEdge(s, v2);
48 Edge s_v3=g.addEdge(s, v3);
49 Edge v2_v4=g.addEdge(v2, v4);
50 Edge v2_v5=g.addEdge(v2, v5);
51 Edge v3_v5=g.addEdge(v3, v5);
52 Edge v4_t=g.addEdge(v4, t);
53 Edge v5_t=g.addEdge(v5, t);
65 std::cout << "Hello World!" << std::endl;
66 std::cout << std::endl;
67 std::cout << "This is library LEMON here! We have a graph!" << std::endl;
68 std::cout << std::endl;
70 std::cout << "Nodes:";
71 for (NodeIt i(g); i!=INVALID; ++i)
72 std::cout << " " << g.id(i);
73 std::cout << std::endl;
75 std::cout << "Edges:";
76 for (EdgeIt i(g); i!=INVALID; ++i)
77 std::cout << " (" << g.id(g.source(i)) << "," << g.id(g.target(i)) << ")";
78 std::cout << std::endl;
79 std::cout << std::endl;
81 std::cout << "There is a map on the edges (length)!" << std::endl;
82 std::cout << std::endl;
83 for (EdgeIt i(g); i!=INVALID; ++i)
84 std::cout << "length(" << g.id(g.source(i)) << "," << g.id(g.target(i)) << ")="<<length[i]<<std::endl;
86 std::cout << std::endl;