TEXT FORMAT

LEMON

LEMON Graph Format

LEMON Graph Format (LGF, file extension .lgf) is the native, human-readable serialization used by the LEMON C++ graph library. LEMON — "Library for Efficient Modeling and Optimization in Networks" — is an open-source, template-based C++ library developed by the MTA-ELTE Egerváry Research Group on Combinatorial Optimization (EGRES) at Eötvös Loránd University in Budapest, and distributed as part of the COIN-OR project under the permissive Boost Software License. The library targets combinatorial optimization on graphs and networks (shortest paths, maximum and minimum-cost flow, minimum cut, matching, spanning trees, plus LP/MIP solver interfaces), and LGF is the format its DigraphReader/DigraphWriter and GraphReader/GraphWriter classes read and write.

Structurally, LGF is a plain-text, column-oriented format organized into named sections whose header lines begin with an "@" character. The standard section types are @nodes, @arcs, @edges, and @attributes; each may carry an optional name so that several sections of the same type can coexist in one file. Within a section, each line is a row of whitespace-separated tokens, and each column corresponds to a graph "map" (an attribute keyed by node, arc, or edge). A token is either plain (a run of non-whitespace characters) or quoted with double quotes, in which case it may contain spaces and escape sequences. In the @nodes section a special "label" map holds unique node identifiers; @arcs (directed) and @edges (undirected) rows begin with a source and target token referring to those labels, followed by the arc/edge map values. The @attributes section stores standalone key/value pairs, and lines beginning with "#" are comments.

Because columns map directly onto typed C++ maps, LGF round-trips a graph together with arbitrary node/arc weights, costs, capacities, and coordinates in a single file, which makes it convenient for feeding optimization instances into LEMON algorithms. Conceptually it sits alongside other lightweight, application-tied edge/attribute formats such as LEDA, Pajek, DIMACS, and TGF, and contrasts with verbose, tool-agnostic XML formats like GraphML or GEXF.

Its main limitation is ecosystem scope: LGF is defined by, and primarily consumed by, the LEMON library (LEMON), with little native support in general-purpose graph tools such as NetworkX, igraph, or Gephi, so interchange usually requires converting to a more widely supported format. The specification is also comparatively informal, documented mainly through LEMON's tutorial and API reference rather than an independent standard.

Alternative Names: LGF

File Extensions: .lgf
FeatureLEMON Graph Format
Multiple Graphs per Document not supported
Nodes supported
Undirected Edges supported
Directed Edges supported
Hyperedges not supported
Parallel Edges supported
Self-loops supported
Edges on Edges not supported
Nested Graphs in Nodes not supported
Nested Graphs in Edges not supported
Nested Graphs in Graphs not supported
Node Labels supported
Edge Labels partial
Attributes on Nodes supported
Attributes on Edges supported
Attributes on Graphs supported
Typed Edges not supported

Tools(Read & Write)

Frequently Asked Questions

What is a LEMON Graph Format file?

A LEMON Graph Format file stores a graph — its nodes, edges and attributes — in the LEMON Graph Format format (also: LGF). See the feature table above for what it supports.

How do I open a LEMON Graph Format file?

Open it in a graph tool that supports LEMON Graph Format, or convert it to a format your tool reads. With GraphInOut you can convert LEMON Graph Format to GraphML, DOT, Connected JSON and more, right in your browser.

How do I convert a LEMON Graph Format file to another format?

Use the Convert from LEMON Graph Format link above: upload or paste your LEMON Graph Format file (input preset to LEMON Graph Format), choose a target format and download the result — free, no install.