Description of the Grav File Format
Overview
The Grav file format is a simple, text-based and line-oriented format. Each line consists of one command that begins a new graph or specifies a new node or arc in the graph.
Each command can be followed by one or more arguments (depending on the command) that specify additional attributes. The arguments must be separated by one or more whitespace characters.
File Extension
Grav files should end with the extension grav, grav.gz, grav.bz2 or grav.xz. The latter three files are compressed using the corresponding compression tool. In order for GraView to be able to read compressed files the appropriate ruby packages (gems) or the corresponding command line tools must be available.
Comments
A sharp character # introduces a comment until the end of the line. Comments as well as empty lines are ignored.
Supported Commands
Command are described in the following form:
command required [optional] ...
where command is the name of the command, required is a required argument and [optional] an optional argument. Attributes are often specified in the form key:value. Note that there must not be a space before or after the colon (which would be interpreted as attribute separator).
The following commands are supported:
newgraph nameAdds a new graph with the given name. The graph starts with no nodes and arcs.
addgraph nameAdds a new graph with the given name. The graph starts with all arcs and nodes contained in the previous graph. This command is great to construct an increasing sequence of graphs.
endMarks the end of a graph. This command must be the last after the sequence of nodes and arcs describing a graph and must not be omitted.
node id [x:NUMBER] [y:NUMBER] [weight:NUMBER] [color:R,G,B[,A]] [circ] [disc] [desc:NUMBER]idis the (unique) number of the nodexspecifies the x-coordinate where the node should be drawnyspecifies the y-coordinate where the node should be drawnweightis the weight of the node (an arbitrary numeric attribute of the node)coloris color of the node given as three number between 0 and 255 for red, green and blue and an optional alpha value between 0 and 1. Note that there must not be any spaces before or after the commascircthe node should be drawn as a cricle (with empty filling)discthe node should be drawn as a filled circledescan additional dictionary of description strings follows this node command. The specified number is the size of the description in number of bytes (the first byte being the first character on the next line). The dictionary is specified as sequence of lines. The odd lines are the keys, the even lines the value corresponding to the key of the preceding line.
arc srcid snkid [flow:NUMBER] [cost:NUMBER] [color:R,G,B[,A]] [desc:NUMBER]
edge srcid snkid [flow:NUMBER] [cost:NUMBER] [color:R,G,B[,A]] [desc:NUMBER]The command
arcdenotes a directed arc (with arrow head), the commandedgean undirected arc. Note that also in the case of undirected arcs, the edge (u,v) is different from the edge (v,u).srcidis the id of the source nodesnkidis the id of the sink nodeflowa number describing the flow over this arccosta cost coefficient of the arccolorthe color of the arc in the same format as for nodesdescan additional description in the same format as for nodes
Warning: source and sink nodes must be specified before the arc connecting them.
Default Attributes
If the commands node and arc are specified without the node id/srcid and snkid then specified attributes become default values for subsequent node and arc commands.