File formats for the 9th DIMACS Implementation Challenge |
In this page we describe the standard file format conventions for the 9th DIMACS Implementation Challenge. To accommodate different problem types, we specify a problem using a graph file and zero or more problem-specific auxiliary files. For each specification file we use the following conventions:
Files consist of
ASCII characters (plain text files)
The file content
consists of several types of lines
Each line begins
with a one-character line type designator
Line fields are separated
by at least one blank space
Each line ends with
a newline separator
Numerical values
stored in the file (e.g., arc weights, node ids, etc.) may be strings of digits
of any length. Programs should make sure to load them into large enough memory
words (e.g., 32 or 64 bits depending on the context).
Input graph (.gr files) |
|||
![]() ![]() ![]() ![]() ![]() |
|||
By convention, shortest path graph file names should have the suffix .gr. Line types are as follows. In the format descriptions below, bold characters should appear exactly as typed: | |||
Comment lines |
These lines begin with a lower-case character c and can appear anywhere. Comment lines are ignored by programs. |
|
|
Problem line |
The problem line is unique and must appear as the first non-comment line. This line has the format on the right, where n and m are the number of nodes and the number of arcs, respectively. |
|
|
Arc descriptor lines |
Arc descriptors are of the form on the right, where SRC and DST are the tail and the head node ids, respectively, and LEN is the arc weight. |
|
Node coordinates (.co files) |
|||
X-Y coordinates in the plane associated with nodes of the graph can be stored in an auxiliary file having the same name of the graph file it is related to and extension .co. For instance, file mygraph.co would contain the node coordinates of graph mygraph.gr. Line types are as follows. In the format descriptions below, bold characters should appear exactly as typed: | |||
Comment lines |
These lines begin with a lower-case character c and can appear anywhere. Comment lines are ignored by programs. |
|
|
Problem line |
The problem line is unique and must appear as the first non-comment line. This line has the format on the right, where n is the number of coordinate lines that follow. |
|
|
Coord lines |
Coordinate lines are of the form on the right, where id , X and Y are the id of the node, its X-coordinate, and its Y-coordinate, respectively. |
|
Single-source shortest path problem (.ss files) |
|||
The goal of the SSSP problem is to find shortest paths between a specified source node and all other nodes in the input graph. The auxiliary file for the problem should have the extension .ss. Line types are as follows. In the format descriptions below, bold characters should appear exactly as typed: | |||
Comment lines |
These lines begin with a lower-case character c and can appear anywhere. Comment lines are ignored by programs. |
|
|
Problem line |
The problem line is unique and must appear as the first non-comment line. This line has the format on the right, where n is the number of source lines that follow. |
|
|
Source lines |
Source lines are of the form on the right, where S is the id of the source node. If more than one source line in file.ss is specified, each line defines a new problem on the same graph with a different source. |
|
|
For the NSSSP problem, the format is the same as for the more general SSP problem, with the understanding that all arc lengths are nonnegative. |
Point-to-point shortest path problem (.p2p files) |
|||
The goal of the P2P problem is to find a shortest path between a specified pair of nodes in the input graph. The auxiliary file for this problem should have the extension .p2p. Line types are as follows. In the format descriptions below, bold characters should appear exactly as typed: | |||
Comment lines |
These lines begin with a lower-case character c and can appear anywhere. Comment lines are ignored by programs. |
|
|
Problem line |
The problem line is unique and must appear as the first non-comment line. This line has the format on the right, where n is the number of query lines that follow. |
|
|
Query lines |
Query lines are of the form on the right, where S, T are the ids of the source and the destination nodes, respectively. Each query line defines a new problem on the same graph. |
|
All-pairs shortest path problem |
The goal of the APSP problem is to find shortest paths between each pair of nodes in the input graph. This problem is completely specified by the graph. No auxiliary file is used. |
Negative cycle detection problem |
The goal of the NCD problem is to find a negative cycle in the input graph, if one exists. This problem is completely specified by the graph. No auxiliary file is used. |