I am trying to read graphs from the DIMACS archive via Python, but all I get is the error
igraph._igraph.InternalError: Error at src/io/dimacs.c:286: Unknown line type in DIMACS file. -- Parse error
I downloaded the .b graph files from Index of /pub/challenge/graph/benchmarks/clique (rutgers.edu).
I cannot attach an example because I’m new here , but try e.g. http://archive.dimacs.rutgers.edu/pub/challenge/graph/benchmarks/clique/brock200_1.clq.b
I don’t know if it’s because the binary .b format is incompatible? If anyone has a suggestion for how I can use these files from Python, I will be eternally grateful!
No, this format is not supported by igraph. You will have the implement your own reader, which shouldn’t be too difficult. The DIMACS challenges typically choose formats which are easy to parse (for as long as you don’t need to do error checking).
Generally, there isn’t really a a single “DIMACS format”. Different challenges used different formats, which are similar to each other, but not identical and difficult (or impossible) to interpret in a common framework. What igraph supports is the format for max flow problems. We have an open issue for implementing a more general reader, but doing so is a lot of work (there’s no format specification), and it’s unlikely to happen in the foreseeable future. General DIMACS importer/exporter · Issue #1924 · igraph/igraph · GitHub The format you link to doesn’t even fit in this, it’s a completely different binary format.
In short, the good news is that all these formats are easy to implement readers for for as long as you focus on reading files from one specific dataset and you don’t attempt error checking. I suggest you do that.
I see - thank you for the prompt answer!
The description that I can find seems to be for a text-based format, but the files in the archive seem to have some lines of text followed by binary data. does anyone know where I can find a description of that format with the .b extension?