BINARY FORMAT

digraph6

digraph6 (extension .d6) is a compact, plain-text encoding for simple directed graphs, developed by Brendan McKay as part of the nauty and Traces graph-isomorphism toolkit. It is the directed counterpart to the undirected Graph6 and the sparse-graph sparse6, sharing their design goal: representing a graph as a short run of printable ASCII characters so that large collections of graphs can be stored one-per-line and streamed through Unix pipes. It supports directed graphs of order 0 up to 68,719,476,735 vertices and permits self-loops, but not multiple parallel edges.

A digraph6 string consists of the character '&' (decimal 38) followed by two fields, N(n) and R(x). N(n) encodes the vertex count n using the same variable-length integer scheme as graph6: a single byte for small n, or a 126-prefixed multi-byte form for larger values. R(x) encodes the full n-by-n adjacency matrix, written out row by row as a bit vector x of length n squared, then split into 6-bit groups with 63 added to each group so that every resulting byte falls in the printable range 63-126. Because the entire square matrix is stored (not just the upper triangle, as in graph6), digraph6 naturally captures edge direction and diagonal self-loops. The leading '&' is what distinguishes a digraph6 line from graph6 and sparse6; an optional header >>digraph6<< (with no trailing newline) may also precede the data.

The format is deliberately dense rather than human-readable, and stores no vertex labels, edge weights, or attributes, only pure adjacency. Its space cost grows as n squared regardless of edge density, so it is well suited to small or dense digraphs and to exhaustive enumeration output, but inefficient for large sparse graphs. digraph6 is the native output of nauty's directed-graph generators (such as directg), and is read and written by tools like NetworkX and the R package rgraph6, which convert between it and adjacency matrices, edge lists, or igraph and network objects. In practice it functions less as an interchange format for general graph tooling and more as a canonical, line-oriented archival encoding within the nauty ecosystem, useful when directed graphs must be catalogued, deduplicated, or checked for isomorphism at scale.

Alternative Names: d6

File Extensions: .d6.digraph6
Featuredigraph6
Nodes supported
Undirected Edges not supported
Directed Edges supported
Parallel Edges not supported
Self-loops not supported
Node Labels not supported
Edge Labels not supported
Attributes on Nodes not supported
Attributes on Edges not supported
Typed Edges not supported

Tools(Read & Write)

Read-only Tools

Frequently Asked Questions

What is a digraph6 file?

A digraph6 file stores a graph — its nodes, edges and attributes — in the digraph6 format (also: d6). See the feature table above for what it supports.

How do I open a digraph6 file?

Open it in a graph tool that supports digraph6, or convert it to a format your tool reads. With GraphInOut you can convert digraph6 to GraphML, DOT, Connected JSON and more, right in your browser.

How do I convert a digraph6 file to another format?

Use the Convert from digraph6 link above: upload or paste your digraph6 file (input preset to digraph6), choose a target format and download the result — free, no install.