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 [ -? ] [ -o outfile ] [ files... ]

PARAMETERS

-?
    Displays a brief help message explaining the command's usage and available options, then exits.

-o outfile
    Specifies the path to the output file where the converted DOT graph will be written. If this option is omitted, gml2gv will print the generated DOT output to standard output (stdout).

files...
    One or more paths to the input GML files that gml2gv should convert. If no input files are provided, the command will read GML data from standard input (stdin).

DESCRIPTION

gml2gv is a command-line utility within the Graphviz software package designed to translate graph descriptions from the Graph Modeling Language (GML) format into the Graphviz DOT language. This conversion is crucial for enabling Graphviz layout and rendering engines, such as dot, neato, or fdp, to process and visualize graphs originally defined in GML.

The tool reads GML graph data from specified input files or, by default, from standard input. It then converts this data into the DOT format, writing the output to a specified file or, by default, to standard output. gml2gv correctly handles both directed and undirected graphs, along with their nodes, edges, and a subset of their attributes. It intelligently maps relevant GML attributes to their DOT equivalents, providing a bridge between these two popular graph representation standards.

CAVEATS

Limited Attribute Support: gml2gv only recognizes and processes a specific subset of GML attributes, including label, color, fontcolor, fontsize, style, fillcolor, id, name, and weight. While other GML attributes might be mapped to GV attributes with the same name, they are not guaranteed to be utilized or interpreted by Graphviz layout programs.
Ignored Graphics Attributes: Attributes related to explicit graphical representation, such as graphics, LabelGraphics, nodeGraphics, edgeGraphics, and GraphGraphics, are intentionally ignored during the conversion process. This is because Graphviz is designed to handle layout and rendering automatically based on its own algorithms and styling.
GML Standard Variations: The GML specification can be complex, and gml2gv may not support all possible syntax variations or extensions. Highly complex or non-standard GML files might result in incomplete or incorrect conversions.

INPUT/OUTPUT STREAMS

gml2gv is designed for flexibility in shell pipelines. By default, it reads GML input from standard input (stdin) if no input files are specified. Similarly, if the -o option is not used, the converted DOT output is written to standard output (stdout). This behavior allows for easy chaining with other command-line tools.

GRAPH TYPE HANDLING

The converter automatically determines whether the output GV graph should be directed or undirected. If the input GML file explicitly specifies an undirected graph, gml2gv generates an undirected GV graph accordingly. Otherwise, if not specified as undirected, a directed GV graph is produced by default.

HISTORY

gml2gv is an integral component of the Graphviz open-source graph visualization software suite, which originated at AT&T Labs Research. Its development was driven by the need to facilitate interoperability between the older yet widely used Graph Modeling Language (GML) format and Graphviz's native DOT language. This utility bridges the gap between different graph representation standards, allowing users to leverage Graphviz's powerful layout and rendering capabilities on graph data originally defined in GML.

SEE ALSO

dot(1), neato(1), fdp(1), sfdp(1), twopi(1), circo(1), gvpr(1), gv(5)

Copied to clipboard