Ordering in the graph concept.
3 // Use a DIMACS max flow file as stdin.
4 // dim_to_dot < dimacs_max_flow_file > dot_output_file
5 // This program makes a dot file from a dimacs max flow file.
6 // This program can be an aid in making up to date visualized documantation
9 // For later documentation (if marci does not do it)
10 // Az a graphviz csomag egy egyszeru formatuma, ami egy graphrajzolo csomag.
11 // Az EdgeSubGraphAdaptor doksijaban szerepel egy kirajzolt graf. Azt nem
12 // kezzel csinaltam, hanem a megfelelo dim file-bol ezzel a progival. A
13 // doxygen ugyanis ilyet eszik, igy a juzer vizualisan is latja a grafot a
14 // doksiban, es sajat maga is le tudja futtatni az algoritmust, mert ott van
15 // a kezeben a dim file is. Es mivel ez egy generalt file, ezert ha vmit
16 // valtoztatunk a dim-en, ezt is konnyu bemasolni. Uff.
22 #include <lemon/smart_graph.h>
23 #include <lemon/dimacs.h>
25 using namespace lemon;
30 int main(int argc, char *argv[])
34 std::cerr << "USAGE: sub_graph_adaptor_demo input_file.dim" << std::endl;
35 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;
40 //input stream to read the graph from
41 std::ifstream is(argv[1]);
43 typedef SmartGraph Graph;
45 typedef Graph::Edge Edge;
46 typedef Graph::Node Node;
47 typedef Graph::EdgeIt EdgeIt;
48 typedef Graph::NodeIt NodeIt;
49 typedef Graph::EdgeMap<int> LengthMap;
55 readDimacs(is, g, length, s, t);
57 cout << "digraph lemon_dot_example {" << endl;
58 cout << " node [ shape=ellipse, fontname=Helvetica, fontsize=10 ];" << endl;
59 for(NodeIt n(g); n!=INVALID; ++n) {
61 cout << " n" << g.id(n)
62 << " [ label=\"" << g.id(n) << " (s)\" ]; " << endl;
65 cout << " n" << g.id(n)
66 << " [ label=\"" << g.id(n) << " (t)\" ]; " << endl;
68 cout << " n" << g.id(n)
69 << " [ label=\"" << g.id(n) << "\" ]; " << endl;
73 cout << " edge [ shape=ellipse, fontname=Helvetica, fontsize=10 ];" << endl;
74 for(EdgeIt e(g); e!=INVALID; ++e) {
75 cout << " n" << g.id(g.source(e)) << " -> " << " n" << g.id(g.target(e))
76 << " [ label=\"" << g.id(e)
77 << ", length:" << length[e] << "\" ]; " << endl;