Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

doc/porting/snapshot.md
Go to the documentation of this file.
1 [OGDF](README.md) » [Porting Guide](porting.md) » Snapshot
2 
3 # Porting from Baobab to current snapshot
4 
5 ## General
6 
7 ### C++11
8 
9 OGDF now requires C++11 features.
10 Make sure you do not use another standard when compiling your user programs.
11 
12 
13 ### Compiling for debug mode
14 
15 If you want to compile for debug mode (even if it is user code, linking
16 against OGDF), you do not need to define `OGDF_DEBUG` any longer. This is
17 automatically defined using CMake.
18 
19 
20 ### Header files
21 
22 It might be necessary that you need to include additional header files
23 for code that worked before. For example, `#include <ogdf/basic/NodeArray.h>`
24 does not ensure that you also have an `EdgeArray`.
25 
26 We also removed header files that contained declarations of classes whose
27 implementation has already been removed in former releases.
28 This includes `FixedUpwardEmbeddingInserter.h` and `UpwardPlanarizationLayout.h`.
29 
30 The directory structure for internal headers (for example, helper classes)
31 has also changed.
32 
33 ### Global namespace
34 
35 In former versions of the OGDF some symbols were added to the global namespace.
36 This includes but isn't limited to `ifstream`, `ofstream`, `min`, `max`, and `numeric_limits`.
37 Thus, you may be required to explicitly use the OGDF namesapce in some places.
38 
39 
40 ### Exceptions
41 
42 When a `PreconditionViolationException` or `AlgorithmFailureException` was only thrown
43 in debug mode, it is now replaced by an assertion (`OGDF_ASSERT`).
44 
45 
46 ### Enum Classes
47 
48 All enums are now enum classes or const static.
49 Since the enumerators are scoped, the distinguishing prefixes
50 of the enumerators have been dropped.
51 Unscoped enums are now forbidden in the OGDF.
52 
53 
54 ### COIN-OR
55 
56 We have removed Symphony and Cgl from the included COIN-OR package.
57 The only LP solver we ship is hence Clp.
58 
59 If your code used Cgl or Symphony, you have to link your objects to
60 the original versions of these libraries now.
61 
62 
63 ## Macros
64 
65 Some macros have been removed because they are not necessary any longer.
66 
67 This includes
68  * `OGDF_NEW` (simply use `new` instead)
69  * `ABACUS_LP_OSI` (Abacus always uses COIN)
70  * `OGDF_NO_COMPILER_TLS` (thread-local storage is a C++11 feature)
71  * `OGDF_DECL_THREAD` (simply use `thread_local` instead)
72 
73 We also have removed most of the iteration macros since C++11 offers range-based for loops.
74 This includes the removal of `forall_nodes` and `forall_edges`.
75 
76 ```cpp
77 node v;
78 Graph G;
79 
80 forall_nodes(v, G) { ... }
81 ```
82 should be replaced by
83 ```cpp
84 for(node v : G.nodes) { ... }
85 ```
86 
87 There must now be a semicolon after usage of the macro `OGDF_ASSERT` and `OGDF_ASSERT_IF`.
88 
89 ## Changed class, function, header names
90 
91 ### stNumber(), testSTnumber()
92 
93 To access the st-numbering functions, include `ogdf/basic/STNumbering.h`
94 (instead of `ogdf/basic/extended_graph_alg.h`).
95 
96 The respective functions were renamed:
97 
98 | Former | New |
99 |--------------|---------------------|
100 | stNumber | computeSTNumbering |
101 | testSTnumber | isSTNumbering |
102 
103 ### DTreeMultilevelEmbedder
104 
105 The `DTreeMultilevelEmbedder` header file is moved
106 from `include/ogdf/internal/energybased/` to `include/ogdf/energybased`
107 because it is not internal.
108 
109 Its internal header files however have moved to
110 `include/ogdf/energybased/dtree`.
111 
112 ### TricComp
113 
114 The (formerly internal) class `TricComp` was renamed to `Triconnectivity`
115 and can now be found in `include/ogdf/graphalg/Triconnectivity.h`.
116 
117 ### PlanRepInc
118 
119 The method `writeGML(const char*, GraphAttributes&, bool)`
120 was deleted. Use `writeGML(ostream &os, const GraphAttributes&)` instead.
121 
122 ## Changed method signatures
123 
124 The parameter `BlockOrder* order` was deleted from the constructors of `Block` in `BlockOrder.h`.
125 Use the constructors `Block(edge e)` and `Block(node v)` instead.
126 
127 ## Graph class
128 
129 ### List of Adjacent Edges
130 
131 `NodeElement::adjEdges` was renamed to `NodeElement::adjEntries`.
132 This means you have to change `for(adjEntry adj : v->adjEdges)` to `for(adjEntry adj : v->adjEntries)`.
133 
134 The following getter-methods were moved from `Graph` to `NodeElement`.
135 All of these methods take a single list as the only parameter now.
136  * `adjEntries()` (renamed to `allAdjEntries()`)
137  * `adjEdges()`
138  * `inEdges()`
139  * `outEdges()`
140 
141 
142 ### Hiding and restoring edges
143 
144 Hiding and restoring edges was not a safe operation in former releases.
145 Replace code like
146 ```c++
147  G.hideEdge(e);
148  // ...
149  G.restoreEdge(e);
150 ```
151 by
152 ```c++
153  Graph::HiddenEdgeSet hiddenSet(G);
154  hiddenSet.hide(e);
155  // ...
156  hiddenSet.restore(e);
157 ```
158 All edges are restored by `hiddenSet.restore()` or automatically by the `HiddenEdgeSet` destructor.
159 
160 
161 ### Typofix: collaps
162 
163 The method `collaps` has been renamed to `collapse`.
164 
165 
166 ## GraphCopy class
167 
168 The `newEdge()` methods to add edges at predefined positions in the adjacency list
169 have been removed from `GraphCopy`.
170 You can instead use the respective `newEdge()` function inherited from `Graph`,
171 followed by `GraphCopy::setEdge()`.
172 
173 
174 ## List & ListPure class
175 
176 The deprecated methods `List::exchange()` and `ListPure::exchange()` were removed.
177 Use `List::swap()` and `ListPure::swap()` instead.
178 
179 ## Planar Subgraph Algorithms
180 
181 `BoyerMyrvoldSubgraph` was renamed to `PlanarSubgraphBoyerMyrvold` and `FastPlanarSubgraph` to `PlanarSubgraphFast`.
182 `MaximalPlanarSubgraphSimple` now supports arbitrary start heuristics.
183 As such, the `doMaximize` option was removed from `PlanarSubgraphBoyerMyrvold` (formerly `BoyerMyrvoldSubgraph`).
184 `MaximalPlanarSubgraphSimple::clone()` should be used to obtain a copy of the respective instance
185 since `MaximalPlanarSubgraphSimple(const MaximalPlanarSubgraphSimple &mps)` is no longer available.
186 
187 Support for edge weights was added to `MaximumCPlanarSubgraph`.
188 The signature of `call` includes the new parameter `EdgeArray<int> *pCost` that can be set to `nullptr` for uniform weight.
189 
190 The Module `PlanarSubgraphModule` is now a template.
191 The implementations `PlanarSubgraphCactus`, `MaximalPlanarSubgraphSimple`,
192 `PlanarSubgraphEmpty` and `PlanarSubgraphFast` are templates itself.
193 All other implementations of the module inherit from `PlanarSubgraphModule<int>`.
194 
195 ### MaximumCPlanarSubgraph
196 
197 `MaximumCPlanarSubgraph` supports advanced calls that also return the edges required to connect the input graph.
198 To avoid conflicts with the method defined by `CPlanarSubgraphModule`, `MaximumCPlanarSubgraph::call` was renamed to
199 `MaximumCPlanarSubgraph::callAndConnect`.
200 
201 ## Heaps and Priority Queues
202 
203 In an attempt to unify the existing heap classes, `BinaryHeap` and `BinaryHeap2` were replaced by a new `BinaryHeap`.
204 All heap implementations are derived from the common interface `HeapBase`.
205 Additionally, the classes `MinPriorityQueue` and `PQueue` were removed.
206 
207 The following heap implementations were introduced:
208  * `BinaryHeap`
209  * `BinomialHeap`
210  * `FibonacciHeap`
211  * `PairingHeap`
212  * `RadixHeap`
213 
214 Priority queues might be realized using the newly introduced `PriorityQueue` independently of the desired heap implementation.
215 In contrast to `PriorityQueue` that merely stores directly comparable elements, `PrioritizedQueue` is used to store elements with priorities assigned upon insertion.
216 For even simpler usage see `PrioritizedMapQueue` that keeps track of handles for the inserted elements but requires elements to be unique.
217 
218 The tests in `test/src/basic/heap.cpp` show exemplary usage of the new classes.
219 
220 ### Method equivalents
221 
222 #### BinaryHeap
223 `BinaryHeap` was replaced by `PrioritizedQueue`.
224 Accessing elements at arbitrary positions is no longer supported.
225 
226 | Former | New |
227 |---------------------------|----------------------------------------------------------|
228 | `BinaryHeap::clear` | `PrioritizedQueue::clear` |
229 | `BinaryHeap::decPriority` | `PrioritizedQueue::decrease` |
230 | `BinaryHeap::empty` | `PrioritizedQueue::empty` |
231 | `BinaryHeap::extractMin` | `PrioritizedQueue::topElement` & `PrioritizedQueue::pop` |
232 | `BinaryHeap::getMin` | `PrioritizedQueue::topElement` |
233 | `BinaryHeap::insert` | `PrioritizedQueue::push` |
234 | `BinaryHeap::operator[]` | - |
235 | `BinaryHeap::pop` | `PrioritizedQueue::pop` |
236 | `BinaryHeap::push` | `PrioritizedQueue::push` |
237 | `BinaryHeap::size` | `PrioritizedQueue::size` |
238 | `BinaryHeap::top` | `PrioritizedQueue::topElement` |
239 
240 #### BinaryHeap2
241 
242 `BinaryHeap2` was replaced by `PrioritizedMapQueue`. Querying the capacity of the heap is no longer supported.
243 
244 | Former | New |
245 |------------------------------|----------------------------------------------------------------|
246 | `BinaryHeap2::capacity` | - |
247 | `BinaryHeap2::clear` | `PrioritizedMapQueue::clear` |
248 | `BinaryHeap2::decreaseKey` | `PrioritizedMapQueue::decrease` |
249 | `BinaryHeap2::empty` | `PrioritizedMapQueue::empty` |
250 | `BinaryHeap2::extractMin` | `PrioritizedMapQueue::topElement` & `PrioritizedMapQueue::pop` |
251 | `BinaryHeap2::getMinimumKey` | `PrioritizedMapQueue::topPriority` |
252 | `BinaryHeap2::getPriority` | `PrioritizedMapQueue::priority` |
253 | `BinaryHeap2::insert` | `PrioritizedMapQueue::push` |
254 | `BinaryHeap2::size` | `PrioritizedMapQueue::size` |
255 | `BinaryHeap2::topElement` | `PrioritizedMapQueue::topElement` |
256 
257 #### PQueue
258 
259 `PQueue` was replaced by `PrioritizedQueue`.
260 
261 | Former | New |
262 |------------------------------|----------------|
263 | `PQueue::del_min` | `PrioritizedQueue::pop` |
264 | `PQueue::find_min` | `PrioritizedQueue::top` |
265 | `PQueue::insert` | `PrioritizedQueue::push` |
266 
267 #### MinPriorityQueue
268 
269 `MinPriorityQueue` was replaced by `PrioritizedQueue`. Note that `PrioritizedQueue::size` returns the number of elements in the heap instead of the capacity.
270 
271 | Former | New |
272 |--------------------------------------|------------------------------|
273 | `MinPriorityQueue::count` | `PrioritizedQueue::size` |
274 | `MinPriorityQueue::decreasePriority` | `PrioritizedQueue::decrease` |
275 | `MinPriorityQueue::empty` | `PrioritizedQueue::empty` |
276 | `MinPriorityQueue::getMin` | `PrioritizedQueue::top` |
277 | `MinPriorityQueue::insert` | `PrioritizedQueue::push` |
278 | `MinPriorityQueue::pop` | `PrioritizedQueue::pop` |
279 | `MinPriorityQueue::size` | - |
280 
281 ## Layout algorithms and graph constraints
282 
283 Layout algorithms no longer support `GraphConstraints`.
284 Use `call(GraphAttributes)` instead of `call(GraphAttributes, GraphConstraints)`.
285 Graph constraints were removed entirely.
286 Removed classes: `Constraint`, `ConstraintManager`, and `GraphConstraints`.
287 
288 ## GraphIO
289 
290 Methods that take filenames (instead of streams) are deprecated and will be removed in future versions.
291 For example, instead of using
292 
293 ```c++
294  GraphIO::readLEDA(G, "circulant.lgr");
295  GraphIO::writeChaco(G, "circulant.gml");
296 ```
297 
298 you have to create the streams manually, i.e.,
299 
300 ```c++
301  ifstream is("circulant.lgr");
302  GraphIO::readLEDA(G, is);
303  ofstream os("circulant.gml");
304  GraphIO::writeGML(G, os);
305 ```
306 
307 There are also helper functions `GraphIO::read()` and `GraphIO::write()`
308 that accept filenames for `GraphAttribute`s and `Graph`s,
309 so you can also write
310 
311 ```c++
312  GraphIO::read(G, "circulant.lgr", GraphIO::readLEDA);
313  GraphIO::write(G, "circulant.gml", GraphIO::writeGML);
314 ```
315 
316 Do not confuse the new filename-based `GraphIO::read()` helper function with
317 our new (experimental) generic reader function of the same name.
318 However, this generic reader even allows to write
319 
320 ```c++
321  GraphIO::read(G, "circulant.lgr");
322  GraphIO::write(G, "circulant.gml", GraphIO::writeGML);
323 ```
324 
325 ## GmlParser
326 
327 If you happened to use the `GmlParser` class directly (instead of
328 `GraphIO`), the constructor with filename argument is also gone
329 now. Use the constructor for input streams instead.
330 
331 ## Filesystem functions
332 
333 If you have used filesystem functions in your code,
334 you can include `ogdf/basic/filesystem.h` now and you get them back.
335 They are marked deprecated now since there are maintained and portable
336 alternatives like [tinydir](https://github.com/cxong/tinydir).
337 Also C++17 will have filesystem functions.
338 
339 ## CombinatorialEmbedding
340 
341 `CombinatorialEmbedding::splitFace(adjEntry, node)` and `CombinatorialEmbedding::splitFace(node, adjEntry)`
342 are used to insert degree-0 nodes without having to call `CombinatorialEmbedding::computeFaces()` again.
343 In previous version both methods could be used with non-isolated nodes
344 if the last adjacency entry belonged to the same face as the other adjacency entry.
345 This is no longer supported and the node has to be isolated.
346 To reflect this functional change the respective versions of `splitFace` were renamed to `addEdgeToIsolatedNode`.
347 Use `myEmbedding.splitFace(v->lastAdj(), adj)` instead of `myEmbedding.splitFace(v, adj)` if `v` isn't isolated (and you are sure that the adjacency entries lie on the same face!).
348 Use `myEmbedding.addEdgeToIsolatedNode(v, adj)` if `v` is isolated.
349 
350 ## OGDF_USE_SSE2, OGDF_CHECK_SSE2
351 
352 The macros mentioned above have been removed.
353 You can check for the SSE2 CPU feature directly using
354 `ogdf::System::cpuSupports(ogdf::CPUFeature::SSE2)`.
355 
356 ## ModuleOption
357 
358 The template class `ModuleOption` was removed. `std::unique_ptr` should be used instead.
359 
360 ## Angle functions for DPoint and GenericPoint
361 
362 The static methods `angle` and `angleDegrees` of `DPoint` and `GenericPoint` are now
363 non-static. That means, old calls of
364 
365 ```c++
366  double angle = DPoint::angle(point1, point2, point3);
367 ```
368 
369 now become
370 
371 ```c++
372  double angle = point1.angle(point2, point3);
373 ```
374 
375 ## PoolMemoryAllocator
376 
377 Some types / constants of `PoolMemoryAllocator` were deleted or renamed.
378 
379 | Former | New |
380 |---------------------|--------------|
381 | `BlockChainPtr` | - |
382 | `eBlockSize` | `BLOCK_SIZE` |
383 | `eMinBytes` | `MIN_BYTES` |
384 | `ePoolVectorLength` | - |
385 | `eTableSize` | `TABLE_SIZE` |
386 | `MemElemEx` | - |
387 | `MemElemExPtr` | - |
388 | `PoolVector` | - |
389 
390 
391 ## NonPlanarCore
392 
393 `NonPlanarCore<TCost>::mincut(edge e)` now returns an `NonPlanarCore<TCost>::CutEdge` which is
394 a struct with the two parameters `edge e`, the edge itself and a `bool dir` which indicates the
395 direction of the edge, i.e. indicates if the edge goes from s to t or the other way round.
396 Furthermore the `NonPlanarCore` can now handle weighted edges and therefore is templated with
397 the type of the weights.
398 
399 ## FMMMLayout
400 
401 The enumerators from `FMMMLayout` are now in a new class `FMMMOptions`.
402 Hence, for example,
403 `FMMMLayout::apInteger` became `FMMMOptions::AllowedPositions::Integer` and
404 `FMMMLayout::gcNonUniformProbLowerMass` became `FMMMLayout::GalaxyChoice::NonUniformProbLowerMass`.
405 
406 ## Optimal Crossing Minimizers
407 
408 The enumerators `Minimal` and `Few` of `PricingMode`
409 in the crossing minimizers are now merged to `Few`.
410 Use `Few` also in `OptimalSimultaneousCrossingMinimizer`
411 instead of `Minimal` (which was previously unused).
412 
413 ## DisjointSets
414 
415 The basic data structure `DisjointSets` is highly customizable using
416 template parameters. The enumerator names to do so have now changed.
417 
418 | Former | New |
419 |---------|---------------------------------------------|
420 | `NL` | `LinkOptions::Naive` |
421 | `LI` | `LinkOptions::Index` |
422 | `LS` | `LinkOptions::Size` |
423 | `LR` | `LinkOptions::Rank` |
424 | `PC` | `CompressionOptions::PathCompression` |
425 | `PS` | `CompressionOptions::PathSplitting` |
426 | `PH` | `CompressionOptions::PathHalving` |
427 | `R1` | `CompressionOptions::Type1Reversal` |
428 | `CO` | `CompressionOptions::Collapsing` |
429 | `NF` | `CompressionOptions::Disabled` |
430 | `NI` | `InterleavingOptions::Disabled` |
431 | `Rem` | `InterleavingOptions::Rem` |
432 | `TvL` | `InterleavingOptions::Tarjan` |
433 | `IR0` | `InterleavingOptions::Type0Reversal` |
434 | `IPSPC` | `InterleavingOptions::SplittingCompression` |
435 
436 The following arrays (containing the string expansions of the settings)
437 are removed:
438  * `linkOptionNames`
439  * `compressionOptionNames`
440  * `interleavingOptionNames`
441 
442 ## isForest()
443 
444 The function `isForest()` in `basic/simple_graph_alg.h` formerly returned `true` even when the graph contained multi-edges or self-loops.
445 This is no longer the case.
446 
447 ## doDestruction()
448 
449 The function template `template<class E> doDestruction(const E *)` has been removed
450 in favor of `!std::is_trivially_destructible<E>::value`. Hence, lists of elements with
451 trivial destructors are now deallocated in constant time automatically, without
452 the necessity of writing a template specialization.
453 
454 ## GraphAttributes
455 
456 The methods `setDirected`, `setStrokeType`, and `setFillPattern` have been removed from `GraphAttributes`.
457 Use the respective getters (`directed`, `strokeType`, and `fillPattern`) instead to obtain a non-const reference to the underlying value.
458 
459 The method `initAttributes` was renamed to `addAttributes` as it does not disable previously enabled attributes.