LinuxCommandLibrary

gv2gml

Convert Graphviz graphs to GML format

TLDR

Convert a graph from gv to gml format

$ gv2gml -o [output.gml] [input.gv]
copy

Convert a graph using stdin and stdout
$ cat [input.gv] | gv2gml > [output.gml]
copy

Display help
$ gv2gml -?
copy

SYNOPSIS

gv2gml [file...]

DESCRIPTION

gv2gml is a dedicated utility within the Graphviz suite of graph visualization tools. Its primary function is to transform graph descriptions written in the DOT language into the GML (Graph Modeling Language) format. GML provides a hierarchical, text-based structure for representing graphs, making it suitable for exchange between various graph analysis and visualization applications.

By converting DOT files to GML, gv2gml facilitates interoperability, allowing users to leverage Graphviz's powerful layout capabilities and then export the graph data for use in other GML-compatible systems. The command reads graph data from specified input files or from standard input if no files are provided, outputting the resulting GML representation to standard output.

While Graphviz offers numerous layout algorithms, gv2gml focuses solely on the format conversion aspect, relying on the core dot engine for parsing and rendering the graph structure before conversion.

CAVEATS

gv2gml is often implemented as a simple shell script or wrapper that invokes the core dot command with the -Tgml output format option. As such, it generally does not have its own specific command-line options beyond accepting input files. Any advanced graph layout or attribute processing is handled by the underlying dot utility. Users wishing to apply specific dot options should typically use dot -Tgml [options] [files] directly.

The output of gv2gml is always written to standard output. To save the GML content to a file, output redirection (e.g., > output.gml) must be used.

INPUT AND OUTPUT

gv2gml reads its input graph description from one or more files specified as command-line arguments. If no files are provided, it reads from standard input, allowing it to be used in pipelines. The converted GML output is always written to standard output (stdout), making it suitable for piping to other commands or redirecting to a file using shell redirection operators (e.g., gv2gml input.dot > output.gml).

HISTORY

gv2gml is part of the Graphviz (Graph Visualization Software) project, which was originally developed at AT&T Labs Research. Graphviz itself has a long history, with its origins tracing back to the early 1990s as a tool for visualizing various types of graphs, particularly those arising in software engineering and network analysis. As a utility for format conversion, gv2gml was included to enhance the interoperability of Graphviz with other graph-processing tools and systems that utilize the GML standard, reflecting the project's commitment to flexible data exchange.

SEE ALSO

dot(1), gml(5), graphviz(7), neato(1), twopi(1), fdp(1), sfdp(1), circo(1)

Copied to clipboard