More "doxygenish" syntax.
3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2006
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 dot format.
24 /// Use a DIMACS max flow file as stdin.
26 /// <tt>dim_to_dot < dimacs_max_flow_file > dot_output_file</tt>
28 /// This program makes a dot file from a dimacs max flow file.
29 /// This program can be an aid in making up to date visualized documantation
32 /// \include dim_to_dot.cc
37 #include <lemon/smart_graph.h>
38 #include <lemon/dimacs.h>
40 using namespace lemon;
45 int main(int argc, char *argv[])
49 std::cerr << "USAGE: sub_graph_adaptor_demo input_file.dim" << std::endl;
50 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;
55 //input stream to read the graph from
56 std::ifstream is(argv[1]);
58 typedef SmartGraph Graph;
60 typedef Graph::Edge Edge;
61 typedef Graph::Node Node;
62 typedef Graph::EdgeIt EdgeIt;
63 typedef Graph::NodeIt NodeIt;
64 typedef Graph::EdgeMap<int> LengthMap;
70 readDimacs(is, g, length, s, t);
72 cout << "digraph lemon_dot_example {" << endl;
73 cout << " node [ shape=ellipse, fontname=Helvetica, fontsize=10 ];" << endl;
74 for(NodeIt n(g); n!=INVALID; ++n) {
76 cout << " n" << g.id(n)
77 << " [ label=\"" << g.id(n) << " (s)\" ]; " << endl;
80 cout << " n" << g.id(n)
81 << " [ label=\"" << g.id(n) << " (t)\" ]; " << endl;
83 cout << " n" << g.id(n)
84 << " [ label=\"" << g.id(n) << "\" ]; " << endl;
88 cout << " edge [ shape=ellipse, fontname=Helvetica, fontsize=10 ];" << endl;
89 for(EdgeIt e(g); e!=INVALID; ++e) {
90 cout << " n" << g.id(g.source(e)) << " -> " << " n" << g.id(g.target(e))
91 << " [ label=\"" << g.id(e)
92 << ", length:" << length[e] << "\" ]; " << endl;