[Nauty] graph compression of sparsegraphs

ibrahim ibrahim.elkaddouri at student.kuleuven.be
Tue Oct 28 22:24:12 AEDT 2025


Dear all

I was wondering if someone within the nauty community knows of a particular
library or piece of code that compresses nauty graphs as compactly as possible
but also as fast as possible (analogously, decompresses as fast as possible).

For example

```c
typedef struct
{
     size_t nde;  /* Number of directed edges (loops contribute only 1) */
     size_t *v;   /* Array of indexes into e[*] */
     int nv;      /* Number of vertices */
     int *d;      /* Array with out-degree of each vertex */
     int *e;      /* Array to hold lists of neighbours */
     sg_weight *w;      /* Not implemented, should be NULL. */
     size_t vlen,dlen,elen,wlen;  /* Sizes of arrays in units of type */
} sparsegraph;
```

Given an adjacency list representation of a graph, such as the struct sparsegraph,
if there are only 1024 vertices in the graph, you only need 10 bits to represent
each vertex. Reducing the space needed from 32 bits or 64 bits to 10 bits per vertex.

Did someone maybe already do this that I'm unaware of ? thanks!


Kind regards
El Kaddouri Ibrahim


More information about the Nauty mailing list