COIN-OR::LEMON - Graph Library

source: lemon-main/doc/groups.dox @ 416:76287c8caa26

Last change on this file since 416:76287c8caa26 was 416:76287c8caa26, checked in by Balazs Dezso <deba@…>, 15 years ago

Reorganication of graph adaptors and doc improvements (#67)

  • Moving to one file, lemon/adaptors.h
  • Renamings
  • Doc cleanings
File size: 20.8 KB
RevLine 
[209]1/* -*- mode: C++; indent-tabs-mode: nil; -*-
[40]2 *
[209]3 * This file is a part of LEMON, a generic C++ optimization library.
[40]4 *
5 * Copyright (C) 2003-2008
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
8 *
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.
12 *
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
15 * purpose.
16 *
17 */
18
19/**
20@defgroup datas Data Structures
[50]21This group describes the several data structures implemented in LEMON.
[40]22*/
23
24/**
25@defgroup graphs Graph Structures
26@ingroup datas
27\brief Graph structures implemented in LEMON.
28
[209]29The implementation of combinatorial algorithms heavily relies on
30efficient graph implementations. LEMON offers data structures which are
31planned to be easily used in an experimental phase of implementation studies,
32and thereafter the program code can be made efficient by small modifications.
[40]33
34The most efficient implementation of diverse applications require the
35usage of different physical graph implementations. These differences
36appear in the size of graph we require to handle, memory or time usage
37limitations or in the set of operations through which the graph can be
38accessed.  LEMON provides several physical graph structures to meet
39the diverging requirements of the possible users.  In order to save on
40running time or on memory usage, some structures may fail to provide
[83]41some graph features like arc/edge or node deletion.
[40]42
[209]43Alteration of standard containers need a very limited number of
44operations, these together satisfy the everyday requirements.
45In the case of graph structures, different operations are needed which do
46not alter the physical graph, but gives another view. If some nodes or
[83]47arcs have to be hidden or the reverse oriented graph have to be used, then
[209]48this is the case. It also may happen that in a flow implementation
49the residual graph can be accessed by another algorithm, or a node-set
50is to be shrunk for another algorithm.
51LEMON also provides a variety of graphs for these requirements called
52\ref graph_adaptors "graph adaptors". Adaptors cannot be used alone but only
53in conjunction with other graph representations.
[40]54
55You are free to use the graph structure that fit your requirements
56the best, most graph algorithms and auxiliary data structures can be used
[314]57with any graph structure.
58
59<b>See also:</b> \ref graph_concepts "Graph Structure Concepts".
[40]60*/
61
62/**
[416]63@defgroup graph_adaptors Adaptor Classes for graphs
64@ingroup graphs
65\brief This group contains several adaptor classes for digraphs and graphs
66
67The main parts of LEMON are the different graph structures, generic
68graph algorithms, graph concepts which couple these, and graph
69adaptors. While the previous notions are more or less clear, the
70latter one needs further explanation. Graph adaptors are graph classes
71which serve for considering graph structures in different ways.
72
73A short example makes this much clearer.  Suppose that we have an
74instance \c g of a directed graph type say ListDigraph and an algorithm
75\code
76template <typename Digraph>
77int algorithm(const Digraph&);
78\endcode
79is needed to run on the reverse oriented graph.  It may be expensive
80(in time or in memory usage) to copy \c g with the reversed
81arcs.  In this case, an adaptor class is used, which (according
82to LEMON digraph concepts) works as a digraph.  The adaptor uses the
83original digraph structure and digraph operations when methods of the
84reversed oriented graph are called.  This means that the adaptor have
85minor memory usage, and do not perform sophisticated algorithmic
86actions.  The purpose of it is to give a tool for the cases when a
87graph have to be used in a specific alteration.  If this alteration is
88obtained by a usual construction like filtering the arc-set or
89considering a new orientation, then an adaptor is worthwhile to use.
90To come back to the reverse oriented graph, in this situation
91\code
92template<typename Digraph> class ReverseDigraph;
93\endcode
94template class can be used. The code looks as follows
95\code
96ListDigraph g;
97ReverseDigraph<ListGraph> rg(g);
98int result = algorithm(rg);
99\endcode
100After running the algorithm, the original graph \c g is untouched.
101This techniques gives rise to an elegant code, and based on stable
102graph adaptors, complex algorithms can be implemented easily.
103
104In flow, circulation and bipartite matching problems, the residual
105graph is of particular importance. Combining an adaptor implementing
106this, shortest path algorithms and minimum mean cycle algorithms,
107a range of weighted and cardinality optimization algorithms can be
108obtained. For other examples, the interested user is referred to the
109detailed documentation of particular adaptors.
110
111The behavior of graph adaptors can be very different. Some of them keep
112capabilities of the original graph while in other cases this would be
113meaningless. This means that the concepts that they are models of depend
114on the graph adaptor, and the wrapped graph(s).
115If an arc of \c rg is deleted, this is carried out by deleting the
116corresponding arc of \c g, thus the adaptor modifies the original graph.
117
118But for a residual graph, this operation has no sense.
119Let us stand one more example here to simplify your work.
120RevGraphAdaptor has constructor
121\code
122ReverseDigraph(Digraph& digraph);
123\endcode
124This means that in a situation, when a <tt>const ListDigraph&</tt>
125reference to a graph is given, then it have to be instantiated with
126<tt>Digraph=const ListDigraph</tt>.
127\code
128int algorithm1(const ListDigraph& g) {
129  RevGraphAdaptor<const ListDigraph> rg(g);
130  return algorithm2(rg);
131}
132\endcode
133*/
134
135/**
[50]136@defgroup semi_adaptors Semi-Adaptor Classes for Graphs
[40]137@ingroup graphs
138\brief Graph types between real graphs and graph adaptors.
139
[50]140This group describes some graph types between real graphs and graph adaptors.
[209]141These classes wrap graphs to give new functionality as the adaptors do it.
[50]142On the other hand they are not light-weight structures as the adaptors.
[40]143*/
144
145/**
[209]146@defgroup maps Maps
[40]147@ingroup datas
[50]148\brief Map structures implemented in LEMON.
[40]149
[50]150This group describes the map structures implemented in LEMON.
151
[314]152LEMON provides several special purpose maps and map adaptors that e.g. combine
[40]153new maps from existing ones.
[314]154
155<b>See also:</b> \ref map_concepts "Map Concepts".
[40]156*/
157
158/**
[209]159@defgroup graph_maps Graph Maps
[40]160@ingroup maps
[83]161\brief Special graph-related maps.
[40]162
[50]163This group describes maps that are specifically designed to assign
[83]164values to the nodes and arcs of graphs.
[40]165*/
166
167/**
168\defgroup map_adaptors Map Adaptors
169\ingroup maps
170\brief Tools to create new maps from existing ones
171
[50]172This group describes map adaptors that are used to create "implicit"
173maps from other maps.
[40]174
[83]175Most of them are \ref lemon::concepts::ReadMap "read-only maps".
176They can make arithmetic and logical operations between one or two maps
177(negation, shifting, addition, multiplication, logical 'and', 'or',
178'not' etc.) or e.g. convert a map to another one of different Value type.
[40]179
[50]180The typical usage of this classes is passing implicit maps to
[40]181algorithms.  If a function type algorithm is called then the function
182type map adaptors can be used comfortable. For example let's see the
[314]183usage of map adaptors with the \c graphToEps() function.
[40]184\code
185  Color nodeColor(int deg) {
186    if (deg >= 2) {
187      return Color(0.5, 0.0, 0.5);
188    } else if (deg == 1) {
189      return Color(1.0, 0.5, 1.0);
190    } else {
191      return Color(0.0, 0.0, 0.0);
192    }
193  }
[209]194
[83]195  Digraph::NodeMap<int> degree_map(graph);
[209]196
[314]197  graphToEps(graph, "graph.eps")
[40]198    .coords(coords).scaleToA4().undirected()
[83]199    .nodeColors(composeMap(functorToMap(nodeColor), degree_map))
[40]200    .run();
[209]201\endcode
[83]202The \c functorToMap() function makes an \c int to \c Color map from the
[314]203\c nodeColor() function. The \c composeMap() compose the \c degree_map
[83]204and the previously created map. The composed map is a proper function to
205get the color of each node.
[40]206
207The usage with class type algorithms is little bit harder. In this
208case the function type map adaptors can not be used, because the
[50]209function map adaptors give back temporary objects.
[40]210\code
[83]211  Digraph graph;
212
213  typedef Digraph::ArcMap<double> DoubleArcMap;
214  DoubleArcMap length(graph);
215  DoubleArcMap speed(graph);
216
217  typedef DivMap<DoubleArcMap, DoubleArcMap> TimeMap;
[40]218  TimeMap time(length, speed);
[209]219
[83]220  Dijkstra<Digraph, TimeMap> dijkstra(graph, time);
[40]221  dijkstra.run(source, target);
222\endcode
[83]223We have a length map and a maximum speed map on the arcs of a digraph.
224The minimum time to pass the arc can be calculated as the division of
225the two maps which can be done implicitly with the \c DivMap template
[40]226class. We use the implicit minimum time map as the length map of the
227\c Dijkstra algorithm.
228*/
229
230/**
[209]231@defgroup matrices Matrices
[40]232@ingroup datas
[50]233\brief Two dimensional data storages implemented in LEMON.
[40]234
[50]235This group describes two dimensional data storages implemented in LEMON.
[40]236*/
237
238/**
239@defgroup paths Path Structures
240@ingroup datas
[318]241\brief %Path structures implemented in LEMON.
[40]242
[50]243This group describes the path structures implemented in LEMON.
[40]244
[50]245LEMON provides flexible data structures to work with paths.
246All of them have similar interfaces and they can be copied easily with
247assignment operators and copy constructors. This makes it easy and
[40]248efficient to have e.g. the Dijkstra algorithm to store its result in
249any kind of path structure.
250
251\sa lemon::concepts::Path
252*/
253
254/**
255@defgroup auxdat Auxiliary Data Structures
256@ingroup datas
[50]257\brief Auxiliary data structures implemented in LEMON.
[40]258
[50]259This group describes some data structures implemented in LEMON in
[40]260order to make it easier to implement combinatorial algorithms.
261*/
262
263/**
264@defgroup algs Algorithms
265\brief This group describes the several algorithms
266implemented in LEMON.
267
268This group describes the several algorithms
269implemented in LEMON.
270*/
271
272/**
273@defgroup search Graph Search
274@ingroup algs
[50]275\brief Common graph search algorithms.
[40]276
[209]277This group describes the common graph search algorithms like
[314]278Breadth-First Search (BFS) and Depth-First Search (DFS).
[40]279*/
280
281/**
[314]282@defgroup shortest_path Shortest Path Algorithms
[40]283@ingroup algs
[50]284\brief Algorithms for finding shortest paths.
[40]285
[50]286This group describes the algorithms for finding shortest paths in graphs.
[40]287*/
288
[209]289/**
[314]290@defgroup max_flow Maximum Flow Algorithms
[209]291@ingroup algs
[50]292\brief Algorithms for finding maximum flows.
[40]293
294This group describes the algorithms for finding maximum flows and
295feasible circulations.
296
[50]297The maximum flow problem is to find a flow between a single source and
298a single target that is maximum. Formally, there is a \f$G=(V,A)\f$
[40]299directed graph, an \f$c_a:A\rightarrow\mathbf{R}^+_0\f$ capacity
300function and given \f$s, t \in V\f$ source and target node. The
[50]301maximum flow is the \f$f_a\f$ solution of the next optimization problem:
[40]302
303\f[ 0 \le f_a \le c_a \f]
[210]304\f[ \sum_{v\in\delta^{-}(u)}f_{vu}=\sum_{v\in\delta^{+}(u)}f_{uv}
305\qquad \forall u \in V \setminus \{s,t\}\f]
[40]306\f[ \max \sum_{v\in\delta^{+}(s)}f_{uv} - \sum_{v\in\delta^{-}(s)}f_{vu}\f]
307
[50]308LEMON contains several algorithms for solving maximum flow problems:
[209]309- \ref lemon::EdmondsKarp "Edmonds-Karp"
[40]310- \ref lemon::Preflow "Goldberg's Preflow algorithm"
[50]311- \ref lemon::DinitzSleatorTarjan "Dinitz's blocking flow algorithm with dynamic trees"
[40]312- \ref lemon::GoldbergTarjan "Preflow algorithm with dynamic trees"
313
[50]314In most cases the \ref lemon::Preflow "Preflow" algorithm provides the
[40]315fastest method to compute the maximum flow. All impelementations
[50]316provides functions to query the minimum cut, which is the dual linear
317programming problem of the maximum flow.
[40]318*/
319
320/**
[314]321@defgroup min_cost_flow Minimum Cost Flow Algorithms
[40]322@ingroup algs
323
[50]324\brief Algorithms for finding minimum cost flows and circulations.
[40]325
326This group describes the algorithms for finding minimum cost flows and
[209]327circulations.
[40]328*/
329
330/**
[314]331@defgroup min_cut Minimum Cut Algorithms
[209]332@ingroup algs
[40]333
[50]334\brief Algorithms for finding minimum cut in graphs.
[40]335
336This group describes the algorithms for finding minimum cut in graphs.
337
338The minimum cut problem is to find a non-empty and non-complete
339\f$X\f$ subset of the vertices with minimum overall capacity on
340outgoing arcs. Formally, there is \f$G=(V,A)\f$ directed graph, an
341\f$c_a:A\rightarrow\mathbf{R}^+_0\f$ capacity function. The minimum
[50]342cut is the \f$X\f$ solution of the next optimization problem:
[40]343
[210]344\f[ \min_{X \subset V, X\not\in \{\emptyset, V\}}
345\sum_{uv\in A, u\in X, v\not\in X}c_{uv}\f]
[40]346
[50]347LEMON contains several algorithms related to minimum cut problems:
[40]348
[50]349- \ref lemon::HaoOrlin "Hao-Orlin algorithm" to calculate minimum cut
[209]350  in directed graphs
[50]351- \ref lemon::NagamochiIbaraki "Nagamochi-Ibaraki algorithm" to
[40]352  calculate minimum cut in undirected graphs
[50]353- \ref lemon::GomoryHuTree "Gomory-Hu tree computation" to calculate all
[40]354  pairs minimum cut in undirected graphs
355
356If you want to find minimum cut just between two distinict nodes,
357please see the \ref max_flow "Maximum Flow page".
358*/
359
360/**
[314]361@defgroup graph_prop Connectivity and Other Graph Properties
[40]362@ingroup algs
[50]363\brief Algorithms for discovering the graph properties
[40]364
[50]365This group describes the algorithms for discovering the graph properties
366like connectivity, bipartiteness, euler property, simplicity etc.
[40]367
368\image html edge_biconnected_components.png
369\image latex edge_biconnected_components.eps "bi-edge-connected components" width=\textwidth
370*/
371
372/**
[314]373@defgroup planar Planarity Embedding and Drawing
[40]374@ingroup algs
[50]375\brief Algorithms for planarity checking, embedding and drawing
[40]376
[210]377This group describes the algorithms for planarity checking,
378embedding and drawing.
[40]379
380\image html planar.png
381\image latex planar.eps "Plane graph" width=\textwidth
382*/
383
384/**
[314]385@defgroup matching Matching Algorithms
[40]386@ingroup algs
[50]387\brief Algorithms for finding matchings in graphs and bipartite graphs.
[40]388
[50]389This group contains algorithm objects and functions to calculate
[40]390matchings in graphs and bipartite graphs. The general matching problem is
[83]391finding a subset of the arcs which does not shares common endpoints.
[209]392
[40]393There are several different algorithms for calculate matchings in
394graphs.  The matching problems in bipartite graphs are generally
395easier than in general graphs. The goal of the matching optimization
396can be the finding maximum cardinality, maximum weight or minimum cost
397matching. The search can be constrained to find perfect or
398maximum cardinality matching.
399
[236]400LEMON contains the next algorithms:
[209]401- \ref lemon::MaxBipartiteMatching "MaxBipartiteMatching" Hopcroft-Karp
402  augmenting path algorithm for calculate maximum cardinality matching in
[40]403  bipartite graphs
[209]404- \ref lemon::PrBipartiteMatching "PrBipartiteMatching" Push-Relabel
405  algorithm for calculate maximum cardinality matching in bipartite graphs
406- \ref lemon::MaxWeightedBipartiteMatching "MaxWeightedBipartiteMatching"
407  Successive shortest path algorithm for calculate maximum weighted matching
[40]408  and maximum weighted bipartite matching in bipartite graph
[209]409- \ref lemon::MinCostMaxBipartiteMatching "MinCostMaxBipartiteMatching"
410  Successive shortest path algorithm for calculate minimum cost maximum
[40]411  matching in bipartite graph
412- \ref lemon::MaxMatching "MaxMatching" Edmond's blossom shrinking algorithm
413  for calculate maximum cardinality matching in general graph
414- \ref lemon::MaxWeightedMatching "MaxWeightedMatching" Edmond's blossom
415  shrinking algorithm for calculate maximum weighted matching in general
416  graph
417- \ref lemon::MaxWeightedPerfectMatching "MaxWeightedPerfectMatching"
418  Edmond's blossom shrinking algorithm for calculate maximum weighted
419  perfect matching in general graph
420
421\image html bipartite_matching.png
422\image latex bipartite_matching.eps "Bipartite Matching" width=\textwidth
423*/
424
425/**
[314]426@defgroup spantree Minimum Spanning Tree Algorithms
[40]427@ingroup algs
[50]428\brief Algorithms for finding a minimum cost spanning tree in a graph.
[40]429
[50]430This group describes the algorithms for finding a minimum cost spanning
[40]431tree in a graph
432*/
433
434/**
[314]435@defgroup auxalg Auxiliary Algorithms
[40]436@ingroup algs
[50]437\brief Auxiliary algorithms implemented in LEMON.
[40]438
[50]439This group describes some algorithms implemented in LEMON
440in order to make it easier to implement complex algorithms.
[40]441*/
442
443/**
[314]444@defgroup approx Approximation Algorithms
445@ingroup algs
[50]446\brief Approximation algorithms.
[40]447
[50]448This group describes the approximation and heuristic algorithms
449implemented in LEMON.
[40]450*/
451
452/**
453@defgroup gen_opt_group General Optimization Tools
454\brief This group describes some general optimization frameworks
455implemented in LEMON.
456
457This group describes some general optimization frameworks
458implemented in LEMON.
459*/
460
461/**
[314]462@defgroup lp_group Lp and Mip Solvers
[40]463@ingroup gen_opt_group
464\brief Lp and Mip solver interfaces for LEMON.
465
466This group describes Lp and Mip solver interfaces for LEMON. The
467various LP solvers could be used in the same manner with this
468interface.
469*/
470
[209]471/**
[314]472@defgroup lp_utils Tools for Lp and Mip Solvers
[40]473@ingroup lp_group
[50]474\brief Helper tools to the Lp and Mip solvers.
[40]475
476This group adds some helper tools to general optimization framework
477implemented in LEMON.
478*/
479
480/**
481@defgroup metah Metaheuristics
482@ingroup gen_opt_group
483\brief Metaheuristics for LEMON library.
484
[50]485This group describes some metaheuristic optimization tools.
[40]486*/
487
488/**
[209]489@defgroup utils Tools and Utilities
[50]490\brief Tools and utilities for programming in LEMON
[40]491
[50]492Tools and utilities for programming in LEMON.
[40]493*/
494
495/**
496@defgroup gutils Basic Graph Utilities
497@ingroup utils
[50]498\brief Simple basic graph utilities.
[40]499
500This group describes some simple basic graph utilities.
501*/
502
503/**
504@defgroup misc Miscellaneous Tools
505@ingroup utils
[50]506\brief Tools for development, debugging and testing.
507
508This group describes several useful tools for development,
[40]509debugging and testing.
510*/
511
512/**
[314]513@defgroup timecount Time Measuring and Counting
[40]514@ingroup misc
[50]515\brief Simple tools for measuring the performance of algorithms.
516
517This group describes simple tools for measuring the performance
[40]518of algorithms.
519*/
520
521/**
522@defgroup exceptions Exceptions
523@ingroup utils
[50]524\brief Exceptions defined in LEMON.
525
526This group describes the exceptions defined in LEMON.
[40]527*/
528
529/**
530@defgroup io_group Input-Output
[50]531\brief Graph Input-Output methods
[40]532
[209]533This group describes the tools for importing and exporting graphs
[314]534and graph related data. Now it supports the \ref lgf-format
535"LEMON Graph Format", the \c DIMACS format and the encapsulated
536postscript (EPS) format.
[40]537*/
538
539/**
[351]540@defgroup lemon_io LEMON Graph Format
[40]541@ingroup io_group
[314]542\brief Reading and writing LEMON Graph Format.
[40]543
[210]544This group describes methods for reading and writing
[236]545\ref lgf-format "LEMON Graph Format".
[40]546*/
547
548/**
[314]549@defgroup eps_io Postscript Exporting
[40]550@ingroup io_group
551\brief General \c EPS drawer and graph exporter
552
[50]553This group describes general \c EPS drawing methods and special
[209]554graph exporting tools.
[40]555*/
556
557/**
[388]558@defgroup dimacs_group DIMACS format
559@ingroup io_group
560\brief Read and write files in DIMACS format
561
562Tools to read a digraph from or write it to a file in DIMACS format data.
563*/
564
565/**
[351]566@defgroup nauty_group NAUTY Format
567@ingroup io_group
568\brief Read \e Nauty format
[388]569
[351]570Tool to read graphs from \e Nauty format data.
571*/
572
573/**
[40]574@defgroup concept Concepts
575\brief Skeleton classes and concept checking classes
576
577This group describes the data/algorithm skeletons and concept checking
578classes implemented in LEMON.
579
580The purpose of the classes in this group is fourfold.
[209]581
[318]582- These classes contain the documentations of the %concepts. In order
[40]583  to avoid document multiplications, an implementation of a concept
584  simply refers to the corresponding concept class.
585
586- These classes declare every functions, <tt>typedef</tt>s etc. an
[318]587  implementation of the %concepts should provide, however completely
[40]588  without implementations and real data structures behind the
589  interface. On the other hand they should provide nothing else. All
590  the algorithms working on a data structure meeting a certain concept
591  should compile with these classes. (Though it will not run properly,
592  of course.) In this way it is easily to check if an algorithm
593  doesn't use any extra feature of a certain implementation.
594
595- The concept descriptor classes also provide a <em>checker class</em>
[50]596  that makes it possible to check whether a certain implementation of a
[40]597  concept indeed provides all the required features.
598
599- Finally, They can serve as a skeleton of a new implementation of a concept.
600*/
601
602/**
603@defgroup graph_concepts Graph Structure Concepts
604@ingroup concept
605\brief Skeleton and concept checking classes for graph structures
606
[50]607This group describes the skeletons and concept checking classes of LEMON's
[40]608graph structures and helper classes used to implement these.
609*/
610
[314]611/**
612@defgroup map_concepts Map Concepts
613@ingroup concept
614\brief Skeleton and concept checking classes for maps
615
616This group describes the skeletons and concept checking classes of maps.
[40]617*/
618
619/**
620\anchor demoprograms
621
622@defgroup demos Demo programs
623
624Some demo programs are listed here. Their full source codes can be found in
625the \c demo subdirectory of the source tree.
626
[41]627It order to compile them, use <tt>--enable-demo</tt> configure option when
628build the library.
[40]629*/
630
631/**
632@defgroup tools Standalone utility applications
633
[209]634Some utility applications are listed here.
[40]635
636The standard compilation procedure (<tt>./configure;make</tt>) will compile
[209]637them, as well.
[40]638*/
639
Note: See TracBrowser for help on using the repository browser.