Set the move tool active by default.
2 * demo/dim_to_dot.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
17 // Use a DIMACS max flow file as stdin.
18 // dim_to_dot < dimacs_max_flow_file > dot_output_file
19 // This program makes a dot file from a dimacs max flow file.
20 // This program can be an aid in making up to date visualized documantation
23 // For later documentation (if marci does not do it)
24 // Az a graphviz csomag egy egyszeru formatuma, ami egy graphrajzolo csomag.
25 // Az EdgeSubGraphAdaptor doksijaban szerepel egy kirajzolt graf. Azt nem
26 // kezzel csinaltam, hanem a megfelelo dim file-bol ezzel a progival. A
27 // doxygen ugyanis ilyet eszik, igy a juzer vizualisan is latja a grafot a
28 // doksiban, es sajat maga is le tudja futtatni az algoritmust, mert ott van
29 // a kezeben a dim file is. Es mivel ez egy generalt file, ezert ha vmit
30 // valtoztatunk a dim-en, ezt is konnyu bemasolni. Uff.
36 #include <lemon/smart_graph.h>
37 #include <lemon/dimacs.h>
39 using namespace lemon;
44 int main(int argc, char *argv[])
48 std::cerr << "USAGE: sub_graph_adaptor_demo input_file.dim" << std::endl;
49 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;
54 //input stream to read the graph from
55 std::ifstream is(argv[1]);
57 typedef SmartGraph Graph;
59 typedef Graph::Edge Edge;
60 typedef Graph::Node Node;
61 typedef Graph::EdgeIt EdgeIt;
62 typedef Graph::NodeIt NodeIt;
63 typedef Graph::EdgeMap<int> LengthMap;
69 readDimacs(is, g, length, s, t);
71 cout << "digraph lemon_dot_example {" << endl;
72 cout << " node [ shape=ellipse, fontname=Helvetica, fontsize=10 ];" << endl;
73 for(NodeIt n(g); n!=INVALID; ++n) {
75 cout << " n" << g.id(n)
76 << " [ label=\"" << g.id(n) << " (s)\" ]; " << endl;
79 cout << " n" << g.id(n)
80 << " [ label=\"" << g.id(n) << " (t)\" ]; " << endl;
82 cout << " n" << g.id(n)
83 << " [ label=\"" << g.id(n) << "\" ]; " << endl;
87 cout << " edge [ shape=ellipse, fontname=Helvetica, fontsize=10 ];" << endl;
88 for(EdgeIt e(g); e!=INVALID; ++e) {
89 cout << " n" << g.id(g.source(e)) << " -> " << " n" << g.id(g.target(e))
90 << " [ label=\"" << g.id(e)
91 << ", length:" << length[e] << "\" ]; " << endl;