0
16
1
22
13
5
13
5
6
2
94
76
| 1 |
%!PS-Adobe-2.0 EPSF-2.0 |
|
| 2 |
%%Creator: LEMON, graphToEps() |
|
| 3 |
%%CreationDate: Fri Oct 19 18:32:32 2007 |
|
| 4 |
%%BoundingBox: 0 0 596 842 |
|
| 5 |
%%DocumentPaperSizes: a4 |
|
| 6 |
%%EndComments |
|
| 7 |
/lb { setlinewidth setrgbcolor newpath moveto
|
|
| 8 |
4 2 roll 1 index 1 index curveto stroke } bind def |
|
| 9 |
/l { setlinewidth setrgbcolor newpath moveto lineto stroke } bind def
|
|
| 10 |
/c { newpath dup 3 index add 2 index moveto 0 360 arc closepath } bind def
|
|
| 11 |
/sq { newpath 2 index 1 index add 2 index 2 index add moveto
|
|
| 12 |
2 index 1 index sub 2 index 2 index add lineto |
|
| 13 |
2 index 1 index sub 2 index 2 index sub lineto |
|
| 14 |
2 index 1 index add 2 index 2 index sub lineto |
|
| 15 |
closepath pop pop pop} bind def |
|
| 16 |
/di { newpath 2 index 1 index add 2 index moveto
|
|
| 17 |
2 index 2 index 2 index add lineto |
|
| 18 |
2 index 1 index sub 2 index lineto |
|
| 19 |
2 index 2 index 2 index sub lineto |
|
| 20 |
closepath pop pop pop} bind def |
|
| 21 |
/nc { 0 0 0 setrgbcolor 5 index 5 index 5 index c fill
|
|
| 22 |
setrgbcolor 1.1 div c fill |
|
| 23 |
} bind def |
|
| 24 |
/nsq { 0 0 0 setrgbcolor 5 index 5 index 5 index sq fill
|
|
| 25 |
setrgbcolor 1.1 div sq fill |
|
| 26 |
} bind def |
|
| 27 |
/ndi { 0 0 0 setrgbcolor 5 index 5 index 5 index di fill
|
|
| 28 |
setrgbcolor 1.1 div di fill |
|
| 29 |
} bind def |
|
| 30 |
/nfemale { 0 0 0 setrgbcolor 3 index 0.0909091 1.5 mul mul setlinewidth
|
|
| 31 |
newpath 5 index 5 index moveto 5 index 5 index 5 index 3.01 mul sub |
|
| 32 |
lineto 5 index 4 index .7 mul sub 5 index 5 index 2.2 mul sub moveto |
|
| 33 |
5 index 4 index .7 mul add 5 index 5 index 2.2 mul sub lineto stroke |
|
| 34 |
5 index 5 index 5 index c fill |
|
| 35 |
setrgbcolor 1.1 div c fill |
|
| 36 |
} bind def |
|
| 37 |
/nmale {
|
|
| 38 |
0 0 0 setrgbcolor 3 index 0.0909091 1.5 mul mul setlinewidth |
|
| 39 |
newpath 5 index 5 index moveto |
|
| 40 |
5 index 4 index 1 mul 1.5 mul add |
|
| 41 |
5 index 5 index 3 sqrt 1.5 mul mul add |
|
| 42 |
1 index 1 index lineto |
|
| 43 |
1 index 1 index 7 index sub moveto |
|
| 44 |
1 index 1 index lineto |
|
| 45 |
exch 5 index 3 sqrt .5 mul mul sub exch 5 index .5 mul sub lineto |
|
| 46 |
stroke |
|
| 47 |
5 index 5 index 5 index c fill |
|
| 48 |
setrgbcolor 1.1 div c fill |
|
| 49 |
} bind def |
|
| 50 |
/arrl 1 def |
|
| 51 |
/arrw 0.3 def |
|
| 52 |
/lrl { 2 index mul exch 2 index mul exch rlineto pop} bind def
|
|
| 53 |
/arr { setrgbcolor /y1 exch def /x1 exch def /dy exch def /dx exch def
|
|
| 54 |
/w exch def /len exch def |
|
| 55 |
newpath x1 dy w 2 div mul add y1 dx w 2 div mul sub moveto |
|
| 56 |
len w sub arrl sub dx dy lrl |
|
| 57 |
arrw dy dx neg lrl |
|
| 58 |
dx arrl w add mul dy w 2 div arrw add mul sub |
|
| 59 |
dy arrl w add mul dx w 2 div arrw add mul add rlineto |
|
| 60 |
dx arrl w add mul neg dy w 2 div arrw add mul sub |
|
| 61 |
dy arrl w add mul neg dx w 2 div arrw add mul add rlineto |
|
| 62 |
arrw dy dx neg lrl |
|
| 63 |
len w sub arrl sub neg dx dy lrl |
|
| 64 |
closepath fill } bind def |
|
| 65 |
/cshow { 2 index 2 index moveto dup stringwidth pop
|
|
| 66 |
neg 2 div fosi .35 mul neg rmoveto show pop pop} def |
|
| 67 |
|
|
| 68 |
gsave |
|
| 69 |
15 138.307 translate |
|
| 70 |
12.7843 dup scale |
|
| 71 |
90 rotate |
|
| 72 |
0.608112 -43.6081 translate |
|
| 73 |
%Edges: |
|
| 74 |
gsave |
|
| 75 |
9 31 9.5 30.5 10 30 0 0 0 0.091217 lb |
|
| 76 |
9 31 5.5 34.5 2 38 0 0 0 0.091217 lb |
|
| 77 |
9 31 25.5 16 42 1 0 0 0 0.091217 lb |
|
| 78 |
3 40 23 20.5 43 1 0 0 0 0.091217 lb |
|
| 79 |
3 40 22.5 20.5 42 1 0 0 0 0.091217 lb |
|
| 80 |
3 40 2.5 40.5 2 41 0 0 0 0.091217 lb |
|
| 81 |
13 25 10.5 24.5 8 24 0 0 0 0.091217 lb |
|
| 82 |
13 25 12 27 11 29 0 0 0 0.091217 lb |
|
| 83 |
3 4 2.5 3 2 2 0 0 0 0.091217 lb |
|
| 84 |
3 4 4.5 3 6 2 0 0 0 0.091217 lb |
|
| 85 |
6 25 7 24.5 8 24 0 0 0 0.091217 lb |
|
| 86 |
6 25 6 24.5 6 24 0 0 0 0.091217 lb |
|
| 87 |
34 2 33.5 2 33 2 0 0 0 0.091217 lb |
|
| 88 |
34 2 35 2 36 2 0 0 0 0.091217 lb |
|
| 89 |
6 8 16 9 26 10 0 0 0 0.091217 lb |
|
| 90 |
6 8 6 10.5 6 13 0 0 0 0.091217 lb |
|
| 91 |
6 8 6 7.5 6 7 0 0 0 0.091217 lb |
|
| 92 |
26 10 27.5 8.5 29 7 0 0 0 0.091217 lb |
|
| 93 |
26 10 27.5 9 29 8 0 0 0 0.091217 lb |
|
| 94 |
10 30 10.5 29.5 11 29 0 0 0 0.091217 lb |
|
| 95 |
8 24 7 23.5 6 23 0 0 0 0.091217 lb |
|
| 96 |
8 24 8 24.5 8 25 0 0 0 0.091217 lb |
|
| 97 |
33 2 32.5 2 32 2 0 0 0 0.091217 lb |
|
| 98 |
29 7 17.5 7 6 7 0 0 0 0.091217 lb |
|
| 99 |
2 2 1.5 22 1 42 0 0 0 0.091217 lb |
|
| 100 |
2 2 3.5 2 5 2 0 0 0 0.091217 lb |
|
| 101 |
21 15 13.5 14.5 6 14 0 0 0 0.091217 lb |
|
| 102 |
21 15 21 15.5 21 16 0 0 0 0.091217 lb |
|
| 103 |
1 42 0.5 42.5 0 43 0 0 0 0.091217 lb |
|
| 104 |
1 42 1.5 41.5 2 41 0 0 0 0.091217 lb |
|
| 105 |
6 15 6 15.5 6 16 0 0 0 0.091217 lb |
|
| 106 |
6 15 6 14.5 6 14 0 0 0 0.091217 lb |
|
| 107 |
43 1 22 0.5 1 0 0 0 0 0.091217 lb |
|
| 108 |
31 2 18.5 2 6 2 0 0 0 0.091217 lb |
|
| 109 |
31 2 31.5 2 32 2 0 0 0 0.091217 lb |
|
| 110 |
6 24 6 23.5 6 23 0 0 0 0.091217 lb |
|
| 111 |
6 16 6 16.5 6 17 0 0 0 0.091217 lb |
|
| 112 |
6 23 6 20 6 17 0 0 0 0.091217 lb |
|
| 113 |
6 2 5.5 2 5 2 0 0 0 0.091217 lb |
|
| 114 |
6 2 6 4.5 6 7 0 0 0 0.091217 lb |
|
| 115 |
0 43 0.5 21.5 1 0 0 0 0 0.091217 lb |
|
| 116 |
1 1 19.5 1.5 38 2 0 0 0 0.091217 lb |
|
| 117 |
1 1 1 0.5 1 0 0 0 0 0.091217 lb |
|
| 118 |
2 38 5.5 31.5 9 25 0 0 0 0.091217 lb |
|
| 119 |
25 13 15.5 13 6 13 0 0 0 0.091217 lb |
|
| 120 |
25 13 15.5 13.5 6 14 0 0 0 0.091217 lb |
|
| 121 |
8 25 8.5 25 9 25 0 0 0 0.091217 lb |
|
| 122 |
11 29 24.5 15.5 38 2 0 0 0 0.091217 lb |
|
| 123 |
6 17 11.5 18 17 19 0 0 0 0.091217 lb |
|
| 124 |
16 23 26.5 12.5 37 2 0 0 0 0.091217 lb |
|
| 125 |
16 23 18.5 19.5 21 16 0 0 0 0.091217 lb |
|
| 126 |
36 2 36.5 2 37 2 0 0 0 0.091217 lb |
|
| 127 |
36 2 32.5 5 29 8 0 0 0 0.091217 lb |
|
| 128 |
6 13 6 13.5 6 14 0 0 0 0.091217 lb |
|
| 129 |
37 2 37.5 2 38 2 0 0 0 0.091217 lb |
|
| 130 |
21 16 19 17.5 17 19 0 0 0 0.091217 lb |
|
| 131 |
grestore |
|
| 132 |
%Nodes: |
|
| 133 |
gsave |
|
| 134 |
29 8 0.304556 1 1 1 nc |
|
| 135 |
2 41 0.304556 1 1 1 nc |
|
| 136 |
6 7 0.304556 1 1 1 nc |
|
| 137 |
5 2 0.304556 1 1 1 nc |
|
| 138 |
17 19 0.304556 1 1 1 nc |
|
| 139 |
21 16 0.304556 1 1 1 nc |
|
| 140 |
1 0 0.304556 1 1 1 nc |
|
| 141 |
9 25 0.304556 1 1 1 nc |
|
| 142 |
6 14 0.304556 1 1 1 nc |
|
| 143 |
42 1 0.304556 1 1 1 nc |
|
| 144 |
38 2 0.304556 1 1 1 nc |
|
| 145 |
37 2 0.304556 1 1 1 nc |
|
| 146 |
6 13 0.304556 1 1 1 nc |
|
| 147 |
36 2 0.304556 1 1 1 nc |
|
| 148 |
16 23 0.304556 1 1 1 nc |
|
| 149 |
6 17 0.304556 1 1 1 nc |
|
| 150 |
11 29 0.304556 1 1 1 nc |
|
| 151 |
8 25 0.304556 1 1 1 nc |
|
| 152 |
32 2 0.304556 1 1 1 nc |
|
| 153 |
25 13 0.304556 1 1 1 nc |
|
| 154 |
2 38 0.304556 1 1 1 nc |
|
| 155 |
1 1 0.304556 1 1 1 nc |
|
| 156 |
0 43 0.304556 1 1 1 nc |
|
| 157 |
6 2 0.304556 1 1 1 nc |
|
| 158 |
6 23 0.304556 1 1 1 nc |
|
| 159 |
6 16 0.304556 1 1 1 nc |
|
| 160 |
6 24 0.304556 1 1 1 nc |
|
| 161 |
31 2 0.304556 1 1 1 nc |
|
| 162 |
43 1 0.304556 1 1 1 nc |
|
| 163 |
6 15 0.304556 1 1 1 nc |
|
| 164 |
1 42 0.304556 1 1 1 nc |
|
| 165 |
21 15 0.304556 1 1 1 nc |
|
| 166 |
2 2 0.304556 1 1 1 nc |
|
| 167 |
29 7 0.304556 1 1 1 nc |
|
| 168 |
33 2 0.304556 1 1 1 nc |
|
| 169 |
8 24 0.304556 1 1 1 nc |
|
| 170 |
10 30 0.304556 1 1 1 nc |
|
| 171 |
26 10 0.304556 1 1 1 nc |
|
| 172 |
6 8 0.304556 1 1 1 nc |
|
| 173 |
34 2 0.304556 1 1 1 nc |
|
| 174 |
6 25 0.304556 1 1 1 nc |
|
| 175 |
3 4 0.304556 1 1 1 nc |
|
| 176 |
13 25 0.304556 1 1 1 nc |
|
| 177 |
3 40 0.304556 1 1 1 nc |
|
| 178 |
9 31 0.304556 1 1 1 nc |
|
| 179 |
grestore |
|
| 180 |
grestore |
|
| 181 |
showpage |
| ... | ... |
@@ -170,6 +170,28 @@ |
| 170 | 170 |
useful when the COIN-OR headers and libraries are not under the |
| 171 | 171 |
same prefix (which is unlikely). |
| 172 | 172 |
|
| 173 | 173 |
--without-coin |
| 174 | 174 |
|
| 175 | 175 |
Disable COIN-OR support. |
| 176 |
|
|
| 177 |
|
|
| 178 |
Makefile Variables |
|
| 179 |
================== |
|
| 180 |
|
|
| 181 |
Some Makefile variables are reserved by the GNU Coding Standards for |
|
| 182 |
the use of the "user" - the person building the package. For instance, |
|
| 183 |
CXX and CXXFLAGS are such variables, and have the same meaning as |
|
| 184 |
explained in the previous section. These variables can be set on the |
|
| 185 |
command line when invoking `make' like this: |
|
| 186 |
`make [VARIABLE=VALUE]...' |
|
| 187 |
|
|
| 188 |
WARNINGCXXFLAGS is a non-standard Makefile variable introduced by us |
|
| 189 |
to hold several compiler flags related to warnings. Its default value |
|
| 190 |
can be overridden when invoking `make'. For example to disable all |
|
| 191 |
warning flags use `make WARNINGCXXFLAGS='. |
|
| 192 |
|
|
| 193 |
In order to turn off a single flag from the default set of warning |
|
| 194 |
flags, you can use the CXXFLAGS variable, since this is passed after |
|
| 195 |
WARNINGCXXFLAGS. For example to turn off `-Wold-style-cast' (which is |
|
| 196 |
used by default when g++ is detected) you can use |
|
| 197 |
`make CXXFLAGS="-g -O2 -Wno-old-style-cast"'. |
| ... | ... |
@@ -23,12 +23,13 @@ |
| 23 | 23 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/node_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/node_biconnected_components.eps
|
| 24 | 24 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/nodeshape_0.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_0.eps
|
| 25 | 25 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/nodeshape_1.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_1.eps
|
| 26 | 26 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/nodeshape_2.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_2.eps
|
| 27 | 27 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/nodeshape_3.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_3.eps
|
| 28 | 28 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/nodeshape_4.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_4.eps
|
| 29 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/planar.png ${CMAKE_CURRENT_SOURCE_DIR}/images/planar.eps
|
|
| 29 | 30 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/strongly_connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/strongly_connected_components.eps
|
| 30 | 31 |
COMMAND ${CMAKE_COMMAND} -E remove_directory html
|
| 31 | 32 |
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/bib2dox.py ${CMAKE_CURRENT_SOURCE_DIR}/references.bib >references.dox
|
| 32 | 33 |
COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile
|
| 33 | 34 |
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
| 34 | 35 |
) |
| ... | ... |
@@ -25,12 +25,13 @@ |
| 25 | 25 |
DOC_EPS_IMAGES27 = \ |
| 26 | 26 |
bipartite_matching.eps \ |
| 27 | 27 |
bipartite_partitions.eps \ |
| 28 | 28 |
connected_components.eps \ |
| 29 | 29 |
edge_biconnected_components.eps \ |
| 30 | 30 |
node_biconnected_components.eps \ |
| 31 |
planar.eps \ |
|
| 31 | 32 |
strongly_connected_components.eps |
| 32 | 33 |
|
| 33 | 34 |
DOC_EPS_IMAGES = \ |
| 34 | 35 |
$(DOC_EPS_IMAGES18) \ |
| 35 | 36 |
$(DOC_EPS_IMAGES27) |
| 36 | 37 |
| ... | ... |
@@ -168,12 +168,17 @@ |
| 168 | 168 |
/// |
| 169 | 169 |
/// \tparam GR The type of the digraph the algorithm runs on. |
| 170 | 170 |
/// The default type is \ref ListDigraph. |
| 171 | 171 |
/// \tparam LEN A \ref concepts::ReadMap "readable" arc map that specifies |
| 172 | 172 |
/// the lengths of the arcs. The default map type is |
| 173 | 173 |
/// \ref concepts::Digraph::ArcMap "GR::ArcMap<int>". |
| 174 |
/// \tparam TR The traits class that defines various types used by the |
|
| 175 |
/// algorithm. By default, it is \ref BellmanFordDefaultTraits |
|
| 176 |
/// "BellmanFordDefaultTraits<GR, LEN>". |
|
| 177 |
/// In most cases, this parameter should not be set directly, |
|
| 178 |
/// consider to use the named template parameters instead. |
|
| 174 | 179 |
#ifdef DOXYGEN |
| 175 | 180 |
template <typename GR, typename LEN, typename TR> |
| 176 | 181 |
#else |
| 177 | 182 |
template <typename GR=ListDigraph, |
| 178 | 183 |
typename LEN=typename GR::template ArcMap<int>, |
| 179 | 184 |
typename TR=BellmanFordDefaultTraits<GR,LEN> > |
| ... | ... |
@@ -930,12 +935,15 @@ |
| 930 | 935 |
/// \ref BellmanFord "Bellman-Ford" algorithm. |
| 931 | 936 |
/// It does not have own \ref run() method, it uses the |
| 932 | 937 |
/// functions and features of the plain \ref BellmanFord. |
| 933 | 938 |
/// |
| 934 | 939 |
/// This class should only be used through the \ref bellmanFord() |
| 935 | 940 |
/// function, which makes it easier to use the algorithm. |
| 941 |
/// |
|
| 942 |
/// \tparam TR The traits class that defines various types used by the |
|
| 943 |
/// algorithm. |
|
| 936 | 944 |
template<class TR> |
| 937 | 945 |
class BellmanFordWizard : public TR {
|
| 938 | 946 |
typedef TR Base; |
| 939 | 947 |
|
| 940 | 948 |
typedef typename TR::Digraph Digraph; |
| 941 | 949 |
| ... | ... |
@@ -118,12 +118,17 @@ |
| 118 | 118 |
///There is also a \ref bfs() "function-type interface" for the BFS |
| 119 | 119 |
///algorithm, which is convenient in the simplier cases and it can be |
| 120 | 120 |
///used easier. |
| 121 | 121 |
/// |
| 122 | 122 |
///\tparam GR The type of the digraph the algorithm runs on. |
| 123 | 123 |
///The default type is \ref ListDigraph. |
| 124 |
///\tparam TR The traits class that defines various types used by the |
|
| 125 |
///algorithm. By default, it is \ref BfsDefaultTraits |
|
| 126 |
///"BfsDefaultTraits<GR>". |
|
| 127 |
///In most cases, this parameter should not be set directly, |
|
| 128 |
///consider to use the named template parameters instead. |
|
| 124 | 129 |
#ifdef DOXYGEN |
| 125 | 130 |
template <typename GR, |
| 126 | 131 |
typename TR> |
| 127 | 132 |
#else |
| 128 | 133 |
template <typename GR=ListDigraph, |
| 129 | 134 |
typename TR=BfsDefaultTraits<GR> > |
| ... | ... |
@@ -954,12 +959,15 @@ |
| 954 | 959 |
/// \ref bfs() "function-type interface" of \ref Bfs algorithm. |
| 955 | 960 |
/// It does not have own \ref run(Node) "run()" method, it uses the |
| 956 | 961 |
/// functions and features of the plain \ref Bfs. |
| 957 | 962 |
/// |
| 958 | 963 |
/// This class should only be used through the \ref bfs() function, |
| 959 | 964 |
/// which makes it easier to use the algorithm. |
| 965 |
/// |
|
| 966 |
/// \tparam TR The traits class that defines various types used by the |
|
| 967 |
/// algorithm. |
|
| 960 | 968 |
template<class TR> |
| 961 | 969 |
class BfsWizard : public TR |
| 962 | 970 |
{
|
| 963 | 971 |
typedef TR Base; |
| 964 | 972 |
|
| 965 | 973 |
typedef typename TR::Digraph Digraph; |
| ... | ... |
@@ -1292,17 +1300,17 @@ |
| 1292 | 1300 |
/// The value of GR is not used directly by \ref BfsVisit, |
| 1293 | 1301 |
/// it is only passed to \ref BfsVisitDefaultTraits. |
| 1294 | 1302 |
/// \tparam VS The Visitor type that is used by the algorithm. |
| 1295 | 1303 |
/// \ref BfsVisitor "BfsVisitor<GR>" is an empty visitor, which |
| 1296 | 1304 |
/// does not observe the BFS events. If you want to observe the BFS |
| 1297 | 1305 |
/// events, you should implement your own visitor class. |
| 1298 |
/// \tparam TR Traits class to set various data types used by the |
|
| 1299 |
/// algorithm. The default traits class is |
|
| 1300 |
/// \ref BfsVisitDefaultTraits "BfsVisitDefaultTraits<GR>". |
|
| 1301 |
/// See \ref BfsVisitDefaultTraits for the documentation of |
|
| 1302 |
/// |
|
| 1306 |
/// \tparam TR The traits class that defines various types used by the |
|
| 1307 |
/// algorithm. By default, it is \ref BfsVisitDefaultTraits |
|
| 1308 |
/// "BfsVisitDefaultTraits<GR>". |
|
| 1309 |
/// In most cases, this parameter should not be set directly, |
|
| 1310 |
/// consider to use the named template parameters instead. |
|
| 1303 | 1311 |
#ifdef DOXYGEN |
| 1304 | 1312 |
template <typename GR, typename VS, typename TR> |
| 1305 | 1313 |
#else |
| 1306 | 1314 |
template <typename GR = ListDigraph, |
| 1307 | 1315 |
typename VS = BfsVisitor<GR>, |
| 1308 | 1316 |
typename TR = BfsVisitDefaultTraits<GR> > |
| ... | ... |
@@ -74,15 +74,20 @@ |
| 74 | 74 |
/// can be given using separate functions, and the algorithm can be |
| 75 | 75 |
/// executed using the \ref run() function. If some parameters are not |
| 76 | 76 |
/// specified, then default values will be used. |
| 77 | 77 |
/// |
| 78 | 78 |
/// \tparam GR The digraph type the algorithm runs on. |
| 79 | 79 |
/// \tparam V The number type used for flow amounts, capacity bounds |
| 80 |
/// and supply values in the algorithm. By default it is \c int. |
|
| 80 |
/// and supply values in the algorithm. By default, it is \c int. |
|
| 81 | 81 |
/// \tparam C The number type used for costs and potentials in the |
| 82 |
/// algorithm. By default it is the same as \c V. |
|
| 82 |
/// algorithm. By default, it is the same as \c V. |
|
| 83 |
/// \tparam TR The traits class that defines various types used by the |
|
| 84 |
/// algorithm. By default, it is \ref CapacityScalingDefaultTraits |
|
| 85 |
/// "CapacityScalingDefaultTraits<GR, V, C>". |
|
| 86 |
/// In most cases, this parameter should not be set directly, |
|
| 87 |
/// consider to use the named template parameters instead. |
|
| 83 | 88 |
/// |
| 84 | 89 |
/// \warning Both number types must be signed and all input data must |
| 85 | 90 |
/// be integer. |
| 86 | 91 |
/// \warning This algorithm does not support negative costs for such |
| 87 | 92 |
/// arcs that have infinite upper bound. |
| 88 | 93 |
#ifdef DOXYGEN |
| ... | ... |
@@ -170,12 +170,17 @@ |
| 170 | 170 |
\tparam LM The type of the lower bound map. The default |
| 171 | 171 |
map type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>". |
| 172 | 172 |
\tparam UM The type of the upper bound (capacity) map. |
| 173 | 173 |
The default map type is \c LM. |
| 174 | 174 |
\tparam SM The type of the supply map. The default map type is |
| 175 | 175 |
\ref concepts::Digraph::NodeMap "GR::NodeMap<UM::Value>". |
| 176 |
\tparam TR The traits class that defines various types used by the |
|
| 177 |
algorithm. By default, it is \ref CirculationDefaultTraits |
|
| 178 |
"CirculationDefaultTraits<GR, LM, UM, SM>". |
|
| 179 |
In most cases, this parameter should not be set directly, |
|
| 180 |
consider to use the named template parameters instead. |
|
| 176 | 181 |
*/ |
| 177 | 182 |
#ifdef DOXYGEN |
| 178 | 183 |
template< typename GR, |
| 179 | 184 |
typename LM, |
| 180 | 185 |
typename UM, |
| 181 | 186 |
typename SM, |
| ... | ... |
@@ -101,15 +101,20 @@ |
| 101 | 101 |
/// can be given using separate functions, and the algorithm can be |
| 102 | 102 |
/// executed using the \ref run() function. If some parameters are not |
| 103 | 103 |
/// specified, then default values will be used. |
| 104 | 104 |
/// |
| 105 | 105 |
/// \tparam GR The digraph type the algorithm runs on. |
| 106 | 106 |
/// \tparam V The number type used for flow amounts, capacity bounds |
| 107 |
/// and supply values in the algorithm. By default it is \c int. |
|
| 107 |
/// and supply values in the algorithm. By default, it is \c int. |
|
| 108 | 108 |
/// \tparam C The number type used for costs and potentials in the |
| 109 |
/// algorithm. By default it is the same as \c V. |
|
| 109 |
/// algorithm. By default, it is the same as \c V. |
|
| 110 |
/// \tparam TR The traits class that defines various types used by the |
|
| 111 |
/// algorithm. By default, it is \ref CostScalingDefaultTraits |
|
| 112 |
/// "CostScalingDefaultTraits<GR, V, C>". |
|
| 113 |
/// In most cases, this parameter should not be set directly, |
|
| 114 |
/// consider to use the named template parameters instead. |
|
| 110 | 115 |
/// |
| 111 | 116 |
/// \warning Both number types must be signed and all input data must |
| 112 | 117 |
/// be integer. |
| 113 | 118 |
/// \warning This algorithm does not support negative costs for such |
| 114 | 119 |
/// arcs that have infinite upper bound. |
| 115 | 120 |
/// |
| ... | ... |
@@ -133,14 +138,13 @@ |
| 133 | 138 |
/// The type of the arc costs |
| 134 | 139 |
typedef typename TR::Cost Cost; |
| 135 | 140 |
|
| 136 | 141 |
/// \brief The large cost type |
| 137 | 142 |
/// |
| 138 | 143 |
/// The large cost type used for internal computations. |
| 139 |
/// Using the \ref CostScalingDefaultTraits "default traits class", |
|
| 140 |
/// it is \c long \c long if the \c Cost type is integer, |
|
| 144 |
/// By default, it is \c long \c long if the \c Cost type is integer, |
|
| 141 | 145 |
/// otherwise it is \c double. |
| 142 | 146 |
typedef typename TR::LargeCost LargeCost; |
| 143 | 147 |
|
| 144 | 148 |
/// The \ref CostScalingDefaultTraits "traits class" of the algorithm |
| 145 | 149 |
typedef TR Traits; |
| 146 | 150 |
| ... | ... |
@@ -118,12 +118,17 @@ |
| 118 | 118 |
///There is also a \ref dfs() "function-type interface" for the DFS |
| 119 | 119 |
///algorithm, which is convenient in the simplier cases and it can be |
| 120 | 120 |
///used easier. |
| 121 | 121 |
/// |
| 122 | 122 |
///\tparam GR The type of the digraph the algorithm runs on. |
| 123 | 123 |
///The default type is \ref ListDigraph. |
| 124 |
///\tparam TR The traits class that defines various types used by the |
|
| 125 |
///algorithm. By default, it is \ref DfsDefaultTraits |
|
| 126 |
///"DfsDefaultTraits<GR>". |
|
| 127 |
///In most cases, this parameter should not be set directly, |
|
| 128 |
///consider to use the named template parameters instead. |
|
| 124 | 129 |
#ifdef DOXYGEN |
| 125 | 130 |
template <typename GR, |
| 126 | 131 |
typename TR> |
| 127 | 132 |
#else |
| 128 | 133 |
template <typename GR=ListDigraph, |
| 129 | 134 |
typename TR=DfsDefaultTraits<GR> > |
| ... | ... |
@@ -884,12 +889,15 @@ |
| 884 | 889 |
/// \ref dfs() "function-type interface" of \ref Dfs algorithm. |
| 885 | 890 |
/// It does not have own \ref run(Node) "run()" method, it uses the |
| 886 | 891 |
/// functions and features of the plain \ref Dfs. |
| 887 | 892 |
/// |
| 888 | 893 |
/// This class should only be used through the \ref dfs() function, |
| 889 | 894 |
/// which makes it easier to use the algorithm. |
| 895 |
/// |
|
| 896 |
/// \tparam TR The traits class that defines various types used by the |
|
| 897 |
/// algorithm. |
|
| 890 | 898 |
template<class TR> |
| 891 | 899 |
class DfsWizard : public TR |
| 892 | 900 |
{
|
| 893 | 901 |
typedef TR Base; |
| 894 | 902 |
|
| 895 | 903 |
typedef typename TR::Digraph Digraph; |
| ... | ... |
@@ -1234,17 +1242,17 @@ |
| 1234 | 1242 |
/// The value of GR is not used directly by \ref DfsVisit, |
| 1235 | 1243 |
/// it is only passed to \ref DfsVisitDefaultTraits. |
| 1236 | 1244 |
/// \tparam VS The Visitor type that is used by the algorithm. |
| 1237 | 1245 |
/// \ref DfsVisitor "DfsVisitor<GR>" is an empty visitor, which |
| 1238 | 1246 |
/// does not observe the DFS events. If you want to observe the DFS |
| 1239 | 1247 |
/// events, you should implement your own visitor class. |
| 1240 |
/// \tparam TR Traits class to set various data types used by the |
|
| 1241 |
/// algorithm. The default traits class is |
|
| 1242 |
/// \ref DfsVisitDefaultTraits "DfsVisitDefaultTraits<GR>". |
|
| 1243 |
/// See \ref DfsVisitDefaultTraits for the documentation of |
|
| 1244 |
/// |
|
| 1248 |
/// \tparam TR The traits class that defines various types used by the |
|
| 1249 |
/// algorithm. By default, it is \ref DfsVisitDefaultTraits |
|
| 1250 |
/// "DfsVisitDefaultTraits<GR>". |
|
| 1251 |
/// In most cases, this parameter should not be set directly, |
|
| 1252 |
/// consider to use the named template parameters instead. |
|
| 1245 | 1253 |
#ifdef DOXYGEN |
| 1246 | 1254 |
template <typename GR, typename VS, typename TR> |
| 1247 | 1255 |
#else |
| 1248 | 1256 |
template <typename GR = ListDigraph, |
| 1249 | 1257 |
typename VS = DfsVisitor<GR>, |
| 1250 | 1258 |
typename TR = DfsVisitDefaultTraits<GR> > |
| ... | ... |
@@ -189,12 +189,17 @@ |
| 189 | 189 |
///\tparam LEN A \ref concepts::ReadMap "readable" arc map that specifies |
| 190 | 190 |
///the lengths of the arcs. |
| 191 | 191 |
///It is read once for each arc, so the map may involve in |
| 192 | 192 |
///relatively time consuming process to compute the arc lengths if |
| 193 | 193 |
///it is necessary. The default map type is \ref |
| 194 | 194 |
///concepts::Digraph::ArcMap "GR::ArcMap<int>". |
| 195 |
///\tparam TR The traits class that defines various types used by the |
|
| 196 |
///algorithm. By default, it is \ref DijkstraDefaultTraits |
|
| 197 |
///"DijkstraDefaultTraits<GR, LEN>". |
|
| 198 |
///In most cases, this parameter should not be set directly, |
|
| 199 |
///consider to use the named template parameters instead. |
|
| 195 | 200 |
#ifdef DOXYGEN |
| 196 | 201 |
template <typename GR, typename LEN, typename TR> |
| 197 | 202 |
#else |
| 198 | 203 |
template <typename GR=ListDigraph, |
| 199 | 204 |
typename LEN=typename GR::template ArcMap<int>, |
| 200 | 205 |
typename TR=DijkstraDefaultTraits<GR,LEN> > |
| ... | ... |
@@ -1089,12 +1094,15 @@ |
| 1089 | 1094 |
/// \ref dijkstra() "function-type interface" of \ref Dijkstra algorithm. |
| 1090 | 1095 |
/// It does not have own \ref run(Node) "run()" method, it uses the |
| 1091 | 1096 |
/// functions and features of the plain \ref Dijkstra. |
| 1092 | 1097 |
/// |
| 1093 | 1098 |
/// This class should only be used through the \ref dijkstra() function, |
| 1094 | 1099 |
/// which makes it easier to use the algorithm. |
| 1100 |
/// |
|
| 1101 |
/// \tparam TR The traits class that defines various types used by the |
|
| 1102 |
/// algorithm. |
|
| 1095 | 1103 |
template<class TR> |
| 1096 | 1104 |
class DijkstraWizard : public TR |
| 1097 | 1105 |
{
|
| 1098 | 1106 |
typedef TR Base; |
| 1099 | 1107 |
|
| 1100 | 1108 |
typedef typename TR::Digraph Digraph; |
| ... | ... |
@@ -103,12 +103,17 @@ |
| 103 | 103 |
/// it applies an efficient early termination scheme. |
| 104 | 104 |
/// It runs in time O(ne) and uses space O(n<sup>2</sup>+e). |
| 105 | 105 |
/// |
| 106 | 106 |
/// \tparam GR The type of the digraph the algorithm runs on. |
| 107 | 107 |
/// \tparam LEN The type of the length map. The default |
| 108 | 108 |
/// map type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>". |
| 109 |
/// \tparam TR The traits class that defines various types used by the |
|
| 110 |
/// algorithm. By default, it is \ref HartmannOrlinDefaultTraits |
|
| 111 |
/// "HartmannOrlinDefaultTraits<GR, LEN>". |
|
| 112 |
/// In most cases, this parameter should not be set directly, |
|
| 113 |
/// consider to use the named template parameters instead. |
|
| 109 | 114 |
#ifdef DOXYGEN |
| 110 | 115 |
template <typename GR, typename LEN, typename TR> |
| 111 | 116 |
#else |
| 112 | 117 |
template < typename GR, |
| 113 | 118 |
typename LEN = typename GR::template ArcMap<int>, |
| 114 | 119 |
typename TR = HartmannOrlinDefaultTraits<GR, LEN> > |
| ... | ... |
@@ -124,14 +129,13 @@ |
| 124 | 129 |
/// The type of the arc lengths |
| 125 | 130 |
typedef typename TR::Value Value; |
| 126 | 131 |
|
| 127 | 132 |
/// \brief The large value type |
| 128 | 133 |
/// |
| 129 | 134 |
/// The large value type used for internal computations. |
| 130 |
/// Using the \ref HartmannOrlinDefaultTraits "default traits class", |
|
| 131 |
/// it is \c long \c long if the \c Value type is integer, |
|
| 135 |
/// By default, it is \c long \c long if the \c Value type is integer, |
|
| 132 | 136 |
/// otherwise it is \c double. |
| 133 | 137 |
typedef typename TR::LargeValue LargeValue; |
| 134 | 138 |
|
| 135 | 139 |
/// The tolerance type |
| 136 | 140 |
typedef typename TR::Tolerance Tolerance; |
| 137 | 141 |
| ... | ... |
@@ -103,12 +103,17 @@ |
| 103 | 103 |
/// minimum mean cycle problem, though the best known theoretical |
| 104 | 104 |
/// bound on its running time is exponential. |
| 105 | 105 |
/// |
| 106 | 106 |
/// \tparam GR The type of the digraph the algorithm runs on. |
| 107 | 107 |
/// \tparam LEN The type of the length map. The default |
| 108 | 108 |
/// map type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>". |
| 109 |
/// \tparam TR The traits class that defines various types used by the |
|
| 110 |
/// algorithm. By default, it is \ref HowardDefaultTraits |
|
| 111 |
/// "HowardDefaultTraits<GR, LEN>". |
|
| 112 |
/// In most cases, this parameter should not be set directly, |
|
| 113 |
/// consider to use the named template parameters instead. |
|
| 109 | 114 |
#ifdef DOXYGEN |
| 110 | 115 |
template <typename GR, typename LEN, typename TR> |
| 111 | 116 |
#else |
| 112 | 117 |
template < typename GR, |
| 113 | 118 |
typename LEN = typename GR::template ArcMap<int>, |
| 114 | 119 |
typename TR = HowardDefaultTraits<GR, LEN> > |
| ... | ... |
@@ -124,14 +129,13 @@ |
| 124 | 129 |
/// The type of the arc lengths |
| 125 | 130 |
typedef typename TR::Value Value; |
| 126 | 131 |
|
| 127 | 132 |
/// \brief The large value type |
| 128 | 133 |
/// |
| 129 | 134 |
/// The large value type used for internal computations. |
| 130 |
/// Using the \ref HowardDefaultTraits "default traits class", |
|
| 131 |
/// it is \c long \c long if the \c Value type is integer, |
|
| 135 |
/// By default, it is \c long \c long if the \c Value type is integer, |
|
| 132 | 136 |
/// otherwise it is \c double. |
| 133 | 137 |
typedef typename TR::LargeValue LargeValue; |
| 134 | 138 |
|
| 135 | 139 |
/// The tolerance type |
| 136 | 140 |
typedef typename TR::Tolerance Tolerance; |
| 137 | 141 |
| ... | ... |
@@ -101,12 +101,17 @@ |
| 101 | 101 |
/// \ref amo93networkflows, \ref dasdan98minmeancycle. |
| 102 | 102 |
/// It runs in time O(ne) and uses space O(n<sup>2</sup>+e). |
| 103 | 103 |
/// |
| 104 | 104 |
/// \tparam GR The type of the digraph the algorithm runs on. |
| 105 | 105 |
/// \tparam LEN The type of the length map. The default |
| 106 | 106 |
/// map type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>". |
| 107 |
/// \tparam TR The traits class that defines various types used by the |
|
| 108 |
/// algorithm. By default, it is \ref KarpDefaultTraits |
|
| 109 |
/// "KarpDefaultTraits<GR, LEN>". |
|
| 110 |
/// In most cases, this parameter should not be set directly, |
|
| 111 |
/// consider to use the named template parameters instead. |
|
| 107 | 112 |
#ifdef DOXYGEN |
| 108 | 113 |
template <typename GR, typename LEN, typename TR> |
| 109 | 114 |
#else |
| 110 | 115 |
template < typename GR, |
| 111 | 116 |
typename LEN = typename GR::template ArcMap<int>, |
| 112 | 117 |
typename TR = KarpDefaultTraits<GR, LEN> > |
| ... | ... |
@@ -122,14 +127,13 @@ |
| 122 | 127 |
/// The type of the arc lengths |
| 123 | 128 |
typedef typename TR::Value Value; |
| 124 | 129 |
|
| 125 | 130 |
/// \brief The large value type |
| 126 | 131 |
/// |
| 127 | 132 |
/// The large value type used for internal computations. |
| 128 |
/// Using the \ref KarpDefaultTraits "default traits class", |
|
| 129 |
/// it is \c long \c long if the \c Value type is integer, |
|
| 133 |
/// By default, it is \c long \c long if the \c Value type is integer, |
|
| 130 | 134 |
/// otherwise it is \c double. |
| 131 | 135 |
typedef typename TR::LargeValue LargeValue; |
| 132 | 136 |
|
| 133 | 137 |
/// The tolerance type |
| 134 | 138 |
typedef typename TR::Tolerance Tolerance; |
| 135 | 139 |
| ... | ... |
@@ -109,23 +109,24 @@ |
| 109 | 109 |
/// \param GR The digraph type the algorithm runs on. |
| 110 | 110 |
/// \param CM A read-only arc map storing the costs of the |
| 111 | 111 |
/// arcs. It is read once for each arc, so the map may involve in |
| 112 | 112 |
/// relatively time consuming process to compute the arc costs if |
| 113 | 113 |
/// it is necessary. The default map type is \ref |
| 114 | 114 |
/// concepts::Digraph::ArcMap "Digraph::ArcMap<int>". |
| 115 |
/// \param TR Traits class to set various data types used |
|
| 116 |
/// by the algorithm. The default traits class is |
|
| 117 |
/// \ |
|
| 115 |
/// \tparam TR The traits class that defines various types used by the |
|
| 116 |
/// algorithm. By default, it is \ref MinCostArborescenceDefaultTraits |
|
| 118 | 117 |
/// "MinCostArborescenceDefaultTraits<GR, CM>". |
| 118 |
/// In most cases, this parameter should not be set directly, |
|
| 119 |
/// consider to use the named template parameters instead. |
|
| 119 | 120 |
#ifndef DOXYGEN |
| 120 | 121 |
template <typename GR, |
| 121 | 122 |
typename CM = typename GR::template ArcMap<int>, |
| 122 | 123 |
typename TR = |
| 123 | 124 |
MinCostArborescenceDefaultTraits<GR, CM> > |
| 124 | 125 |
#else |
| 125 |
template <typename GR, typename CM, |
|
| 126 |
template <typename GR, typename CM, typename TR> |
|
| 126 | 127 |
#endif |
| 127 | 128 |
class MinCostArborescence {
|
| 128 | 129 |
public: |
| 129 | 130 |
|
| 130 | 131 |
/// \brief The \ref MinCostArborescenceDefaultTraits "traits class" |
| 131 | 132 |
/// of the algorithm. |
| ... | ... |
@@ -515,36 +515,37 @@ |
| 515 | 515 |
|
| 516 | 516 |
/// \ingroup planar |
| 517 | 517 |
/// |
| 518 | 518 |
/// \brief Planarity checking of an undirected simple graph |
| 519 | 519 |
/// |
| 520 | 520 |
/// This function implements the Boyer-Myrvold algorithm for |
| 521 |
/// planarity checking of an undirected graph. It is a simplified |
|
| 521 |
/// planarity checking of an undirected simple graph. It is a simplified |
|
| 522 | 522 |
/// version of the PlanarEmbedding algorithm class because neither |
| 523 |
/// the embedding nor the |
|
| 523 |
/// the embedding nor the Kuratowski subdivisons are computed. |
|
| 524 | 524 |
template <typename GR> |
| 525 | 525 |
bool checkPlanarity(const GR& graph) {
|
| 526 | 526 |
_planarity_bits::PlanarityChecking<GR> pc(graph); |
| 527 | 527 |
return pc.run(); |
| 528 | 528 |
} |
| 529 | 529 |
|
| 530 | 530 |
/// \ingroup planar |
| 531 | 531 |
/// |
| 532 | 532 |
/// \brief Planar embedding of an undirected simple graph |
| 533 | 533 |
/// |
| 534 | 534 |
/// This class implements the Boyer-Myrvold algorithm for planar |
| 535 |
/// embedding of an undirected graph. The planar embedding is an |
|
| 535 |
/// embedding of an undirected simple graph. The planar embedding is an |
|
| 536 | 536 |
/// ordering of the outgoing edges of the nodes, which is a possible |
| 537 | 537 |
/// configuration to draw the graph in the plane. If there is not |
| 538 |
/// such ordering then the graph contains a \f$ K_5 \f$ (full graph |
|
| 539 |
/// with 5 nodes) or a \f$ K_{3,3} \f$ (complete bipartite graph on
|
|
| 540 |
/// |
|
| 538 |
/// such ordering then the graph contains a K<sub>5</sub> (full graph |
|
| 539 |
/// with 5 nodes) or a K<sub>3,3</sub> (complete bipartite graph on |
|
| 540 |
/// 3 Red and 3 Blue nodes) subdivision. |
|
| 541 | 541 |
/// |
| 542 | 542 |
/// The current implementation calculates either an embedding or a |
| 543 |
/// Kuratowski subdivision. The running time of the algorithm is |
|
| 544 |
/// \f$ O(n) \f$. |
|
| 543 |
/// Kuratowski subdivision. The running time of the algorithm is O(n). |
|
| 544 |
/// |
|
| 545 |
/// \see PlanarDrawing, checkPlanarity() |
|
| 545 | 546 |
template <typename Graph> |
| 546 | 547 |
class PlanarEmbedding {
|
| 547 | 548 |
private: |
| 548 | 549 |
|
| 549 | 550 |
TEMPLATE_GRAPH_TYPEDEFS(Graph); |
| 550 | 551 |
|
| ... | ... |
@@ -588,28 +589,32 @@ |
| 588 | 589 |
ROOT = 10, PERTINENT = 11, |
| 589 | 590 |
INTERNAL = 12 |
| 590 | 591 |
}; |
| 591 | 592 |
|
| 592 | 593 |
public: |
| 593 | 594 |
|
| 594 |
/// \brief The map for |
|
| 595 |
/// \brief The map type for storing the embedding |
|
| 596 |
/// |
|
| 597 |
/// The map type for storing the embedding. |
|
| 598 |
/// \see embeddingMap() |
|
| 595 | 599 |
typedef typename Graph::template ArcMap<Arc> EmbeddingMap; |
| 596 | 600 |
|
| 597 | 601 |
/// \brief Constructor |
| 598 | 602 |
/// |
| 599 |
/// \note The graph should be simple, i.e. parallel and loop arc |
|
| 600 |
/// free. |
|
| 603 |
/// Constructor. |
|
| 604 |
/// \pre The graph must be simple, i.e. it should not |
|
| 605 |
/// contain parallel or loop arcs. |
|
| 601 | 606 |
PlanarEmbedding(const Graph& graph) |
| 602 | 607 |
: _graph(graph), _embedding(_graph), _kuratowski(graph, false) {}
|
| 603 | 608 |
|
| 604 |
/// \brief |
|
| 609 |
/// \brief Run the algorithm. |
|
| 605 | 610 |
/// |
| 606 |
/// Runs the algorithm. |
|
| 607 |
/// \param kuratowski If the parameter is false, then the |
|
| 611 |
/// This function runs the algorithm. |
|
| 612 |
/// \param kuratowski If this parameter is set to \c false, then the |
|
| 608 | 613 |
/// algorithm does not compute a Kuratowski subdivision. |
| 609 |
///\return |
|
| 614 |
/// \return \c true if the graph is planar. |
|
| 610 | 615 |
bool run(bool kuratowski = true) {
|
| 611 | 616 |
typedef _planarity_bits::PlanarityVisitor<Graph> Visitor; |
| 612 | 617 |
|
| 613 | 618 |
PredMap pred_map(_graph, INVALID); |
| 614 | 619 |
TreeMap tree_map(_graph, false); |
| 615 | 620 |
|
| ... | ... |
@@ -696,36 +701,38 @@ |
| 696 | 701 |
arc_lists, flip_map); |
| 697 | 702 |
} |
| 698 | 703 |
|
| 699 | 704 |
return true; |
| 700 | 705 |
} |
| 701 | 706 |
|
| 702 |
/// \brief |
|
| 707 |
/// \brief Give back the successor of an arc |
|
| 703 | 708 |
/// |
| 704 |
/// |
|
| 709 |
/// This function gives back the successor of an arc. It makes |
|
| 705 | 710 |
/// possible to query the cyclic order of the outgoing arcs from |
| 706 | 711 |
/// a node. |
| 707 | 712 |
Arc next(const Arc& arc) const {
|
| 708 | 713 |
return _embedding[arc]; |
| 709 | 714 |
} |
| 710 | 715 |
|
| 711 |
/// \brief |
|
| 716 |
/// \brief Give back the calculated embedding map |
|
| 712 | 717 |
/// |
| 713 |
/// The returned map contains the successor of each arc in the |
|
| 714 |
/// graph. |
|
| 718 |
/// This function gives back the calculated embedding map, which |
|
| 719 |
/// contains the successor of each arc in the cyclic order of the |
|
| 720 |
/// outgoing arcs of its source node. |
|
| 715 | 721 |
const EmbeddingMap& embeddingMap() const {
|
| 716 | 722 |
return _embedding; |
| 717 | 723 |
} |
| 718 | 724 |
|
| 719 |
/// \brief Gives back true if the undirected arc is in the |
|
| 720 |
/// kuratowski subdivision |
|
| 725 |
/// \brief Give back \c true if the given edge is in the Kuratowski |
|
| 726 |
/// subdivision |
|
| 721 | 727 |
/// |
| 722 |
/// Gives back true if the undirected arc is in the kuratowski |
|
| 723 |
/// subdivision |
|
| 724 |
/// \note The \c run() had to be called with true value. |
|
| 725 |
bool kuratowski(const Edge& edge) {
|
|
| 728 |
/// This function gives back \c true if the given edge is in the found |
|
| 729 |
/// Kuratowski subdivision. |
|
| 730 |
/// \pre The \c run() function must be called with \c true parameter |
|
| 731 |
/// before using this function. |
|
| 732 |
bool kuratowski(const Edge& edge) const {
|
|
| 726 | 733 |
return _kuratowski[edge]; |
| 727 | 734 |
} |
| 728 | 735 |
|
| 729 | 736 |
private: |
| 730 | 737 |
|
| 731 | 738 |
void createChildLists(const TreeMap& tree_map, const OrderMap& order_map, |
| ... | ... |
@@ -2056,35 +2063,38 @@ |
| 2056 | 2063 |
|
| 2057 | 2064 |
/// \ingroup planar |
| 2058 | 2065 |
/// |
| 2059 | 2066 |
/// \brief Schnyder's planar drawing algorithm |
| 2060 | 2067 |
/// |
| 2061 | 2068 |
/// The planar drawing algorithm calculates positions for the nodes |
| 2062 |
/// in the plane which coordinates satisfy that if the arcs are |
|
| 2063 |
/// represented with straight lines then they will not intersect |
|
| 2069 |
/// in the plane. These coordinates satisfy that if the edges are |
|
| 2070 |
/// represented with straight lines, then they will not intersect |
|
| 2064 | 2071 |
/// each other. |
| 2065 | 2072 |
/// |
| 2066 |
/// Scnyder's algorithm embeds the graph on \c (n-2,n-2) size grid, |
|
| 2067 |
/// i.e. each node will be located in the \c [0,n-2]x[0,n-2] square. |
|
| 2073 |
/// Scnyder's algorithm embeds the graph on an \c (n-2)x(n-2) size grid, |
|
| 2074 |
/// i.e. each node will be located in the \c [0..n-2]x[0..n-2] square. |
|
| 2068 | 2075 |
/// The time complexity of the algorithm is O(n). |
| 2076 |
/// |
|
| 2077 |
/// \see PlanarEmbedding |
|
| 2069 | 2078 |
template <typename Graph> |
| 2070 | 2079 |
class PlanarDrawing {
|
| 2071 | 2080 |
public: |
| 2072 | 2081 |
|
| 2073 | 2082 |
TEMPLATE_GRAPH_TYPEDEFS(Graph); |
| 2074 | 2083 |
|
| 2075 |
/// \brief The point type for |
|
| 2084 |
/// \brief The point type for storing coordinates |
|
| 2076 | 2085 |
typedef dim2::Point<int> Point; |
| 2077 |
/// \brief The map type for |
|
| 2086 |
/// \brief The map type for storing the coordinates of the nodes |
|
| 2078 | 2087 |
typedef typename Graph::template NodeMap<Point> PointMap; |
| 2079 | 2088 |
|
| 2080 | 2089 |
|
| 2081 | 2090 |
/// \brief Constructor |
| 2082 | 2091 |
/// |
| 2083 | 2092 |
/// Constructor |
| 2084 |
/// \pre The graph |
|
| 2093 |
/// \pre The graph must be simple, i.e. it should not |
|
| 2094 |
/// contain parallel or loop arcs. |
|
| 2085 | 2095 |
PlanarDrawing(const Graph& graph) |
| 2086 | 2096 |
: _graph(graph), _point_map(graph) {}
|
| 2087 | 2097 |
|
| 2088 | 2098 |
private: |
| 2089 | 2099 |
|
| 2090 | 2100 |
template <typename AuxGraph, typename AuxEmbeddingMap> |
| ... | ... |
@@ -2363,30 +2373,31 @@ |
| 2363 | 2373 |
} |
| 2364 | 2374 |
|
| 2365 | 2375 |
} |
| 2366 | 2376 |
|
| 2367 | 2377 |
public: |
| 2368 | 2378 |
|
| 2369 |
/// \brief |
|
| 2379 |
/// \brief Calculate the node positions |
|
| 2370 | 2380 |
/// |
| 2371 |
/// This function calculates the node positions. |
|
| 2372 |
/// \return %True if the graph is planar. |
|
| 2381 |
/// This function calculates the node positions on the plane. |
|
| 2382 |
/// \return \c true if the graph is planar. |
|
| 2373 | 2383 |
bool run() {
|
| 2374 | 2384 |
PlanarEmbedding<Graph> pe(_graph); |
| 2375 | 2385 |
if (!pe.run()) return false; |
| 2376 | 2386 |
|
| 2377 | 2387 |
run(pe); |
| 2378 | 2388 |
return true; |
| 2379 | 2389 |
} |
| 2380 | 2390 |
|
| 2381 |
/// \brief |
|
| 2391 |
/// \brief Calculate the node positions according to a |
|
| 2382 | 2392 |
/// combinatorical embedding |
| 2383 | 2393 |
/// |
| 2384 |
/// This function calculates the node locations. The \c embedding |
|
| 2385 |
/// parameter should contain a valid combinatorical embedding, i.e. |
|
| 2386 |
/// |
|
| 2394 |
/// This function calculates the node positions on the plane. |
|
| 2395 |
/// The given \c embedding map should contain a valid combinatorical |
|
| 2396 |
/// embedding, i.e. a valid cyclic order of the arcs. |
|
| 2397 |
/// It can be computed using PlanarEmbedding. |
|
| 2387 | 2398 |
template <typename EmbeddingMap> |
| 2388 | 2399 |
void run(const EmbeddingMap& embedding) {
|
| 2389 | 2400 |
typedef SmartEdgeSet<Graph> AuxGraph; |
| 2390 | 2401 |
|
| 2391 | 2402 |
if (3 * countNodes(_graph) - 6 == countEdges(_graph)) {
|
| 2392 | 2403 |
drawing(_graph, embedding, _point_map); |
| ... | ... |
@@ -2420,20 +2431,21 @@ |
| 2420 | 2431 |
_planarity_bits::makeMaxPlanar(aux_graph, aux_embedding); |
| 2421 | 2432 |
drawing(aux_graph, aux_embedding, _point_map); |
| 2422 | 2433 |
} |
| 2423 | 2434 |
|
| 2424 | 2435 |
/// \brief The coordinate of the given node |
| 2425 | 2436 |
/// |
| 2426 |
/// |
|
| 2437 |
/// This function returns the coordinate of the given node. |
|
| 2427 | 2438 |
Point operator[](const Node& node) const {
|
| 2428 | 2439 |
return _point_map[node]; |
| 2429 | 2440 |
} |
| 2430 | 2441 |
|
| 2431 |
/// \brief |
|
| 2442 |
/// \brief Return the grid embedding in a node map |
|
| 2432 | 2443 |
/// |
| 2433 |
/// |
|
| 2444 |
/// This function returns the grid embedding in a node map of |
|
| 2445 |
/// \c dim2::Point<int> coordinates. |
|
| 2434 | 2446 |
const PointMap& coords() const {
|
| 2435 | 2447 |
return _point_map; |
| 2436 | 2448 |
} |
| 2437 | 2449 |
|
| 2438 | 2450 |
private: |
| 2439 | 2451 |
|
| ... | ... |
@@ -2467,101 +2479,104 @@ |
| 2467 | 2479 |
|
| 2468 | 2480 |
/// \ingroup planar |
| 2469 | 2481 |
/// |
| 2470 | 2482 |
/// \brief Coloring planar graphs |
| 2471 | 2483 |
/// |
| 2472 | 2484 |
/// The graph coloring problem is the coloring of the graph nodes |
| 2473 |
/// that there are not adjacent nodes with the same color. The |
|
| 2474 |
/// planar graphs can be always colored with four colors, it is |
|
| 2475 |
/// |
|
| 2485 |
/// so that there are no adjacent nodes with the same color. The |
|
| 2486 |
/// planar graphs can always be colored with four colors, which is |
|
| 2487 |
/// proved by Appel and Haken. Their proofs provide a quadratic |
|
| 2476 | 2488 |
/// time algorithm for four coloring, but it could not be used to |
| 2477 |
/// implement efficient algorithm. The five and six coloring can be |
|
| 2478 |
/// made in linear time, but in this class the five coloring has |
|
| 2489 |
/// implement an efficient algorithm. The five and six coloring can be |
|
| 2490 |
/// made in linear time, but in this class, the five coloring has |
|
| 2479 | 2491 |
/// quadratic worst case time complexity. The two coloring (if |
| 2480 | 2492 |
/// possible) is solvable with a graph search algorithm and it is |
| 2481 | 2493 |
/// implemented in \ref bipartitePartitions() function in LEMON. To |
| 2482 |
/// decide whether the planar graph is three colorable is |
|
| 2483 |
/// NP-complete. |
|
| 2494 |
/// decide whether a planar graph is three colorable is NP-complete. |
|
| 2484 | 2495 |
/// |
| 2485 | 2496 |
/// This class contains member functions for calculate colorings |
| 2486 | 2497 |
/// with five and six colors. The six coloring algorithm is a simple |
| 2487 | 2498 |
/// greedy coloring on the backward minimum outgoing order of nodes. |
| 2488 |
/// This order can be computed as in each phase the node with least |
|
| 2489 |
/// outgoing arcs to unprocessed nodes is chosen. This order |
|
| 2499 |
/// This order can be computed by selecting the node with least |
|
| 2500 |
/// outgoing arcs to unprocessed nodes in each phase. This order |
|
| 2490 | 2501 |
/// guarantees that when a node is chosen for coloring it has at |
| 2491 | 2502 |
/// most five already colored adjacents. The five coloring algorithm |
| 2492 | 2503 |
/// use the same method, but if the greedy approach fails to color |
| 2493 | 2504 |
/// with five colors, i.e. the node has five already different |
| 2494 | 2505 |
/// colored neighbours, it swaps the colors in one of the connected |
| 2495 | 2506 |
/// two colored sets with the Kempe recoloring method. |
| 2496 | 2507 |
template <typename Graph> |
| 2497 | 2508 |
class PlanarColoring {
|
| 2498 | 2509 |
public: |
| 2499 | 2510 |
|
| 2500 | 2511 |
TEMPLATE_GRAPH_TYPEDEFS(Graph); |
| 2501 | 2512 |
|
| 2502 |
/// \brief The map type for |
|
| 2513 |
/// \brief The map type for storing color indices |
|
| 2503 | 2514 |
typedef typename Graph::template NodeMap<int> IndexMap; |
| 2504 |
/// \brief The map type for |
|
| 2515 |
/// \brief The map type for storing colors |
|
| 2516 |
/// |
|
| 2517 |
/// The map type for storing colors. |
|
| 2518 |
/// \see Palette, Color |
|
| 2505 | 2519 |
typedef ComposeMap<Palette, IndexMap> ColorMap; |
| 2506 | 2520 |
|
| 2507 | 2521 |
/// \brief Constructor |
| 2508 | 2522 |
/// |
| 2509 |
/// Constructor |
|
| 2510 |
/// \pre The graph should be simple, i.e. loop and parallel arc free. |
|
| 2523 |
/// Constructor. |
|
| 2524 |
/// \pre The graph must be simple, i.e. it should not |
|
| 2525 |
/// contain parallel or loop arcs. |
|
| 2511 | 2526 |
PlanarColoring(const Graph& graph) |
| 2512 | 2527 |
: _graph(graph), _color_map(graph), _palette(0) {
|
| 2513 | 2528 |
_palette.add(Color(1,0,0)); |
| 2514 | 2529 |
_palette.add(Color(0,1,0)); |
| 2515 | 2530 |
_palette.add(Color(0,0,1)); |
| 2516 | 2531 |
_palette.add(Color(1,1,0)); |
| 2517 | 2532 |
_palette.add(Color(1,0,1)); |
| 2518 | 2533 |
_palette.add(Color(0,1,1)); |
| 2519 | 2534 |
} |
| 2520 | 2535 |
|
| 2521 |
/// \brief |
|
| 2536 |
/// \brief Return the node map of color indices |
|
| 2522 | 2537 |
/// |
| 2523 |
/// Returns the \e NodeMap of color indexes. The values are in the |
|
| 2524 |
/// range \c [0..4] or \c [0..5] according to the coloring method. |
|
| 2538 |
/// This function returns the node map of color indices. The values are |
|
| 2539 |
/// in the range \c [0..4] or \c [0..5] according to the coloring method. |
|
| 2525 | 2540 |
IndexMap colorIndexMap() const {
|
| 2526 | 2541 |
return _color_map; |
| 2527 | 2542 |
} |
| 2528 | 2543 |
|
| 2529 |
/// \brief |
|
| 2544 |
/// \brief Return the node map of colors |
|
| 2530 | 2545 |
/// |
| 2531 |
/// Returns the \e NodeMap of colors. The values are five or six |
|
| 2532 |
/// distinct \ref lemon::Color "colors". |
|
| 2546 |
/// This function returns the node map of colors. The values are among |
|
| 2547 |
/// five or six distinct \ref lemon::Color "colors". |
|
| 2533 | 2548 |
ColorMap colorMap() const {
|
| 2534 | 2549 |
return composeMap(_palette, _color_map); |
| 2535 | 2550 |
} |
| 2536 | 2551 |
|
| 2537 |
/// \brief |
|
| 2552 |
/// \brief Return the color index of the node |
|
| 2538 | 2553 |
/// |
| 2539 |
/// Returns the color index of the node. The values are in the |
|
| 2540 |
/// range \c [0..4] or \c [0..5] according to the coloring method. |
|
| 2554 |
/// This function returns the color index of the given node. The value is |
|
| 2555 |
/// in the range \c [0..4] or \c [0..5] according to the coloring method. |
|
| 2541 | 2556 |
int colorIndex(const Node& node) const {
|
| 2542 | 2557 |
return _color_map[node]; |
| 2543 | 2558 |
} |
| 2544 | 2559 |
|
| 2545 |
/// \brief |
|
| 2560 |
/// \brief Return the color of the node |
|
| 2546 | 2561 |
/// |
| 2547 |
/// Returns the color of the node. The values are five or six |
|
| 2548 |
/// distinct \ref lemon::Color "colors". |
|
| 2562 |
/// This function returns the color of the given node. The value is among |
|
| 2563 |
/// five or six distinct \ref lemon::Color "colors". |
|
| 2549 | 2564 |
Color color(const Node& node) const {
|
| 2550 | 2565 |
return _palette[_color_map[node]]; |
| 2551 | 2566 |
} |
| 2552 | 2567 |
|
| 2553 | 2568 |
|
| 2554 |
/// \brief |
|
| 2569 |
/// \brief Calculate a coloring with at most six colors |
|
| 2555 | 2570 |
/// |
| 2556 | 2571 |
/// This function calculates a coloring with at most six colors. The time |
| 2557 | 2572 |
/// complexity of this variant is linear in the size of the graph. |
| 2558 |
/// \return %True when the algorithm could color the graph with six color. |
|
| 2559 |
/// If the algorithm fails, then the graph could not be planar. |
|
| 2560 |
/// \note This function can return true if the graph is not |
|
| 2561 |
/// planar but it can be colored with 6 colors. |
|
| 2573 |
/// \return \c true if the algorithm could color the graph with six colors. |
|
| 2574 |
/// If the algorithm fails, then the graph is not planar. |
|
| 2575 |
/// \note This function can return \c true if the graph is not |
|
| 2576 |
/// planar, but it can be colored with at most six colors. |
|
| 2562 | 2577 |
bool runSixColoring() {
|
| 2563 | 2578 |
|
| 2564 | 2579 |
typename Graph::template NodeMap<int> heap_index(_graph, -1); |
| 2565 | 2580 |
BucketHeap<typename Graph::template NodeMap<int> > heap(heap_index); |
| 2566 | 2581 |
|
| 2567 | 2582 |
for (NodeIt n(_graph); n != INVALID; ++n) {
|
| ... | ... |
@@ -2657,17 +2672,20 @@ |
| 2657 | 2672 |
_color_map[node] = color; |
| 2658 | 2673 |
} |
| 2659 | 2674 |
} |
| 2660 | 2675 |
|
| 2661 | 2676 |
public: |
| 2662 | 2677 |
|
| 2663 |
/// \brief |
|
| 2678 |
/// \brief Calculate a coloring with at most five colors |
|
| 2664 | 2679 |
/// |
| 2665 | 2680 |
/// This function calculates a coloring with at most five |
| 2666 | 2681 |
/// colors. The worst case time complexity of this variant is |
| 2667 | 2682 |
/// quadratic in the size of the graph. |
| 2683 |
/// \param embedding This map should contain a valid combinatorical |
|
| 2684 |
/// embedding, i.e. a valid cyclic order of the arcs. |
|
| 2685 |
/// It can be computed using PlanarEmbedding. |
|
| 2668 | 2686 |
template <typename EmbeddingMap> |
| 2669 | 2687 |
void runFiveColoring(const EmbeddingMap& embedding) {
|
| 2670 | 2688 |
|
| 2671 | 2689 |
typename Graph::template NodeMap<int> heap_index(_graph, -1); |
| 2672 | 2690 |
BucketHeap<typename Graph::template NodeMap<int> > heap(heap_index); |
| 2673 | 2691 |
|
| ... | ... |
@@ -2708,18 +2726,18 @@ |
| 2708 | 2726 |
if (_color_map[order[i]] == -1) {
|
| 2709 | 2727 |
kempeRecoloring(order[i], embedding); |
| 2710 | 2728 |
} |
| 2711 | 2729 |
} |
| 2712 | 2730 |
} |
| 2713 | 2731 |
|
| 2714 |
/// \brief |
|
| 2732 |
/// \brief Calculate a coloring with at most five colors |
|
| 2715 | 2733 |
/// |
| 2716 | 2734 |
/// This function calculates a coloring with at most five |
| 2717 | 2735 |
/// colors. The worst case time complexity of this variant is |
| 2718 | 2736 |
/// quadratic in the size of the graph. |
| 2719 |
/// \return |
|
| 2737 |
/// \return \c true if the graph is planar. |
|
| 2720 | 2738 |
bool runFiveColoring() {
|
| 2721 | 2739 |
PlanarEmbedding<Graph> pe(_graph); |
| 2722 | 2740 |
if (!pe.run()) return false; |
| 2723 | 2741 |
|
| 2724 | 2742 |
runFiveColoring(pe.embeddingMap()); |
| 2725 | 2743 |
return true; |
| ... | ... |
@@ -116,12 +116,17 @@ |
| 116 | 116 |
/// \warning This implementation cannot handle infinite or very large |
| 117 | 117 |
/// capacities (e.g. the maximum value of \c CAP::Value). |
| 118 | 118 |
/// |
| 119 | 119 |
/// \tparam GR The type of the digraph the algorithm runs on. |
| 120 | 120 |
/// \tparam CAP The type of the capacity map. The default map |
| 121 | 121 |
/// type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>". |
| 122 |
/// \tparam TR The traits class that defines various types used by the |
|
| 123 |
/// algorithm. By default, it is \ref PreflowDefaultTraits |
|
| 124 |
/// "PreflowDefaultTraits<GR, CAP>". |
|
| 125 |
/// In most cases, this parameter should not be set directly, |
|
| 126 |
/// consider to use the named template parameters instead. |
|
| 122 | 127 |
#ifdef DOXYGEN |
| 123 | 128 |
template <typename GR, typename CAP, typename TR> |
| 124 | 129 |
#else |
| 125 | 130 |
template <typename GR, |
| 126 | 131 |
typename CAP = typename GR::template ArcMap<int>, |
| 127 | 132 |
typename TR = PreflowDefaultTraits<GR, CAP> > |
0 comments (0 inline)