LEMON Tutorial  59
12 Tools
Todo:

# 12.1 Auxiliary Data Structures

Graph algorithms depend on various auxiliary data structures and algorithms. For example, heaps play an important role in Dijkstra and Prim algorithms, both the theoretical and practical performance of them are determined by the applied heap implementation.

LEMON implements various such auxiliary tools. For instance, several data structures are available for maintaining disjoint sets. UnionFind is the classical union-find data structure, which is used to implement the Kruskal algorithm. The UnionFindEnum and HeapUnionFind classes are used in matching algorithms, the first one supports the enumeration of the items stored in the sets, while the second one also assigns priorities to the elements and an item having minimum priority can be retrieved set-wise.

# 12.2 Postscript Exporting

Another nice feature of the library is graphToEps(), a highly configurable graph displaying tool (using EPS output format). Originally, it was developed to evaluate the flexibility and scalability of LEMON's approach to implement named parameters. Later it has been evolved into a versatile tool featuring above 35 named parameters. The following code demonstrates its typical use.

graphToEps(g, "graph.eps")
.coords(coords)
.title("Sample EPS figure")
.absoluteNodeSizes().absoluteArcWidths()
.nodeScale(2).nodeSizes(sizes)
.nodeShapes(shapes)
.nodeColors(composeMap(palette, colors))
.arcColors(composeMap(palette, acolors))
.arcWidthScale(.4).arcWidths(widths)
.nodeTexts(id).nodeTextSize(3)
.run();

Using this feature, various nice images can be generated from graphs, like this one.

For more examples, see graph_to_eps_demo.cc in the demo directory of the LEMON source.

See Random.

See ArgParser.