1 [OGDF](README.md) » [Porting Guide](porting.md) » Snapshot
3 # Porting from Baobab to current snapshot
9 OGDF now requires C++11 features.
10 Make sure you do not use another standard when compiling your user programs.
13 ### Compiling for debug mode
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.
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`.
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`.
30 The directory structure for internal headers (for example, helper classes)
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.
42 When a `PreconditionViolationException` or `AlgorithmFailureException` was only thrown
43 in debug mode, it is now replaced by an assertion (`OGDF_ASSERT`).
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.
56 We have removed Symphony and Cgl from the included COIN-OR package.
57 The only LP solver we ship is hence Clp.
59 If your code used Cgl or Symphony, you have to link your objects to
60 the original versions of these libraries now.
65 Some macros have been removed because they are not necessary any longer.
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)
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`.
80 forall_nodes(v, G) { ... }
84 for(node v : G.nodes) { ... }
87 There must now be a semicolon after usage of the macro `OGDF_ASSERT` and `OGDF_ASSERT_IF`.
89 ## Changed class, function, header names
91 ### stNumber(), testSTnumber()
93 To access the st-numbering functions, include `ogdf/basic/STNumbering.h`
94 (instead of `ogdf/basic/extended_graph_alg.h`).
96 The respective functions were renamed:
99 |--------------|---------------------|
100 | stNumber | computeSTNumbering |
101 | testSTnumber | isSTNumbering |
103 ### DTreeMultilevelEmbedder
105 The `DTreeMultilevelEmbedder` header file is moved
106 from `include/ogdf/internal/energybased/` to `include/ogdf/energybased`
107 because it is not internal.
109 Its internal header files however have moved to
110 `include/ogdf/energybased/dtree`.
114 The (formerly internal) class `TricComp` was renamed to `Triconnectivity`
115 and can now be found in `include/ogdf/graphalg/Triconnectivity.h`.
119 The method `writeGML(const char*, GraphAttributes&, bool)`
120 was deleted. Use `writeGML(ostream &os, const GraphAttributes&)` instead.
122 ## Changed method signatures
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.
129 ### List of Adjacent Edges
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)`.
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()`)
142 ### Hiding and restoring edges
144 Hiding and restoring edges was not a safe operation in former releases.
153 Graph::HiddenEdgeSet hiddenSet(G);
156 hiddenSet.restore(e);
158 All edges are restored by `hiddenSet.restore()` or automatically by the `HiddenEdgeSet` destructor.
163 The method `collaps` has been renamed to `collapse`.
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()`.
174 ## List & ListPure class
176 The deprecated methods `List::exchange()` and `ListPure::exchange()` were removed.
177 Use `List::swap()` and `ListPure::swap()` instead.
179 ## Planar Subgraph Algorithms
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.
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.
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>`.
195 ### MaximumCPlanarSubgraph
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`.
201 ## Heaps and Priority Queues
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.
207 The following heap implementations were introduced:
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.
218 The tests in `test/src/basic/heap.cpp` show exemplary usage of the new classes.
220 ### Method equivalents
223 `BinaryHeap` was replaced by `PrioritizedQueue`.
224 Accessing elements at arbitrary positions is no longer supported.
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` |
242 `BinaryHeap2` was replaced by `PrioritizedMapQueue`. Querying the capacity of the heap is no longer supported.
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` |
259 `PQueue` was replaced by `PrioritizedQueue`.
262 |------------------------------|----------------|
263 | `PQueue::del_min` | `PrioritizedQueue::pop` |
264 | `PQueue::find_min` | `PrioritizedQueue::top` |
265 | `PQueue::insert` | `PrioritizedQueue::push` |
267 #### MinPriorityQueue
269 `MinPriorityQueue` was replaced by `PrioritizedQueue`. Note that `PrioritizedQueue::size` returns the number of elements in the heap instead of the capacity.
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` | - |
281 ## Layout algorithms and graph constraints
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`.
290 Methods that take filenames (instead of streams) are deprecated and will be removed in future versions.
291 For example, instead of using
294 GraphIO::readLEDA(G, "circulant.lgr");
295 GraphIO::writeChaco(G, "circulant.gml");
298 you have to create the streams manually, i.e.,
301 ifstream is("circulant.lgr");
302 GraphIO::readLEDA(G, is);
303 ofstream os("circulant.gml");
304 GraphIO::writeGML(G, os);
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
312 GraphIO::read(G, "circulant.lgr", GraphIO::readLEDA);
313 GraphIO::write(G, "circulant.gml", GraphIO::writeGML);
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
321 GraphIO::read(G, "circulant.lgr");
322 GraphIO::write(G, "circulant.gml", GraphIO::writeGML);
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.
331 ## Filesystem functions
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.
339 ## CombinatorialEmbedding
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.
350 ## OGDF_USE_SSE2, OGDF_CHECK_SSE2
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)`.
358 The template class `ModuleOption` was removed. `std::unique_ptr` should be used instead.
360 ## Angle functions for DPoint and GenericPoint
362 The static methods `angle` and `angleDegrees` of `DPoint` and `GenericPoint` are now
363 non-static. That means, old calls of
366 double angle = DPoint::angle(point1, point2, point3);
372 double angle = point1.angle(point2, point3);
375 ## PoolMemoryAllocator
377 Some types / constants of `PoolMemoryAllocator` were deleted or renamed.
380 |---------------------|--------------|
381 | `BlockChainPtr` | - |
382 | `eBlockSize` | `BLOCK_SIZE` |
383 | `eMinBytes` | `MIN_BYTES` |
384 | `ePoolVectorLength` | - |
385 | `eTableSize` | `TABLE_SIZE` |
387 | `MemElemExPtr` | - |
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.
401 The enumerators from `FMMMLayout` are now in a new class `FMMMOptions`.
403 `FMMMLayout::apInteger` became `FMMMOptions::AllowedPositions::Integer` and
404 `FMMMLayout::gcNonUniformProbLowerMass` became `FMMMLayout::GalaxyChoice::NonUniformProbLowerMass`.
406 ## Optimal Crossing Minimizers
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).
415 The basic data structure `DisjointSets` is highly customizable using
416 template parameters. The enumerator names to do so have now changed.
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` |
436 The following arrays (containing the string expansions of the settings)
439 * `compressionOptionNames`
440 * `interleavingOptionNames`
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.
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.
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.
459 The method `initAttributes` was renamed to `addAttributes` as it does not disable previously enabled attributes.