Various improvements in NetworkSimplex.
- Faster variant of "Altering Candidate List" pivot rule using make_heap
instead of partial_sort.
- Doc improvements.
- Removing unecessary inline keywords.
3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2008
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
20 ///\brief Dim (DIMACS) to Dot (Graphviz) converter
22 /// This program can convert the DIMACS format to Graphviz format.
24 /// <tt>dim_to_dot dimacs_max_flow_file > dot_output_file</tt>
26 /// This program makes a dot file from a DIMACS max flow file.
27 /// This program can be an aid in making up to date visualized
28 /// documantation of demo programs.
30 /// \include dim_to_dot.cc
35 #include <lemon/smart_graph.h>
36 #include <lemon/dimacs.h>
38 using namespace lemon;
43 int main(int argc, char *argv[])
47 std::cerr << "USAGE: dim_to_dot input_file.dim" << std::endl;
48 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;
52 //input stream to read the graph from
53 std::ifstream is(argv[1]);
55 typedef SmartGraph Graph;
57 typedef Graph::Edge Edge;
58 typedef Graph::Node Node;
59 typedef Graph::EdgeIt EdgeIt;
60 typedef Graph::NodeIt NodeIt;
61 typedef Graph::EdgeMap<int> LengthMap;
67 readDimacs(is, g, length, s, t);
69 cout << "digraph lemon_dot_example {" << endl;
70 cout << " node [ shape=ellipse, fontname=Helvetica, fontsize=10 ];" << endl;
71 for(NodeIt n(g); n!=INVALID; ++n) {
73 cout << " n" << g.id(n)
74 << " [ label=\"" << g.id(n) << " (s)\" ]; " << endl;
77 cout << " n" << g.id(n)
78 << " [ label=\"" << g.id(n) << " (t)\" ]; " << endl;
80 cout << " n" << g.id(n)
81 << " [ label=\"" << g.id(n) << "\" ]; " << endl;
85 cout << " edge [ shape=ellipse, fontname=Helvetica, fontsize=10 ];" << endl;
86 for(EdgeIt e(g); e!=INVALID; ++e) {
87 cout << " n" << g.id(g.source(e)) << " -> " << " n" << g.id(g.target(e))
88 << " [ label=\"" << g.id(e)
89 << ", length:" << length[e] << "\" ]; " << endl;