LinuxCommandLibrary

gml2gv

Convert GML graph format to Graphviz DOT

TLDR

Convert a graph from gml to gv format

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

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

Display help
$ gml2gv -?
copy

SYNOPSIS

gml2gv [ -h ] [ -ooutfile ] [ file ]

PARAMETERS

-h
    Print usage information and exit.

-ooutfile
    Write output to outfile instead of stdout.

file
    Input GML file; if omitted, read from stdin.

DESCRIPTION

gml2gv is a command-line utility from the Graphviz suite.

It translates graph descriptions written in GML (Graph Modeling Language), a plain-text format for nodes, edges, and attributes, into Graphviz DOT language.

GML input is read from a specified file or standard input, producing equivalent DOT output for use with layout tools like dot, neato, or fdp.

The converter preserves graph structure, directed/undirected edges, and common attributes (e.g., labels, colors) where possible. Complex or non-standard GML features may be ignored or approximated, potentially losing some data.

Ideal for integrating GML data with Graphviz visualization workflows.

CAVEATS

Not all GML attributes have direct DOT equivalents, leading to potential data loss.
Handles basic graphs; advanced features may require manual adjustment.

EXAMPLE

gml2gv graph.gml -o graph.dot
dot -Tpng graph.dot -o graph.png

INSTALLATION

Included in Graphviz package: apt install graphviz (Debian/Ubuntu) or dnf install graphviz (Fedora).

HISTORY

Developed as part of Graphviz, started at AT&T Bell Labs in 1991; gml2gv added to support GML interchange.

SEE ALSO

gv2gml(1), dot(1), neato(1), graphviz(1)

Copied to clipboard