# Export graph6 issue

I am exporting large lists of graphs to files in graph6 format, using something like

Export["somefile.g6",graphList,"Graph6"]


but this always starts the file with >>graph6<<.

As I am feeding the files into another code in another language, I need to remove the >>graph6<<. As I have thousands of such files, is there an option I am not seeing to do this automatically while exporting?

• The other program is not conform to the g6 standard if it cannot ignore the optional header file. Of course, you can try to work around it by reading in the files as strings, deleting the first line, and writiting back to file. – Henrik Schumacher Mar 4 '20 at 19:29
• @HenrikSchumacher Actually, some high-profile programs support single graph6 lines, but don't support the header. The header is usually included in multi-line files which contain many graphs. Single graph6 lines are a common interchange format for graph theory software. – Szabolcs Mar 4 '20 at 19:44

No, there is not, and yes, this is annoying, especially since the header is not really needed for this format (the precise format variant is marked using the initial character).

You can do something like

StringTrim[
ExportString[CycleGraph[5], "Graph6"],
">>graph6<<"
]


then export (or copy) the resulting string.

Side note: Better graph6/sparse6/digraph6 support is in progress for IGraph/M. So far it can only import, which was the priority for me. Once it gets the export functionality as well (mainly to support digraph6, which Mathematica has no builtin for), there'll be a way to avoid the header.

• Nice to learn about the side note - cool work as usual! :-) – Juho Mar 7 '20 at 16:52