List of supported formats

The graphs from our database can be downloaded in one of of the following formats:

In addition, for our list of planar graphs, we use so-called planar code.

Adjacency matrices

The adjacency matrix of a graph is a symmetric square matrix with zero diagonal, where rows and columns correspond to vertices. An entry denotes whether the vertex that corresponds to the row is connected by an edge to the vertex that corresponds to the column. (1 = connected, 0 = not). In this format we print one line for each row, with 0-1 entries separated by spaces. The resulting file is a text file consisting of ASCII characters only.

Adjacency lists

In this format we represent the graph by a line for each vertex. The line starts with the sequence number of that vertex (we count starting from 1), followed by a colon, and then a list of all sequence numbers of the vertices that are connected by an edge to the reference vertex. Sequence numbers are expressed in decimal notation and are separated by blanks. The resulting file is a text file consisting of ASCII characters only.

Graph6 code

The graph6 format is for storing undirected graphs in a compact manner, using only printable ASCII characters. Files in this format have text type and contain one line per graph. The formal definition of this format can be found on Brendan McKay's website.

Graphs encoded in 'graph6' format can be converted to human-readable adjacency lists using the program showg. A precompiled Linux binary of showg can be downloaded here and a Mac OS X binary here. The graphs in 'graph6' format can be converted as follows:

./showg < Graphs.g6

Of course, if your primary intention is to obtain the graphs in a human readable format, then it is more convenient to use either the adjacency matrix or the adjacency list format directly.

Invariant values

This format lists the adjacency list of a graph followed by its invariant values. We use the following format to display these invariant values: "<invariant name>: <invariant value>". The resulting file is a text file consisting of ASCII characters only.

Multicode

Multicode is a binary code for storing undirected graphs. The first entry is the number of vertices. Vertices are numbered 1,...,n. To each vertex x there is a list of neighbours with higher numbers than x, followed by a zero. The last list is always empty (no neighbours of n with a higher number than n), so the last "list" is not followed by a zero. After the last byte the next graph follows. The length of a multicode is number of vertices + number of edges.

Graphs encoded in 'multicode' format can be converted to human-readable adjacency lists using the program multiread. A precompiled Linux binary of multiread can be downloaded here and a Mac OS X binary here. The C source file can be found here. The graphs in 'multicode' format can be converted as follows:

./multiread < Graphs.mc

Of course, if your primary intention is to obtain the graphs in a human readable format, then it is more convenient to use either the adjacency matrix or the adjacency list format directly.

Planar code

Planar code is for storing planar graphs. It is a binary code that is easy and fast to compute and to decode. Every entry of the code is an unsigned char. The first entry is the number of vertices. After that there is a list of the vertices adjacent to vertex number 1 in clockwise orientation. This list is ended with a 0. Then you have the vertices adjacent to number 2 ended with a 0, etc. In case that the numbers are too large for unsigned char (i.e. > 255), the first unsigned char written is 0 (!!!). After that the code is as above - only with unsigned short instead of unsigned char. The unsigned shorts are written in little-endian order (low order byte first). A 0 character is written before EVERY code.

In addition to the encodings of graphs, a planar code file by default begins with the 15 characters >>planar_code<< without end-of-line characters.

Graphs encoded in this format can be read and visualized by software such as CaGe. They can also be converted to human-readable adjacency lists using the program planarread. A precompiled Linux binary of planarread can be downloaded here and a Mac OS X binary here. The C source file can be found here. The graphs in planar_code can be converted as follows:

./planarread < Planar_graphs.pl