Loading...
Searching...
No Matches
Migration from the 0.x Series

This guide gives an in depth description on what has changed compared to the 0.x release series.

Many of these changes adjusted automatically by the lemon-0.x-to-1.x.sh tool. Those requiring manual update are typeset boldface.

# Graph Related Name Changes

- Directed graphs are called `Digraph` and they have Arcs (instead of Edges), while undirected graphs are called `Graph` (instead of `UGraph`) and they have Edges (instead of UEdges). These changes reflected thoroughly everywhere in the library. Namely,
  - `Graph` -> `Digraph`
    - `ListGraph` -> `ListDigraph`, `SmartGraph` -> `SmartDigraph` etc.
  - `UGraph` -> `Graph`
    - `ListUGraph` -> `ListGraph`, `SmartUGraph` -> `SmartGraph` etc.
  - `Edge` -> `Arc`, `UEdge` -> `Edge`
  - `EdgeMap` -> `ArcMap`, `UEdgeMap` -> `EdgeMap`
  - `EdgeIt` -> `ArcIt`, `UEdgeIt` -> `EdgeIt`
  - Class names and function names containing the words `graph`, `ugraph`, edge or arc should also be updated.
- The two endpoints of an (undirected) `Edge` can be obtained by the u() and v() member function of the graph (instead of source() and target()). This change must be done by hand.
  Of course, you can still use source() and target() for Arcs (directed edges).

Warning
  The lemon-0.x-to-1.x.sh script replaces the words `graph`, `ugraph`, `edge` and `uedge` in your own identifiers and in strings, comments etc. as well as in all LEMON specific identifiers. So use the script carefully and make a backup copy of your source files before applying the script to them.

# LGF tools

- The LGF file format has changed, @nodeset has changed to @nodes, @edgeset and @uedgeset to @arcs or @edges, which become completely equivalents. The @nodes, @edges and @uedges sections are removed from the format, the content of them should be the part of @attributes section. The data fields in the sections must follow a strict format, they must be either character sequences without whitespaces or quoted strings.
- The LemonReader and LemonWriter core interfaces are no longer available.
- The implementation of the general section readers and writers has changed they are simple functors now. Beside the old stream based section handling, currently line oriented section reading and writing are also supported. In the section readers the lines must be counted manually. The sections should be read and written with the SectionWriter and SectionReader classes.
- Instead of the item readers and writers, item converters should be used. The converters are functors, which map the type to std::string or std::string to the type. The converters for standard containers hasn't yet been implemented in the new LEMON. The converters can return strings in any format, because if it is necessary, the LGF writer and reader will quote and unquote the given value.
- The DigraphReader and DigraphWriter can used similarly to the 0.x series, however the read or write prefix of the member functions are removed.
- The new LEMON supports the function like interface, the `digraphReader` and `digraphWriter` functions are more convenient than using the classes directly.

# BFS, DFS and Dijkstra

- Using the function interface of BFS, DFS and Dijkstra both source and target nodes can be given as parameters of the run() function (instead of `bfs()`, `dfs()` or `dijkstra()` itself).
- Named class template parameters of `Bfs`, `Dfs`, `Dijkstra`, `BfsVisit`, `DfsVisit` are renamed to start with "Set" instead of "Def". Namely,
  - `DefPredMap` -> `SetPredMap`
  - `DefDistMap` -> `SetDistMap`
  - `DefReachedMap` -> `SetReachedMap`
  - `DefProcessedMap` -> `SetProcessedMap`
  - `DefHeap` -> `SetHeap`
  - `DefStandardHeap` -> `SetStandardHeap`
  - `DefOperationTraits` -> `SetOperationTraits`
  - `DefProcessedMapToBeDefaultMap` -> `SetStandardProcessedMap`

# Exceptions and Debug tools

The class hierarchy of exceptions has largely been simplified. Now, only the i/o related tools may throw exceptions. All other exceptions have been replaced with either the `LEMON_ASSERT` or the `LEMON_DEBUG` macros.

On the other hand, the parameter order of constructors of the exceptions has been changed. See IoError and FormatError for more details.

# Others

- The contents of graph_utils.h are moved to core.h and maps.h. core.h is included by all graph types, therefore it usually do not have to be included directly.
- path_utils.h is merged to `path.h`.
- The semantic of the assignment operations and copy constructors of maps are still under discussion. So, you must copy them by hand (i.e. copy each entry one-by-one)
- The parameters of the graph copying tools (i.e. `GraphCopy`, `DigraphCopy`) have to be given in the from-to order.
- `copyDigraph()` and `copyGraph()` are renamed to `digraphCopy()` and `graphCopy()`, respectively.
- The interface of DynArcLookUp has changed. It is now the same as of ArcLookUp and AllArcLookUp
- Some map types should also been renamed. Namely,
  - `IntegerMap` -> `RangeMap`
  - `StdMap` -> `SparseMap`
  - `FunctorMap` -> `FunctorToMap`
  - `MapFunctor` -> `MapToFunctor`
  - `ForkWriteMap` -> `ForkMap`
  - `StoreBoolMap` -> `LoggerBoolMap`
- `dim2::BoundingBox` -> `dim2::Box`